Realtime Client/Server app for Linux allowing joystick (and other HID) data to be transferred over a local network

Overview

netstick

What is it?

Netstick enables HID devices to be remotely connected between a "client" and "server" over a network connection.

It allows the keyboards, mice, joysticks, and other HID devices physically attached to one computer to seamlessly connect to another. All input events detected on the client are broadcast in real-time to the server and interpreted as if the devices were attached to it.

The client and server are lightweight and efficient -- written in high-performance C with zero external library dependencies (on Linux).

While netstick currently implements a linux host and server, the wire protocol is designed such that any networked devices can implement the client and server roles without assuming a particular network technology or underlying host OS.

Why write it?

My reason for writing netstick is to provide a convenient way to use a bunch of wired USB gamepads with a raspberry pi connected to a TV; where the layout of the room make it impractical to connect them directly, and where USB extension cords would be an eyesore and a tripping hazard. cords.

The idea was to have a conveniently-located secondary Raspberry Pi act as a wifi-enabled joystick hub running multiple instances of the netstick client, transmitting data from the connected joysticks over wifi to the primary Raspberry Pi.

In the design process I realized that the mechanism that I used to implement the joystick hub would "just work" for other HID devices connected to the hub, and that functionality would come for free.

What works?

netstickd (server):

  • Single-threaded event-driven server using epoll
  • Multiple concurrent connections from multiple clients
  • Register remote Keyboard, Mouse, and Joystick devices locally using Linux uinput module
  • Analog (Absolute axis, Relative axis) events
  • Digital (keyboard/mouse/joystick button) events

netstick (client):

  • Single-threaded, single-device client
  • Enumerate local HID devices and transmit configuration to remote device creation
  • Analog (Absolute axis, Relative axis) events
  • Digital (keyboard/mouse/joystick button) events

protocol:

  • Tag/length/value/checksum message format
  • slip-encoding of message frames
  • device-registration message format
  • TCP/IP (IPv4) connections

What doesn't work?

  • Any server-to-client features - such as force-feedback, programmable LEDs, etc.
  • Keyboard repeat-rate messages
  • Handle multiple HID devices with a single netstick client interface (although multiple netstick clients can be run on a device)

ToDo's

  • Optimize data structures sent over-the-wire.
  • Add a keyboard-emulation mode for joystick events.
  • Add IPv6 support

Building

$ cmake ./CMakeLists.txt $ make

Running

netstickd (server):

$ ./netstickd <port>

Where:
- port is the network port that the server will listen on for incoming connections

NOTE: 
- as netstickd registers devices with uinput, you need to ensure that the user is a member of a group capable registering uinput devices (or run it as root)

netstick (client): $ ./netstick <source> <ip> <port>

Where:
- source is the path the uinput device to forward over the network (i.e. /dev/input/eventX)
- ip address of the server
- port on the server to connect to 

License

Copyright (c) 2021, Funkenstein Software Consulting

This program is BSD licensed software, See LICENSE.txt for more details.

You might also like...
Netif - Header-only C++14 library for getting network addresses associated with network interface without name lookups on Windows, macOS, Linux, and FreeBSD

NetIF Get addresses associated with network interfaces on a system without using name lookups. Header-only, requires C++14. Usage Add the header file

A network library for client/server games written in C++

yojimbo yojimbo is a network library for client/server games written in C++. It's designed around the networking requirements of competitive multiplay

A virtual network Differential GNSS server-client project using Precise Point Positioning (PPP). Global coverage. Without physical base station construction needed. An open-source virtual base station approach.
A virtual network Differential GNSS server-client project using Precise Point Positioning (PPP). Global coverage. Without physical base station construction needed. An open-source virtual base station approach.

Virtual-Network-DGNSS-Project This project is the software implementation for a publicly available, open-source, client/server VN-DGNSS implementation

single header C(99) library to implement client-server network code for games

single header C(99) library to implement client-server network code for games

Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC or RDP)
Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC or RDP)

Linux Terminal Service Manager (LTSM) is a set of service programs that allows remote computers to connect to a Linux operating system computer using a remote terminal session (over VNC)

Warp speed Data Transfer (WDT)  is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths.
Warp speed Data Transfer (WDT) is an embeddedable library (and command line tool) aiming to transfer data between 2 systems as fast as possible over multiple TCP paths.

