PORTS Forum

Ports and Interfaces => USB => Topic started by: lipkerson on September 20, 2010, 03:32:29 am

Title: Detailed description of HID device (USB)
Post by: lipkerson on September 20, 2010, 03:32:29 am
Hi all.

I conected my bardcode reader to USB port. I needed to change the mode from HID keyboard to serial port emulation (the reader is know seen by the system as regular HID device and not a  HID system keyboard) to get data from reader directly to my app. And It's all working great.

The problem is that I need to know a VID and PID numbers to find my device. I encounter a program called SimpleHIDWrite:

http://www.lvr.com/hidpage.htm in Tools.

When I lunch the program by device has a nice desciprion "Symbol Bar Code Scanner".

I tries to reach this name by my self - I used structures:
HIDD_ATTRIBUTES
HIDP_CAPS
SP_DEVICE_INTERFACE_DATA
SP_DEVICE_INTERFACE_DETAIL_DATA
SP_DEVINFO_DATA

but I couldn't find a field in structures that allow me to gain access to this description.

Unfortunately I can't find SimpleHIDWrite source code to learn how to do this.

Can You help me?

THX
Title: Re: Detailed description of HID device (USB)
Post by: divabanana on September 20, 2010, 02:53:35 pm
Use this free utility to find the VID and PID of any connected USB device: http://www.nirsoft.net/utils/usb_devices_view.html

Run it, double click on the device you want to know about and you will be shown all the info about the device you need.
Title: Re: Detailed description of HID device (USB)
Post by: lipkerson on September 20, 2010, 03:28:41 pm
But I know how to get pid and vid of devices connected to my computer. I just what to get the decription of device...I want to implement this by my self.

I see in control panel in windows that device name is "Motorola barcode scanner" and i just want to know where can I find this description in MSDN functions.
Title: Re: Detailed description of HID device (USB)
Post by: Jan Axelson on September 22, 2010, 11:51:34 pm
See

HidD_GetProductString

Jan
Title: Re: Detailed description of HID device (USB)
Post by: lipkerson on September 23, 2010, 04:02:02 am
Thx-that was It!!

Before You answered me I tried to work with SetupDiGetDeviceRegistryProperty with properyty "SPDRP_FRIENDLYNAME" but the result was always empty String even when the function returned true.

I'am curious what is the usage of this properyty-when I can get a FRIENDLYNAME of device? Maybe It is not meant to HID devices?

THX once again...and You wrote awsome book by the way (USB Complete - I'am from Poland and we have no polish edition but still...) :)
Title: Re: Detailed description of HID device (USB)
Post by: Jan Axelson on September 30, 2010, 11:31:33 pm
The HID function retrieves the string from the descriptor. Perhaps the friendly-name function retrieves a string from the INF file, if present. Just a guess.

I'm glad to hear you've found USB Complete helpful!

Jan