Open mcclumpherty opened 2 years ago
I also have an use case where I need to distinguish two humidity sensors, one directly connected to Raspbian and one connected to an active USB hub. Currently with temper-poll 1.6.0 it is impossible: temper-poll -p Found 2 devices Device #0 (bus 1 - port 2): 19.1°C 66.4°F 26.3%RH Device #1 (bus 1 - port 2): 25.2°C 77.4°F 21.0%RH
It is possible to identify them with lsusb -t for instance (dev 6 and dev 9 in this case), but I am not able to map that information to temper-poll:
lsusb --tree
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=, 1.5M
|__ Port 2: Dev 6, If 1, Class=Human Interface Device, Driver=, 1.5M
|__ Port 4: Dev 4, If 0, Class=Vendor Specific Class, Driver=rt2800usb, 480M
|__ Port 5: Dev 7, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 3: Dev 8, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 2: Dev 9, If 0, Class=Human Interface Device, Driver=, 1.5M
|__ Port 2: Dev 9, If 1, Class=Human Interface Device, Driver=, 1.5M
Udevadm is also able to distinguish the sensor connected to the active hub and the one connected straight to the Raspberry Pi (based on the amount of slashes for instance).
udevadm info -q path -n /dev/bus/usb/001/006
/devices/platform/soc/20980000.usb/usb1/1-1/1-1.2
udevadm info -q path -n /dev/bus/usb/001/009
/devices/platform/soc/20980000.usb/usb1/1-1/1-1.5/1-1.5.3/1-1.5.3.2
I would like to see the full port address tuple for instance so that it would be easy to identify the sensors.
In the
TemperDevice
class, the ports attribute is initialised to the port number. The naming here is somewhat contradictory - namely that a plural ('ports') is assigned a single number.That aside, it's possible for two or more TEMPer devices to show the same bus and port number and get the following output:
I did this by having a setup like the following:
It would therefore make sense to add a
--disp_address
argument on the command line which would show the device address since this is unique per usb bus. In this way you could have the following:Is this something you would consider adding?
An alternative would be to update the existing display to show the full port address tuple which is available from the
Device.port_numbers
attribute. In which case, you would get something like: