fork of jsfw
Go to file
viandoxdev 9aecac6010
do things for refractor
2022-10-12 19:33:18 +02:00
.ccls init 2022-08-28 02:29:43 +02:00
.clang-format rework ! just need testing 2022-10-08 01:36:53 +02:00
.gitignore progress mostly 2022-08-30 01:06:25 +02:00
Makefile do things for refractor 2022-10-12 19:33:18 +02:00
README.md fix readme json hilighting 2022-08-31 23:27:09 +02:00
client.c do things for refractor 2022-10-12 19:33:18 +02:00
client.h rework ! just need testing 2022-10-08 01:36:53 +02:00
client_config.json do things for refractor 2022-10-12 19:33:18 +02:00
const.c rework ! just need testing 2022-10-08 01:36:53 +02:00
const.h rework ! just need testing 2022-10-08 01:36:53 +02:00
hid.c do things for refractor 2022-10-12 19:33:18 +02:00
hid.h do things for refractor 2022-10-12 19:33:18 +02:00
json.c do things for refractor 2022-10-12 19:33:18 +02:00
json.h do things for refractor 2022-10-12 19:33:18 +02:00
main.c rework ! just need testing 2022-10-08 01:36:53 +02:00
net.c do things for refractor 2022-10-12 19:33:18 +02:00
net.h do things for refractor 2022-10-12 19:33:18 +02:00
server.c do things for refractor 2022-10-12 19:33:18 +02:00
server.h do things for refractor 2022-10-12 19:33:18 +02:00
server_config.json do things for refractor 2022-10-12 19:33:18 +02:00
util.c do things for refractor 2022-10-12 19:33:18 +02:00
util.h do things for refractor 2022-10-12 19:33:18 +02:00
vec.c do things for refractor 2022-10-12 19:33:18 +02:00
vec.h rework ! just need testing 2022-10-08 01:36:53 +02:00

README.md

jsfw

Utility to forward uevent devices over network through a tcp connection.

Usage

Start client:

jsfw client [server address] [server port]

Start server:

jsfw server [port]

When a device is connected to the server host, jsfw will notice it and assign it to one of the client which will in turn create a virtual device based on it.

The code can theoretically support any kind of device (mouse, keyboard, joystick...) but is artificially limited to PS4 controllers (see hid.c::filter_event), because the hidraw interface used to set additional device state (led color, flashing, rumble) only works with them. This could be easily edited tho (see hid.c::apply_controller_state, net.h::MessageControllerState, net.c::{msg_serialize, msg_deserialize} and client.c::JControllerState). To set the controller state from the client write the json state to the fifo (by default /tmp/jsfw_fifo).

The format for the controller state takes this form (comments not allowed):

{
    "led_color": "#ff0000", // hex color string
    "flash": [0.04, 0.11], // values are 0-1, first is time on second is time off
    "rumble": [0, 0], // values are 0-1
}

Any value can be ommitted, extra values will be ignored.

Some aspect are easily configurable through const.c.

Building

Dependencies

None apart from libc, libmath, pthreads, and linux headers.

Compiling

Use the makefile, or open it and do things by hand, there's nothing magic in there.

make jsfw

output will be ./jsfw.