I need to identify the USB port number to which the USB-HID device is
connected given a USB device name. I have a USB keyboard or mouse device
name like \.\Device\000000XXX - where XXX - is a number that changes each
time the system starts up, so I cannot rely on it. I need a number that
uniquely identifies USB port to which the device is connected, or maybe a hub
number and a port number on that hub. I cannot use VID and PID numbers since
there may be several similar devices connected to the system. Maybe there are
some IOCTL codes that I need to send to the device? I'm working from kernel
mode in Windows XP SP3. Please help!
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"MAV" <M...@discussions.microsoft.com> wrote in message
news:00A486FD-0BCD-434C...@microsoft.com...
Use the device serial number - thats what it's for.
Leo Havmøller.
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
ma...@storagecraft.com
http://www.storagecraft.com
"Doron Holan [MSFT]" 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 ?
Then maybe look at the USBview WDK sample program.
It collects the USB tree structure, and devices attached to each node.
--pa
Port number will change on each re-plug.
> generic USB keyboard given a device name "\.\Device\000000XXX"?
If there is no unique ID in the USB config descriptor of the keyboard - then just plain impossible.
SetupDiGetClassDevs
SetupDiEnumDeviceInfo
SetupDiGetDeviceProperty (DEVPKEY_Device_Address)
Reference: "Address" section at
http://msdn.microsoft.com/en-us/library/dd852021.aspx
HidD_GetSerialNumberString
---
frmsrcurl: http://msgroups.net/microsoft.public.development.device.drivers/How-to-uniquely-identify-a-USB-HID-device
http://www.versalent.biz/downloads/quad4dll.zip
HIDstring.dll is in this zip
Let me know how it works for you. jurs...@versalent.biz
MAV wrote:
How to uniquely identify a USB-HID device ?
14-Jan-10
Hello All!
some IOCTL codes that I need to send to the device? I am working from kernel
mode in Windows XP SP3. Please help!
Previous Posts In This Thread:
On Thursday, January 14, 2010 10:55 AM
MAV wrote:
How to uniquely identify a USB-HID device ?
Hello All!
some IOCTL codes that I need to send to the device? I am working from kernel
mode in Windows XP SP3. Please help!
On Thursday, January 14, 2010 5:42 PM
Doron Holan [MSFT] wrote:
no such information exists.
no such information exists. why do you think you need to identify the port
it is attached to?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
On Friday, January 15, 2010 1:42 AM
Leo_Havm?ller wrote:
Use the device serial number - thats what it is for.Leo Havm??ller.
Use the device serial number - thats what it is for.
Leo Havm??ller.
On Friday, January 15, 2010 4:02 AM
Maxim S. Shatskih wrote:
USB is just conceptually not designed to use numbered ports.
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.
--=20
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com
http://www.storagecraft.com
On Friday, January 15, 2010 8:23 PM
MAV wrote:
??????
??????ause I have 8 identical USB keyboards and 8 identical USB mice connected
to the PC and I need a way to distinguish wheter this is keyboard #1, this is
keyboard #2, .... My driver receives the names of keyboards and mice in the
from of their device names, for example \.\Device\000000XXX and I need to
tell what is the number of this keyboard. I have a configure program where
user is asked to press buttons on keybords and mice and monitor the activity
of them. I already have the hook driver that does the monitoring job. I need
to somehow identify the keyboards and mice at every startup since
\.\Device\000000XXX is changing every time the system boots up. The port\hub
number would be great since nobody is going to recconect the keyboards and
mice.
"Doron Holan [MSFT]" wrote:
On Friday, January 15, 2010 8:24 PM
MAV wrote:
I have generic USB keyboards and mice and also PS\2 keyboards and
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:
On Friday, January 15, 2010 8:28 PM
MAV wrote:
"Maxim S.
"Maxim S. Shatskih" wrote:
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 ?
On Friday, January 15, 2010 10:14 PM
Pavel A. wrote:
Then maybe look at the USBview WDK sample program.
Then maybe look at the USBview WDK sample program.
It collects the USB tree structure, and devices attached to each node.
--pa
On Sunday, January 17, 2010 1:45 PM
Maxim S. Shatskih wrote:
system=20Port number will change on each re-plug.
system=20
Port number will change on each re-plug.
If there is no unique ID in the USB config descriptor of the keyboard - =
then just plain impossible.
--=20
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com
http://www.storagecraft.com
On Monday, January 18, 2010 4:15 PM
Philip Ries [MSFT] wrote:
I do not know if you have the device instance path for each device.
I do not know if you have the device instance path for each device. If
you do, or you can get it, you can make some SetupDi function calls to
get the port number. The sequence look something like:
SetupDiGetClassDevs
SetupDiEnumDeviceInfo
SetupDiGetDeviceProperty (DEVPKEY_Device_Address)
Reference: "Address" section at
http://msdn.microsoft.com/en-us/library/dd852021.aspx
MAV wrote:
On Tuesday, February 16, 2010 5:28 AM
guest wrote:
HidD_GetSerialNumberString
---
frmsrcurl: http://msgroups.net/microsoft.public.development.device.drivers/How-to-uniquely-identify-a-USB-HID-device
Submitted via EggHeadCafe - Software Developer Portal of Choice
Join Lists with LINQ - SharePoint 2010
http://www.eggheadcafe.com/tutorials/aspnet/b0c1cd0d-fe82-444e-a16e-7d3fb7d38eca/join-lists-with-linq--sh.aspx