Closed patrickfuller closed 4 years ago
Alternatively it can be done via serial number.
https://github.com/apmorton/pyhidapi/blob/master/hid/__init__.py#L117-L127
You'd be right if the TrippLite returned serial numbers.
import hid
hid.enumerate()
[{'path': b'0003:0005:00',
'vendor_id': 1131,
'product_id': 65296,
'serial_number': '',
'release_number': 256,
'manufacturer_string': '',
'product_string': '',
'usage_page': 0,
'usage': 0,
'interface_number': 0},
{'path': b'0003:0005:01',
'vendor_id': 1131,
'product_id': 65296,
'serial_number': '',
'release_number': 256,
'manufacturer_string': '',
'product_string': '',
'usage_page': 0,
'usage': 0,
'interface_number': 1},
{'path': b'0003:0061:00',
'vendor_id': 2478,
'product_id': 8210,
'serial_number': '',
'release_number': 9,
'manufacturer_string': 'Tripp Lite ',
'product_string': 'Tripp Lite UPS ',
'usage_page': 0,
'usage': 0,
'interface_number': 0},
{'path': b'0003:005f:00',
'vendor_id': 2478,
'product_id': 8210,
'serial_number': '',
'release_number': 9,
'manufacturer_string': 'Tripp Lite ',
'product_string': 'Tripp Lite UPS ',
'usage_page': 0,
'usage': 0,
'interface_number': 0},
{'path': b'0003:0060:00',
'vendor_id': 2478,
'product_id': 8210,
'serial_number': '',
'release_number': 9,
'manufacturer_string': 'Tripp Lite ',
'product_string': 'Tripp Lite UPS ',
'usage_page': 0,
'usage': 0,
'interface_number': 0}]
Wrong library link. There are multiple wrappers for hidapi and they're all named the same. It's cython-hidapi.
It would be nice if serials or similar worked, as the paths change each time you call this function. The fact that none of the serials pop up here makes me think this may be a library issue.
Right now, this driver can handle reading multiple tripplites with unique product IDs but not multiple of the same product.
To do this, follow this advice and use
hid.enumerate
to grab all unique paths.The path could then be passed to each
TrippLite
object.