Author Topic: HID device with Vendor defined usage seen as HID Mouse by the system. Why?  (Read 15018 times)

selvaoscura

  • Member
  • ***
  • Posts: 12
Hello everybody.
This is my first message at this forum. Nice to be here.

I work on an application involving GUI controller (Windows8), prototype board (stm32f4Discovery) and a Joystick.
Joystick and the board connected to PC through USB, so the control path is:
------------------------
Joystick - PC - Board
------------------------

I modified original Discovery Firmware as HID device with 2 endpoints (IN and OUT).
The board enumeration is OK (no complaints from Windows).
However Plug and Play system reports "Problem: The device failed to start (Code 10)..".
My Windows HID client (controller) doesn't even see the board.

USBLyzer Device tree shows:
-------------------------------------
   Port 4: USB Input Device                    This is my board
      HID-compliant Mouse         (Where this Mouse comes from?)
-------------------------------------
      
The Mouse baffles me as there is nothing in descriptors about it.

So, my question is:
---------------------------------
What makes PnP system think that my device provides a Mouse function?
---------------------------------

Thanks for any help

APPENDIX

The descriptors as seen by USBLyzer
(Note: smilies are displayed instead of "8" in some places. Not my intention)


USB properties
--------------
Connection Status Device connected
Current Configuration 1
Speed Full (12 Mbit/s)
Device Address 14
Number Of Open Pipes 2

Device Descriptor
Offset Field Size Value Description
0 bLength 1 12h 
1 bDescriptorType 1 01h Device
2 bcdUSB 2 0200h USB Spec 2.0
4 bDeviceClass 1 00h Class info in Ifc Descriptors
5 bDeviceSubClass 1 00h 
6 bDeviceProtocol 1 00h 
7 bMaxPacketSize0 1 40h 64 bytes
8 idVendor 2 0483h SGS
10 idProduct 2 5710h 
12 bcdDevice 2 0200h 2.00
14 iManufacturer 1 01h "STMicroelectronics"
15 iProduct 1 02h ""
16 iSerialNumber 1 03h "00000000011C"
17 bNumConfigurations 1 01h 

Configuration Descriptor 1
Offset Field Size Value Description
0 bLength 1 09h 
1 bDescriptorType 1 02h Configuration
2 wTotalLength 2 0029h 
4 bNumInterfaces 1 01h 
5 bConfigurationValue 1 01h 
6 iConfiguration 1 00h 
7 bmAttributes 1 E0h Self Powered, Remote Wakeup
 4..0: Reserved  ...00000   
 5: Remote Wakeup  ..1.....  Yes
 6: Self Powered  .1......  Yes
 7: Reserved (set to one)
(bus-powered for 1.0)  1.......   
8 bMaxPower 1 32h 100 mA

Interface Descriptor 0/0 HID, 2 Endpoints
Offset Field Size Value Description
0 bLength 1 09h 
1 bDescriptorType 1 04h Interface
2 bInterfaceNumber 1 00h 
3 bAlternateSetting 1 00h 
4 bNumEndpoints 1 02h 
5 bInterfaceClass 1 03h HID
6 bInterfaceSubClass 1 00h 
7 bInterfaceProtocol 1 00h 
8 iInterface 1 00h 

HID Descriptor
Offset Field Size Value Description
0 bLength 1 09h 
1 bDescriptorType 1 21h HID
2 bcdHID 2 0111h 1.11
4 bCountryCode 1 00h 
5 bNumDescriptors 1 01h 
6 bDescriptorType 1 22h Report
7 wDescriptorLength 2 0024h 36 bytes

Endpoint Descriptor 81 1 In, Interrupt, 10 ms
Offset Field Size Value Description
0 bLength 1 07h 
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 81h 1 In
3 bmAttributes 1 03h Interrupt
 1..0: Transfer Type  ......11  Interrupt
 7..2: Reserved  000000..   
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 0Ah 10 ms

Endpoint Descriptor 01 1 Out, Interrupt, 10 ms
Offset Field Size Value Description
0 bLength 1 07h 
1 bDescriptorType 1 05h Endpoint
2 bEndpointAddress 1 01h 1 Out
3 bmAttributes 1 03h Interrupt
 1..0: Transfer Type  ......11  Interrupt
 7..2: Reserved  000000..   
4 wMaxPacketSize 2 0040h 64 bytes
6 bInterval 1 0Ah 10 ms

Interface 0 HID Report Descriptor Vendor-Defined 1
Item Tag (Value) Raw Data
Usage Page (Vendor-Defined 157) 06 9C FF 
Usage (Vendor-Defined 1) 09 01 
Collection (Application) A1 01 
    Report ID (1) 85 01 
    Usage (Vendor-Defined 2) 09 02 
    Logical Minimum (0) 15 00 
    Logical Maximum (-1) 25 FF 
    Report Size (8) 75 08 
    Report Count (63) 95 3F 
    Input (Cnst,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 03 
    Report ID (2) 85 02 
    Usage (Vendor-Defined 2) 09 02 
    Logical Minimum (0) 15 00 
    Logical Maximum (-1) 25 FF 
    Report Size (8) 75 08 
    Report Count (63) 95 3F 
    Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,Vol,Bit) 91 82 
End Collection C0 
Usage (Vendor-Defined 2) 09 02 
Usage Maximum (Undefined) 29 00 
Usage (Vendor-Defined 33) 09 21 
Logical Maximum (0) 24 
Usage Page 07 05 81 03 40 
Usage 0A 07 05 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
If the original firmware was for a mouse, Windows might be remembering those descriptors.

With the device attached, open Windows Device Manager and uninstall the device (under Driver). Then reattach.

selvaoscura

  • Member
  • ***
  • Posts: 12
Yee-haa!! That was it!

Thank you so much Jan!

Feel almost stupid though, as this crossed my mind once.
Now back to business

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
It's easy to forget about that little Windows "feature."