I have this system where I have 8 USB RFID readers which I would like to distinguish from one another. Here's a snippet from lsusb
Bus 002 Device 011: ID 05fe:1010 Chic Technology Corp. Optical Wireless
Bus 002 Device 012: ID 05fe:1010 Chic Technology Corp. Optical Wireless
As you can see both the idVendor
and the idProduct
is the same for the two USB RFID readers.
Q1: Can anyone help me do a --attrubute-walk
with the udev info
so I can see if there's any parameter that is unique to the individual readers. (I'm using Ubuntu 14.04 LTS)
This is the sys path I think I'm supposed to look in, and what the folder contains:
nicolai@nicolai-K53SV:~$ ls /sys/bus/usb/devices/
1-0:1.0 1-1:1.0 1-1.2:1.0 1-1.4 2-0:1.0 2-1:1.0 4-0:1.0 usb2 usb4
1-1 1-1.2 1-1.2:1.1 1-1.4:1.0 2-1 3-0:1.0 usb1 usb3
So of course I tried the following:
udevadm info --attribute-walk --path=/sys/bus/usb/devices/usb1
udevadm info --attribute-walk --path=/sys/bus/usb/devices/usb2
udevadm info --attribute-walk --path=/sys/bus/usb/devices/usb3
udevadm info --attribute-walk --path=/sys/bus/usb/devices/usb4
But I can't seem to find the two devices listed at the top (with ID 05fe:1010).
Q2: If there is a parameter that is unique to the individual reader, how can I (hopefully in python) distinguish between them?
Here's some python code which I thought I could use (until I realised that the ID's where the same for every RFID reader)
import usb
dev = usb.core.find(idVendor=0x05fe,idProduct=0x1010)
if dev is None:
raise ValueError('Device not found')
else:
print('Device found')
Update
A1: Here's the output from the lsusb -v
: http://paste.ubuntu.com/7818192/
As it can be seen the iSerial is just zero and all the other attributes are the same for both devices.
So for Q2: I was wondering if I could use the setserial
bash command to write a serial to the USB RFID reader. If so, is this serial stored even after the power is lost, or do you have to create a script that creates the serials every time you boot?
Any suggestion is helpful.
lsusb -v
show a serial number? Probably callediSerial
.