From: Leo Havmøller on
> I cannot use VID and PID numbers since
> there may be several similar devices connected to the system.

Use the device serial number - thats what it's for.

Leo Havmøller.

From: Maxim S. Shatskih on
> I need to identify the USB port number to which the USB-HID device is

USB is just conceptually not designed to use numbered ports.

If, for instance, the laptop has several USB ports, then _the idea is that the same device will work the same way_ regardless of the port it is connected too. Several USB ports provide a nearly complete illusion of electric parallelism.

So, it is not a good idea to use USB port numbers anywhere. Use device instances instead, strongly tied to the device's embedded unique ID and not the port it is connected too. This is well-supported in Windows using PnP.

--
Maxim S. Shatskih
Windows DDK MVP
maxim(a)storagecraft.com
http://www.storagecraft.com

From: MAV on
I have generic USB keyboards and mice and also PS\2 keyboards and mice
connected through USB<->PS\2 adapter. Neither of those have serial number.

"Leo Havmøller" wrote:

> > I cannot use VID and PID numbers since
> > there may be several similar devices connected to the system.
>
> Use the device serial number - thats what it's for.
>
> Leo Havmøller.
>
From: MAV on
"Maxim S. Shatskih" wrote:

> So, it is not a good idea to use USB port numbers anywhere. Use device instances instead, strongly tied to the device's embedded unique ID and not the port it is connected too. This is well-supported in Windows using PnP.

I need a number or device ID that will not change every time the system
starts up. Could you please tell me how to retrieve such unique ID for
generic USB keyboard given a device name "\.\Device\000000XXX"? Maybe to send
some IOCTL's ?
From: Pavel A. on
"MAV" <MAV(a)discussions.microsoft.com> wrote in message
news:EEA7C21F-BB9B-4BF9-985F-F69293D238D8(a)microsoft.com...
> I have generic USB keyboards and mice and also PS\2 keyboards and mice
> connected through USB<->PS\2 adapter. Neither of those have serial number.

Then maybe look at the USBview WDK sample program.
It collects the USB tree structure, and devices attached to each node.
--pa


> "Leo Havmøller" wrote:
>
>> > I cannot use VID and PID numbers since
>> > there may be several similar devices connected to the system.
>>
>> Use the device serial number - thats what it's for.
>>
>> Leo Havmøller.
>>