Hi everyone,
I'm on trouble with the USB file descriptor... It is weird, since it works in windows XP, but in vista or win 7 it is not installed correctly. I used the library and the HID example from ST. First I show the report which only works on XP:
const BYTE HID_ReportDescriptor[] = {
HID_UsagePageVendor(0x00),
HID_Usage(HID_USAGE_PAGE_GENERIC),
HID_Collection(HID_Application),
HID_Usage(HID_USAGE_PAGE_VR), // Usage (vendor-defined)
HID_UsageMin(1),
HID_UsageMax(1),
HID_LogicalMin(0),
HID_LogicalMax(0xFF),
HID_ReportSize(16), //report Size (16 bits)
HID_ReportCount(250), // 250 * 2 bytes (16bits) = 500 bytes
HID_Input(HID_Data | HID_Variable | HID_Absolute),
HID_UsagePage(HID_USAGE_PAGE_LED),
HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
HID_LogicalMin(0),
HID_LogicalMax(1),
HID_ReportCount(8),
HID_ReportSize(1),
HID_Output(HID_Data | HID_Variable | HID_Absolute),
HID_EndCollection,
};
const BYTE USB_ConfigDescriptor[] = {
// Configuration 1
USB_CONFIGUARTION_DESC_SIZE,
USB_CONFIGURATION_DESCRIPTOR_TYPE,
WBVAL(
USB_CONFIGUARTION_DESC_SIZE +
USB_INTERFACE_DESC_SIZE +
HID_DESC_SIZE +
USB_ENDPOINT_DESC_SIZE
),
0x01,
0x01,
0x00,
USB_CONFIG_BUS_POWERED,
USB_CONFIG_POWER_MA(100),
USB_INTERFACE_DESC_SIZE,
USB_INTERFACE_DESCRIPTOR_TYPE,
0x00,
0x00,
0x01,
USB_DEVICE_CLASS_HUMAN_INTERFACE,
HID_SUBCLASS_NONE,
HID_PROTOCOL_NONE,
0x5E,
HID_DESC_SIZE,
HID_HID_DESCRIPTOR_TYPE,
WBVAL(0x0110),
0x00,
0x01,
HID_REPORT_DESCRIPTOR_TYPE,
WBVAL(HID_REPORT_DESC_SIZE),
USB_ENDPOINT_DESC_SIZE,
USB_ENDPOINT_DESCRIPTOR_TYPE,
USB_ENDPOINT_IN(1),
USB_ENDPOINT_TYPE_INTERRUPT,
WBVAL(500), // wMaxPacketSize:500 bytes.
0x40,
0
};
What I did was that wMaxPacketSize (6 lines upwards from here, equal to 500 bytes) was equal to the HID_ReportCount*HID_ReportSize/8. Following the same logics, and just changing these variables:
[...]
HID_ReportCount(32), // 32 * 2 byte (16bits) = 64 bytes
[...]
WBVAL(64), // wMaxPacketSize: 64 bytes.
[...]
it gets correctly installed on vista and 7. If then I increase 2 bytes:
[...]
HID_ReportCount(33), // 33 * 2 byte (16bits) = 66 bytes
[...]
WBVAL(66), // wMaxPacketSize: 66 bytes.
[...]
It stop working again... Someone knows why it happens? Are vista or win 7 limited to 64 bytes? With windows XP I could transfer 500 bytes without problem, and that was amazing, since I need to transfer some ammount of data by polling (with a VC++ 2008 program) using a timer, and I need more than 64 bytes per USB transaction, since the timer in a OS is not fast enough...
I also tried to use HID_ReportCount(64) and WBVAL(128), to try if it was that the OS needs a value of 2^n, but it neither worked...
Thank you! :-)