[Nut-upsdev] newhidups: selecting device by BUS

Peter Selinger selinger at mathstat.dal.ca
Mon Sep 19 17:59:52 UTC 2005


In the regex_branch, I have now added a -x bus=X option to open a
device on a specific USB bus. Here X is a regular expression. 

When reconnecting to a previously opened device, the policy is that
the bus name of the reopened device must match the same regular
expression as previously specified, but need not match the exact same
bus as when the device was initially opened. 

Thus, e.g., -x bus='00[23]' allows the device to be moved between
busses 002 and 003. 

(This is different from how e.g. a device serial number is treated,
which must match the regular expression when the device is initially
opened, but when a device is reopened the serial number must be
exactly the same as before).

I have used the bus name (e.g. 002) for this option, and not the
serial number of the bus's USB contoller (e.g. 0000:00:1d.3), as
suggested by Charles. Reason: the serial number is attached to the USB
controller, which is a device, and it would be too complicated to have
to open it (and find the unique USB controller for each bus), to find
out its serial number. This simply seemed too complicated to be
worthwhile.

The current mechanism works great in all situations that I can think
of. I think it is stable enough and ready to be merged into the main
Development branch.

-- Peter



More information about the Nut-upsdev mailing list