nightmode / logitech-g29

Logitech G29 Racing Wheel for Node
Creative Commons Zero v1.0 Universal
104 stars 35 forks source link

Running as non-root #1

Closed reinzor closed 8 years ago

reinzor commented 8 years ago

Hi, thanks for the amazing library! I am able to use all functionality when I run as root. However, my application has to run as non-root user but it still needs to access the HID devices. I added the user to the input group and added a udev rule but it still does not work, see:

https://github.com/node-hid/node-hid/issues/140

Do you have any idea perhaps? Thanks!

nightmode commented 8 years ago

Super happy you like it. ^_^

I'm not too familiar with setting permissions on devices. Most likely because I use a Mac as my development machine and it seems happy as is.

Out of curiosity, what udev rule did you create? Is the rule inside a particularly named file? Are you using Ubuntu and if so, which version?

reinzor commented 8 years ago

This tutorial: https://puredata.info/docs/faq/how-can-i-set-permissions-so-hid-can-read-devices-in-gnu-linux/view

I am using Ubuntu/Linux 16.04; not sure whether this udev rule is necessary since adding the user to the input group already allows opening the device with cat.

nightmode commented 8 years ago

Ah, thanks for that link.

I added myself to the group "input" but it had no effect. Adding a udev rule after that had no effect either. Both procedures tried on Ubuntu 16.04.

I did find something interesting though!

Running node-hid/src/show-devices.js without sudo looks like this.

show-devices

While running node-hid/src/show-devices.js with sudo looks like this.

show-devices-with-sudo

The logitech-g29 library is looking for the string G29 Driving Force Racing Wheel in the product field which is one of the reasons it works with sudo.

I am currently playing with an updated findWheel() function inside the logitech-g29 library that also checks the vendorId and productId fields. It finds the wheel without sudo (yay) but then halts with an error (boo). Assuming permissions are the culprit again.

error

reinzor commented 8 years ago

Yes, I already noticed the mentioned issue. However, binding to the device without sudo throws the same error as you are getting :/.

Thanks for looking the issue!

-Rein

On Fri, May 27, 2016 at 4:14 PM, Daniel Gagan notifications@github.com wrote:

Ah, thanks for that link.

I added myself to the group "input" but it had no effect. Adding a udev rule after that had no effect either. Both procedures tried on Ubuntu 16.04.

I did find something interesting though!

Running node-hid/src/show-devices.js without sudo looks like this.

[image: show-devices] https://cloud.githubusercontent.com/assets/1933203/15609703/6a0753ea-23d6-11e6-858b-38bb13df875a.png

While running node-hid/src/show-devices.js with sudo looks like this.

[image: show-devices-with-sudo] https://cloud.githubusercontent.com/assets/1933203/15609711/74e7bd68-23d6-11e6-873b-1a399687d731.png

The logitech-g29 library is looking for the string G29 Driving Force Racing Wheel in the product field which is one of the reasons it works with sudo.

I am currently playing with an updated findWheel() function inside the logitech-g29 library that also checks the vendorId and productId fields. It finds the wheel without sudo (yay) but then halts with an error (boo). Assuming permissions are the culprit again.

[image: error] https://cloud.githubusercontent.com/assets/1933203/15610294/63ce8978-23d9-11e6-86c6-1d59ac2f4525.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ForestMist/logitech-g29/issues/1#issuecomment-222157265, or mute the thread https://github.com/notifications/unsubscribe/AD-4l3kA2FWTq4al7QCTYuqV3TbA6M2Eks5qFvw-gaJpZM4InpeX .

nightmode commented 8 years ago

Updated code is live on GitHub and NPM.

More importantly, check out the updated install instructions at https://github.com/ForestMist/logitech-g29#install that detail how to create a special udev file. No group membership actions needed.

Works great on my test machine but I'll feel even better if you want to confirm that it also works on yours. :)

reinzor commented 8 years ago

Thanks a lot for your effort! I will test it and let you know on Monday!

Have a nice weekend.

-Rein

On 27 May 2016, at 19:46, Daniel Gagan notifications@github.com wrote:

Updated code is live on GitHub and NPM.

More importantly, check out the updated install instructions at https://github.com/ForestMist/logitech-g29#install that detail how to create a special udev file. No group membership actions needed.

Works great on my test machine but I'll feel even better if you want to confirm that it also works on yours. :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

reinzor commented 8 years ago

I followed your tutorial and now it works as a train :). Thanks for your support!