benvanik / vr.js

NPAPI plugin to expose fun VR devices to Javascript.
Apache License 2.0
498 stars 105 forks source link

Improved udev rule? #28

Open jjsmclaughlin opened 10 years ago

jjsmclaughlin commented 10 years ago

I've now managed to get the vr.js experimental usb driver working on linux. I stumbled upon an article which clarifies the difference between the PROGRAM and RUN assignments in udev rules:

http://www.reactivated.net/writing_udev_rules.html#external-run

I think it suggests that RUN would be a better assignment than PROGRAM for the udev rule contained in 'experimental/usb-driver/hacks/40-oculus.rules'. So the new rule would be:

SUBSYSTEM=="usb", ATTR{idVendor}=="2833", ATTRS{idProduct}=="0001", MODE="0664", GROUP="plugdev", RUN+="/bin/sh -c 'echo -n $id:1.0 >/sys/bus/usb/drivers/usbhid/unbind'"

I've checked this and it still works. It also might be worth pointing out that a user may not have the "plugdev" group on their system (depends on distro). This just needs to be any group that the user who'll be running the usb-driver belongs to.