Author Topic: Windows HID device name  (Read 16100 times)

ucode81

  • Member
  • ***
  • Posts: 3
Windows HID device name
« on: August 11, 2010, 09:49:05 pm »
Hi all,

Thanks to Jan's wonderful book (USB Complete), I was able to write an USB 2.0 HID driver for the PIC 18F series in assembler that is compact and has completely replaced all of my former serial connections for the embedded systems I design.  Moreover, auto-detect of these plug-and-play devices is a snap on Windows and the speed is impressive!  Everything is WORKING fine BUT there is one annoyance because....

...try as a might, when Windows XP first recognizes the device, it pops up the device name as a dull and generic "USB Device" followed by the usual "Human-Interface Device" (and then the "ready for use").  Nearly all commercial USB HID devices have a device name such as "PicKit2 Programmer" or "Microsoft Mouse" or "<put product name here>" that pops up INSTEAD of "USB Device".  SnoopyPro and other USB tools also show my device name as "USB Device".  But direct probing s/w such as Jan's usbhidio on VC6 sees the product name, manufacturer name, serial number, etc. all correctly (per the recommended USB string descriptor definition).  I have searched Jan's book, this and other websites, and scrutinized Microsoft's documentation trying at least 30 different ideas, NONE of which panned out.  I am starting to feel like an idiot.

Why doesn't my Product Name show up during the USB HID detection process???  Any clue as to where I should look????  Is there some checking I am failing (e.g. Microchip assigned me a PID to use with their VID but I do not use "Microchip..." as the Manufacturer Name in the USB string table)?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Windows HID device name
« Reply #1 on: August 11, 2010, 10:45:36 pm »
A vendor-specific description requires a digitally signed inf file. Some signed HIDs are in the system file \windows\input.inf in entries like this:

USB\VID_xxxx&PID_yyyy.DeviceDesc = "My Device"

I'm glad to hear you found USB Complete useful!

Jan

patricioconti

  • Member
  • ***
  • Posts: 2
Re: Windows HID device name
« Reply #2 on: August 12, 2010, 02:50:05 pm »
Jan, Your book is completely amazing. I used your example code for PIC18F and I got my Freescale MC68HC908JB16 working as a USB HID device. With your code I was able to write the response for the GET_REPORT and SET_REPORT requests, and I was also able to send and receive reports using interrupt transfers. When I first plugged my device the customized string name appears (string descriptor) , and then it changes to HID string. I think this is normal, is it?
Thanks very much Jan, I really appreciate your work.
I'm an electronic engineer from Argentina.
Thanks!

ucode81

  • Member
  • ***
  • Posts: 3
Re: Windows HID device name
« Reply #3 on: August 12, 2010, 11:11:37 pm »
Hi Jan,

Yes, 4th edition rocks!

However, I wish the answer you gave for the Windows HID detection was that simple.  I already unsucessfully went down that path.  I very carefully tested my PicKit2 programmer on my wife's computer by first looking through the ENTIRE registry and every file in the Windows directory tree for *any* reference to Microchip or its VID or the PID they use.  There is NO information ANYWHERE in the system (I mean how likely would that be anyway).

I ensured the system was not on the network when I plugged the PicKit2 into the system for the very first time and it gleefully announces "PicKit2 Microcontroller Programmer".

I ran this experiment on my daughter's laptop with the same outcome.

No, there is STILL something subtle being missed.  I guess I will keep hunting...

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Windows HID device name
« Reply #4 on: August 13, 2010, 10:53:57 am »
The first string displayed is from a descriptor in the device. The second, final string is from the device's INF file.

My ICD3 shows up in Device Manager as:

"Microchip 'MPLAB ICD3'"

A search of /Windows/inf brought up that description in one of the oemxx.inf files (also the corresponding oemxx.pnf).

Another example - my HID keyboard shows up as:

Microsoft USB Natural Ergonomic Keyboard 4000 (IntelliType Pro)

and again, this description is in an inf file.

If you're using the built-in Windows search, be aware that by default it searches only specific file types. I use FileLocator Pro, but there are others.

Jan




 

ucode81

  • Member
  • ***
  • Posts: 3
Re: Windows HID device name
« Reply #5 on: August 16, 2010, 12:10:31 am »
Hi Jan,

I have finally gotten to the bottom of this after some USB protocol analyzer gymnastics.  It turns out that Microsoft usbhid driver uses the Product Name provided by the USB device itself the first time it is plugged in; the INF file can play a role if the standard strings expected by Microsoft are not there (Language ID, Product Name, Manufacturer at a minimum).  This is true for Windows XP, Vista, and 7 at least.  The serial number is not required for HID devices unless you use the same PID/VID where having a unique serial number keeps them unique.

With the minor fix to my driver (it is VERY important that the language ID be precisely what Microsoft expects) that is returned by string index 0, every system in the house is happily showing my Product Name in the installation popup balloon in Windows the first time I plug it in.

Anyway, I *really* appreciate your timely responses which spurred me on.  Hopefully what I learned can be added to this vast pool of knowledge to which you are the primary contributor!

-Mitch

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Windows HID device name
« Reply #6 on: August 16, 2010, 09:10:37 am »
I'm glad to hear you got it working. Thanks for posting what you found out.

Jan