fork of jsfw
Go to file
2022-08-31 23:27:09 +02:00
.ccls init 2022-08-28 02:29:43 +02:00
.clang-format client mostly done 2022-08-31 00:54:56 +02:00
.gitignore progress mostly 2022-08-30 01:06:25 +02:00
client.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
client.h pretty much done, just daemonizing left 2022-08-31 18:54:14 +02:00
const.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
const.h cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
hid.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
hid.h cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
json.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
json.h cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
main.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
Makefile cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
net.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
net.h housekeeping 2 2022-08-31 18:59:06 +02:00
README.md fix readme json hilighting 2022-08-31 23:27:09 +02:00
server.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
server.h pretty much done, just daemonizing left 2022-08-31 18:54:14 +02:00
util.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
util.h cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
vec.c cleanup, small reorganisation, never gonna run around and desert you 2022-08-31 23:24:26 +02:00
vec.h pretty much done, just daemonizing left 2022-08-31 18:54:14 +02:00

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.