WDT Warp speed Data Transfer Design philosophy/Overview Goal: Lowest possible total transfer time - to be only hardware limited (disc or network bandw

A software C library designed to extract data attributes from network packets, server logs, and from structured events in general, in order to make them available for analysis

MMT-DPI A software C library desinged to extract data attributes from network packets, server logs, and from structured events in general, in odrder t

Event-driven network library for multi-threaded Linux server in C++11

Muduo is a multithreaded C++ network library based on the reactor pattern. http://github.com/chenshuo/muduo Copyright (c) 2010, Shuo Chen. All righ

This repository contains a set of InternalBlue patches for the BCM4375B1 Bluetooth controller, allowing to sniff and inject Zigbee, Mosart and Enhanced ShockBurst packets from a Samsung Galaxy S20 smartphone.

RadioSploit 1.0 - Patches This repository contains a set of InternalBlue patches for the BCM4375B1 Bluetooth controller, allowing to sniff and inject

Comments
  • Why my friend wegarus needs this crap? I think he should be doing something else because he is interested in completly different things.

    Why my friend wegarus needs this crap? I think he should be doing something else because he is interested in completly different things.

    Why you need to emulate mouse, keyboard or something else? I know that you are interested in operating systems, no in this strange thing. Please anwser on my question. This kind of stuff is very dangerous for you.

    opened by Kiriil-Shark05 0
  • Not building properly.

    Not building properly.

    Using Ubuntu 20.04 i get this output Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags:

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: -c

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --c++

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --ec++

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags:

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: -c

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --c++

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --ec++

    The output was: No such file or directory

    Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed. Compiler: CMAKE_CXX_COMPILER-NOTFOUND Build flags: Id flags: --target=arm-arm-none-eabi;-mcpu=cortex-m3

    The output was: No such file or directory

    opened by CactusBoy3 0
Owner
null
Dohd is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP)

dohd Dohd (pron. doh-dee) is a minimalist DNS-over-HTTPS daemon that redirects all DoH queries to a local DNS server running on localhost:53 (UDP). Fe

Dyne.org 15 Nov 1, 2022
Server and client on M5 Core 2 to talk to Spark app and Spark amp with NimBLE

BLEAppSpark Server and client on M5 Core 2 to talk to Spark app and Spark amp with NimBLE. *** IOS ONLY *** Works perfectly - a pass-thru from app to

null 1 Oct 6, 2021
A linux based file-transfer system in terminal. Share Files Over A Network

Introduction A linux based file-transfer system in terminal. Share Files Over A Network Note This Project Is Not Fully Completed Yet But You Are Free

notaweeb 8 Sep 20, 2021
To have platform independent network interfaces over usb which is working with Linux, Windows, Mac OS ect.

To have platform independent network interfaces over usb which is working with Linux, Windows, Mac OS ect. called RNDIS. This project is a RNDIS demo, which addtionally implements a http server. It runs out of the box on a stm32f411 BlackPill board. My RNDIS library with an empty template for the second interface (which can ba UART, CAN, ETH or like in this demo a tcp/ip stack) can be found under following link: https://github.com/RDMsmartnetworks/STM32_HAL_RNDIS

Nico Korn 16 Sep 27, 2022
LAppS - Lua Application Server for micro-services with default communication over WebSockets. The fastest and most vertically scalable WebSockets server implementation ever. Low latency C++ <-> Lua stack roundtrip.

LAppS - Lua Application Server This is an attempt to provide very easy to use Lua Application Server working over WebSockets protocol (RFC 6455). LApp

null 48 Oct 13, 2022
The project consists in a client/server architecture voice over IP application, similar to Skype or TeamSpeak.

Babel The project consists in a client/server architecture voice over IP application, similar to Skype or TeamSpeak. Build and Run the Project First y

Benjamin Reigner 1 Jan 17, 2022
A protocol for secure client/server connections over UDP

netcode netcode is a simple connection based client/server protocol built on top of UDP. It has the following features: Encrypted and signed packets S

The Network Protocol Company 2.2k Nov 24, 2022
A protocol for secure client/server connections over UDP

netcode netcode is a simple connection based client/server protocol built on top of UDP. It has the following features: Encrypted and signed packets S

The Network Protocol Company 2.2k Nov 24, 2022
a c++/qt client app for use with Tachidesk server

Tachidesk-qtui a c++/qt client app for use with Tachidesk server what works: selecting manga and viewing and selecting chapters installing/uninstallin

null 19 Nov 26, 2022
Header-only C++14 library for getting network addresses associated with network interface without name lookups on Windows, macOS, Linux, and FreeBSD

NetIF Get addresses associated with network interfaces on a system without using name lookups. Header-only, requires C++14. Usage Add the header file

GMLC-TDC 9 Oct 17, 2022