Skip to content

Port number display is not entirely useful since it isn't guaranteed to be unique #126

@mcclumpherty

Description

@mcclumpherty

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:

root@c57c6ac4408a:/# temper-poll -p
Found 2 devices
Device #0 (bus 2 - port 2): 30.5°C 86.9°F 
Device #1 (bus 2 - port 2): 33.1°C 91.6°F

I did this by having a setup like the following:

 - hub
   - TEMPer device
   - hub
     -  TEMPer device

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:

root@c57c6ac4408a:/# temper-poll -p
Found 2 devices
Device #0 (bus 2 - address 30 port 2): 30.5°C 86.9°F 
Device #1 (bus 2 - address 31 port 2): 33.1°C 91.6°F

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:

root@c57c6ac4408a:/# temper-poll -p
Found 2 devices
Device #0 (bus 2 - port 1.2.2): 30.5°C 86.9°F 
Device #1 (bus 2 - port 1.2.1.2): 33.1°C 91.6°F

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions