[Spice-devel] [PATCH] win: usb: use port_number instead of device_address

Hans de Goede hdegoede at redhat.com
Thu Mar 7 03:51:58 PST 2013


Hi,

On 03/07/2013 12:37 PM, Uri Lublin wrote:
> On 03/07/2013 11:02 AM, Hans de Goede wrote:
>> Hi,
>>
>> On 03/07/2013 12:27 AM, Uri Lublin wrote:
>>> It seems that device_address is not consistent and port_number is for Windows.
>>> For example the device_address may change when the WinUSB driver is
>>> installed.
>>> This seems to happen more for Win7 clients.
>>>
>>> USB devices are being redir'ed by their bus_number and device_address.
>>> When the device_address before/after installing the WinUSB driver is not
>>> the same, the "before" device will not be found, and an error message
>>> will appear. The "after" device may or may not be redir'ed.
>>>
>>> Note that win-usb-dev.h is compiled only for Windows machine.
>>>
>>> Fixes rhbz#842816
>>
>> I believe this needs more testing before it can be applied. the port-number
>> typically is the number of the hub port, so 2 devices, 1 in the first port of
>> the root-hub, and one in the 1st port of another hub could / should have the
>> same port-number.
>>
>> Can you please get 2 external usb-hubs (preferable 2 identical ones) and then
>> check what the port-numbers are for a device plugged into the 1st port of each
>> hub?
>
> Hi Hans,
>
> Indeed, more testing with 2 external usb-hubs show that two different
> devices each inserted into port 1 of two chained external usb-hubs
> may get the same (bus_number, slot_number) pair.
> (In chained external usb-hubs I mean that the second is connected to
> a port of the first which is connected to the computer)

:(

I already was afraid of that. An alternative (which is only available in
libusbx unfortunately) is libusb_get_port_path:
http://libusbx.sourceforge.net/api-1.0/group__dev.html#ga83a600e076b07b4eb7b594651ffe440c

But even when using that, there is another problem, what if the
user unplugs the device, and then replugs another device into the same
port? We need to be able to see the new device as truely a new
device in this case ... So I think we need to do some more thinking on
this and somehow comeup with a creative solution.

Regards,

Hans




More information about the Spice-devel mailing list