0

I am trying to access an USB device as $USER running some Python Code based on this GIT repo. I am running Ubuntu 20.04 Server on a RaspberryPi4b. It works fine as root

sudo python3 myPythonCode.py

but not as $USER i.e.

python3 myPythonCode.py

which leads me to believe it's an Access Rights Problem. I tried

  1. sudo chown $USER /dev/usb/
  2. sudoedit /etc/udev/rules.d/50-myusb.rules and add line KERNEL=="ttyUSB[0-9]",MODE="0666" to file
  3. sudo usermod -a -G dialout $USER

The device is mounted obviously lsusb:

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 045e:02fe Microsoft Corp. 
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But it does not show up in /dev/ttyUSB but you can find it in /dev/bus/usb/001/005 (duh). dmesg | tail:

[  210.127161] input: Microsoft X-Box One pad as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/gip0/gip0.0/input/input1
[  998.563321] usb 1-1.4: USB disconnect, device number 4
[ 1018.975089] usb 1-1.4: new high-speed USB device number 5 using xhci_hcd
[ 1019.076591] usb 1-1.4: New USB device found, idVendor=045e, idProduct=02fe, bcdDevice= 1.00
[ 1019.076607] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1019.076619] usb 1-1.4: Product: XBOX ACC
[ 1019.076630] usb 1-1.4: Manufacturer: Microsoft Inc.
[ 1019.076640] usb 1-1.4: SerialNumber: 430112
[ 1019.163760] usb 1-1.4: reset high-speed USB device number 5 using xhci_hcd
[ 1022.292169] input: Microsoft X-Box One pad as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/gip0/gip0.0/input/input2

Any suggestions?

1 Answers1

0

tl;dr: Add $USER to input group

sudo usermod -a -G input $USER

and everything works like a charm.

Long Version: Thank you for reading. I will not edit my question, so anybody can see my earlier ignorance, but here is some insight:

Not all USB devices are TTY. This is true for Serial Communication via USB (the only way I had seen before), hence the USB dongle does not mount as /dev/ttyUSB ..., so most of my semi-ignorant solutions were bullshit. Actually human interface devices are mounted at /dev/input/ which can be read by adding your user to the input group. To continue please read askubuntu.com/questions/210895/what-are-the-files-in-dev-input-and-what-they-do.

Also, when using threading package, errors will not be thrown if happens within thread, unless the developer explicitly implements it, see stackoverflow.com/questions/2829329/catch-a-threads-exception-in-the-caller-thread.