Code: Select all
PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { //USB report descriptor
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x36, // USAGE (pot0)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0x00, 0x04, // LOGICAL_MAXIMUM (1024)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0 // END_COLLECTION
};
the device is correctly recognised by Windows as a one-slider "joystick".
It is not quite good for precise laboratory devices to show themselves as joysticks, and it has nothing to do with them. I do not need to control games with it, but I need to plot the data in user-mode application. So I try to make a non-standart HID device, with this descriptor:
Code: Select all
PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { //USB report descriptor
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0x00, 0x04, // LOGICAL_MAXIMUM (1024)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0 // END_COLLECTION
};
The device is found by Windows and driver installation begins. As the USB Device Monitor software says, the device is found, the descriptor is parsed correctly, but immediately after parsing Windows unloads the driver. In Device Manager, the device is displayed with a '!' sign, meaning an error. The error code displayed in Properties is "Device Cannot Start (Code 10)".
I tried other Custom HID class devices from the supplied samples, and all they share this error. I tried some workarounds suggested elsewhere, such as changing VID/PID. changing device version and even removing all USB controller drivers and reinstalling them. Unfortunately, nothing worked.
Any suggestions?