Respbarry pi open usb relay with pi user error - error file "hid.pyx"

Viewed 20

I cannot address the USB relay with the pi user.

System Info: raspberry pi 4 pyhton 3.9

Test pi user:

pi@raspi:~ $ python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>> dev = hid.device()
>>> dev.open(5824,1503)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "hid.pyx", line 127, in hid.device.open
OSError: open failed
>>> 

Test root user: When I run the code with root privileges it works

root@raspi:/home/pi# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
>>> dev = hid.device()
>>> dev.open(5824,1503)
>>> 

I created the following role with root (there is no other way) 99-personal.rules Folder: /etc/udev/rules.d

KERNEL=="hidraw*", ATTRS{idVendor}=="5824", ATTRS{idProduct}=="1503",> MODE="0660", GROUP="plugdev"

updated with:

sudo udevadm control --reload

I've also tried restarting the Pi and unplugging the USB relay cable and plugging it back in What do I have to do so that the pi user also has the right to execute?

0 Answers
Related