Hi, all
Does USB keyboard include some kind of serial number? I mean, something
can identify one keyboard out of other keyboards of the same brand and
model. And, if it exists, how can I get it?
Thank you in advance.

Re: USB keyboard serial number? by Eric

Eric
Wed Dec 28 09:03:14 CST 2005

You can use the Product ID and Vendor ID of the device.


Re: USB keyboard serial number? by nevaka

nevaka
Wed Dec 28 10:57:36 CST 2005

Eric wrote:

> You can use the Product ID and Vendor ID of the device.

I think this can only determine the model of the product, not the
product itself. If there is another USB keyboard(same model) plugged
in, you can't know the identity of the keyboards. They all look the
same.

I wanted to know whether there is a serial number in USB keyboard
and accessable through USB protocol.

Thank you in advance.


Re: USB keyboard serial number? by Doron

Doron
Wed Dec 28 10:57:57 CST 2005

typically, no. each instance of the keyboard will have its own device node
and its own unique Device Parameters key in which you can store instance
specific data.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"nevaka" <not_real_address@no.where> wrote in message
news:eDRc1a7CGHA.1312@TK2MSFTNGP09.phx.gbl...
> Hi, all
> Does USB keyboard include some kind of serial number? I mean, something
> can identify one keyboard out of other keyboards of the same brand and
> model. And, if it exists, how can I get it?
> Thank you in advance.
>



Re: USB keyboard serial number? by Ali

Ali
Wed Dec 28 12:58:02 CST 2005

kd> !devnode 0 1

Refer to "Inside MS Windows 2000" by David A. Solomon and Mark E.
Rissinovich , Chapter 9 I/O Systems:

A record of all the devices detected since the system was installed is
recorded under the HKLM\SYSTEM\CurrentControlSet\Enum registry key.
Subkeys are in the form <Enumerator>\<Device ID>\<Instance ID>, where
the enumerator is a bus driver, the device ID is a unique identifier
for a type of device, and the instance ID uniquely identifies different
instances of the same hardware.

The answer to both these questions lies in the registry. When a bus
driver performs device enumeration, it reports device identifiers for
the devices it detects back to the PnP manager. The identifiers are
bus-specific; for a USB bus, an identifier consists of a vendor ID
(VID) for the hardware vendor that made the device and a product ID
(PID) that the vendor assigned to the device. (See the DDK for more
information on device ID formats.) Together these IDs form what Plug
and Play calls a device ID. The PnP manager also queries the bus driver
for an instance ID to help it distinguish different instances of the
same hardware. The instance ID can describe either a bus relative
location (for example, the USB port) or a globally unique descriptor
(for example, a serial number). The device ID and instance ID are
combined to form a device instance ID (DIID), which the PnP manager
uses to locate the device's key in the enumeration branch of the
registry (HKLM\SYSTEM\CurrentControlSet\Enum).


Re: USB keyboard serial number? by Doron

Doron
Wed Dec 28 16:43:18 CST 2005

why is this important? what will you be doing with this type of information?
if you explain what you want to do, it will be easier to give a solution
that meets your needs

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"nevaka" <not_real_address@no.where> wrote in message
news:%23h1fm%238CGHA.3876@tk2msftngp13.phx.gbl...
> Eric wrote:
>
>> You can use the Product ID and Vendor ID of the device.
>
> I think this can only determine the model of the product, not the
> product itself. If there is another USB keyboard(same model) plugged
> in, you can't know the identity of the keyboards. They all look the
> same.
>
> I wanted to know whether there is a serial number in USB keyboard
> and accessable through USB protocol.
>
> Thank you in advance.
>



Re: USB keyboard serial number? by Robert

Robert
Thu Dec 29 00:06:23 CST 2005

nevaka wrote:
> Hi, all
> Does USB keyboard include some kind of serial number? I mean, something
> can identify one keyboard out of other keyboards of the same brand and
> model. And, if it exists, how can I get it?
> Thank you in advance.
>

It is unusual for USB keyboards to have serial number strings.
So you can only get the VendorID and ProductID which are the same
for keyboards of the same manufacture.
Search for enumerating HID device examples to learn more about
enumeration. The main trick for calling HID functions on keyboards
is that you have to call CreateFile on the device to use the
resulting handle for the HID functions. The keyboards are all
opened with an exclusive CreateFile call from Windoews already so you
have to use neither read nor write access for your CreateFile call.
The HID functinos are all implemented as DeviceIoControl calls to
the HID drivers which are explicitely specified to work on such a
handle.

Re: USB keyboard serial number? by nevaka

nevaka
Thu Dec 29 05:19:15 CST 2005

Doron Holan [MS] wrote:

> why is this important? what will you be doing with this type of
> information? if you explain what you want to do, it will be easier to give
> a solution that meets your needs

I want to give different keyboards different function. I know I can use
bus ids to identify them. But if user for some reason move the keyboard
to another USB port, thus changed the bus id, this kind of relationship
between keyboard and its function is unreliable.

And I want this kind of relationship reliable even after reboot and change
of usb port.

I think some kind of USB kerboard serial number can solve it. So I ask.

Thank you in advance.


Re: USB keyboard serial number? by Robert

Robert
Thu Dec 29 08:12:43 CST 2005

nevaka wrote:

> I want to give different keyboards different function.

This is only possible with a filter driver.
Windows uses all keyboards as data source for the single
virtual keyboard. This means that all physical keyboards
are held in sync with the virtual one (think of Caps Lock).

This makes Windows unsuitable for any complicated keyboard setups.
IMHO this is one of the real bad spots of Windows.

Re: USB keyboard serial number? by Doron

Doron
Thu Dec 29 13:35:43 CST 2005

if your keyboard had a serial number, it would not show up as a new device
when it is plugged into a new port. You cannot change / compensate for the
way pnp identifies "new" devices when it is plugged into a new port. It
will be a new device. If there was a way to track the device in a usb spec
compliant fashion, the bus driver would do it already.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"nevaka" <not_real_address@no.where> wrote in message
news:eT8kKmGDGHA.2908@TK2MSFTNGP09.phx.gbl...
> Doron Holan [MS] wrote:
>
>> why is this important? what will you be doing with this type of
>> information? if you explain what you want to do, it will be easier to
>> give
>> a solution that meets your needs
>
> I want to give different keyboards different function. I know I can use
> bus ids to identify them. But if user for some reason move the keyboard
> to another USB port, thus changed the bus id, this kind of relationship
> between keyboard and its function is unreliable.
>
> And I want this kind of relationship reliable even after reboot and change
> of usb port.
>
> I think some kind of USB kerboard serial number can solve it. So I ask.
>
> Thank you in advance.
>



Re: USB keyboard serial number? by Doron

Doron
Thu Dec 29 13:35:58 CST 2005

WM_INPUT allows you to differentiate the keyboards

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Robert Marquardt" <robert_marquardt@gmx.de> wrote in message
news:eHnPEGIDGHA.2436@TK2MSFTNGP15.phx.gbl...
> nevaka wrote:
>
>> I want to give different keyboards different function.
>
> This is only possible with a filter driver.
> Windows uses all keyboards as data source for the single
> virtual keyboard. This means that all physical keyboards
> are held in sync with the virtual one (think of Caps Lock).
>
> This makes Windows unsuitable for any complicated keyboard setups.
> IMHO this is one of the real bad spots of Windows.