tags:

views:

88

answers:

3

Hi all.

I conected my bardcode scanner 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 scanner 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 know this numbers but I want to find my device by name. 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?

+1  A: 

In the same section of that page, there is a HidTest program with source. That program apparently uses HID controller code found through a link called "HID Controller component suite for Delphi". Perhaps that could give you what you're looking for? (At least if you can pick the relevant pieces out of all that Delphi code.)


I have been researching the exact kind of thing recently, but I haven't had the time to actually try any of it yet. So what follows here is a bit speculative.

I believe what you need to do is open connection to the device as USB device. Functions at the HID level don't appear to give the description you want. Here is a different SO question about getting the VendorID and ProductID from a USB device. I think you could use a very similar technique to read the USB_DEVICE_DESCRIPTOR and thus get access to the iProduct field, which I believe should be the description you want.

I have come across a program called USBView that apparently does this kind of communication (among other things) with USB devices. I found a compiled version of it here. However the source is supposedly included in the Windows Driver Development Kit. That would likely be C or C++ source, but I have not yet had time to download the DDK from Microsoft and confirm what's actually there.


EDIT:

I've had time to dig into this deeper. And what you found out about HidD_GetProductString was helpful too. I've also found this page of examples from Intel. The "Display HID" program there shows one way to use that function.

Based on that function's documentation and that example, I get the impression that it is reading the same iProduct from the device, apparently doing so from the HID level instead of the USB level. Or something like that. All I know for sure is that it is working in my own test program so far.

TheUndeadFish
Thx...I will try with USB_DEVICE_DESCRIPTOR Structure.
Lucjan Lipka
HidTest program gave me no name of device :/
Lucjan Lipka
HMM...I will look at this example. But for my information the iProduct is not similar to HidD_GetProductString. I tries to work out with iProduct. I always had null String. But HidD_GetProductString works fine.
Lucjan Lipka
there is also SPDRP_FRIENDLYNAME but I do not know what kind of name it is? I also falls every time.
Lucjan Lipka
wow awsome site with awsome examples:) thx TheUndeadFish
Lucjan Lipka
So far, none of the devices I've tried have shown anything for that Friendly Name field. It appears Product String is the best option so far.
TheUndeadFish
A: 

Hmm...the problem with iProduct is that first I have to send request for this Strings describing device to the device and then recive data. Bar code scanners are read only so I can't send data (request) to device.

I discovered that in SimpleHID there is a description of my scanner "Symbol bar ocde scanner" and it's exactly the same name that I see i control panel (devices and printers). So my question is how to get this name of device?

Lucjan Lipka
A: 

Hello!

The correct answer I found hehe:

http://www.lvr.com/forum/index.php?topic=121.0

Thx

Lucjan Lipka
Great. This helps me too. I've updated my own answer with a link to an example I found showing how to use that function.
TheUndeadFish