jslisten icon indicating copy to clipboard operation
jslisten copied to clipboard

Hotplug and --device argument

Open Norde opened this issue 5 years ago • 2 comments

It seems that jslisten does'nt detect hotplug (at least when using --device argument).

I dunno if it's a bug or if jslisten isn't planned to handle this.

Howether it can be easily bypassed with a udev rule triggering restart of jslisten service. If jsliten isn't intended to detect hotplug i can push a "how to" for some udev rule in the README.md.

Norde avatar Feb 06 '20 07:02 Norde

I have this exact issue with Bluetooth 8bitdo controllers when they sleep. Can you describe what you’re doing in udev to make this work?

pilgrim556 avatar Sep 03 '20 23:09 pilgrim556

Connect your controller when run cmd: > udevadm info --name=/dev/input/jsX --attribute-walk (with X according to your controller adress number)

Note values of "SUBSYSTEMS" and "ATTRS{phys}".

Then create a rule file under /etc/udev/rules.d/ e.g: > sudo nano /etc/udev/rules.d/99-persistent-joystick.rules

Then fill it with values obtained previously:

SUBSYSTEM=="SUBSYSTEM_VALUE",
ATTRS{uniq}=="ATTRS{phys}_VALUE",
TAG+="systemd",
ENV{SYSTEM_USER_WANTS}="jslisten.service", \

Give rights to your newly created file: > sudo chmod 755 /etc/udev/rules.d/99-persistent-joystick.rules

Reload and apply new udev rules: > sudo udevadm control --reload-rules > sudo udevadm test -a -p $(udevadm info -q path -n /dev/input/jsX)

Optionally you can attribute a symbolic link to your controller (very useful to identify a given controller if you have multiple ones). Simply add "SYMLINK+="input/joy1", " to your 99-persistent-joystick.rules file (with joy1 as name for the controller, for exemple). Now your controller will have a fixed symbolic adress that you can refer to (instead of random /dev/input/jsX at each unplug/plug).

Norde avatar Sep 20 '20 10:09 Norde