(sorry for my English, it is not native language)
Hi, I make some explain:
I want make joystick project with two virtual devices, and send reports:
a) Virtual_Joystick#1 -> Report#1 -> EP81
b) Virtual_Joystick#2 -> Report#2 -> EP82
Every joystick must be do 125 reports at second (with USB_CFG_INTR_POLL_INTERVAL=10)
First.
I make simple project( based on "hid-mouse") change HID Discriptor:
Code: Select all
PROGMEM const char usbHidReportDescriptor[96] = { /* USB report descriptor, size must match usbconfig.h */
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
0xa1, 0x00, // COLLECTION (Physical)
0x85, 0x01, // REPORT_ID (1)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x10, // USAGE_MAXIMUM (Button 16)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x10, // REPORT_COUNT (16)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
0xa1, 0x00, // COLLECTION (Physical)
0x85, 0x02, // REPORT_ID (2)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x10, // USAGE_MAXIMUM (Button 16)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x10, // REPORT_COUNT (16)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
and send Report#1 and Report#2 with ONE EndPoint#81. it is works fine.
Windows asking reports, and MC send Report#1 and Report#2 step by step.
source #1 (Two Joysticks, Two reports, One endpoint #81)
http://mmjoy.googlecode.com/svn/wiki/trash/V_USB_EP81.rar
Second.
I change "usbconfig.h"
Code: Select all
#define USB_CFG_HAVE_INTRIN_ENDPOINT3 1
#define USB_CFG_EP3_NUMBER 2
add new function at "main.c"
Code: Select all
void usbSendHidReport3(uchar * data, uchar len)
{
while(1)
{ DBG1(0x05, 0, 0); /* debug output: interrupt report prepared */
wdt_reset(); usbPoll();
if (usbInterruptIsReady3())
{
DBG1(0x06, 0, 0); /* debug output: interrupt report prepared */
usbSetInterrupt3(data, len);
break;
}
}
}
and try to send: Report#1 with EndPoint#81, Report#2 with EndPoint#82
Code: Select all
usbSendHidReport((void *)&gamepad_report_1, sizeof(gamepad_report_1));
usbSendHidReport3((void *)&gamepad_report_2, sizeof(gamepad_report_2));
and... here some troubles:
a) Windows never asking for paket EndPoint#82, but HID Discriptor working great (windows create 2 pipes)
b) MC make a endless loop at checking "usbInterruptIsReady3()"
source #2 (Two Joysticks, Two reports, Two endpoints #81 and #82)
http://mmjoy.googlecode.com/svn/wiki/trash/V_USB_EP81_EP82.rar
PS: Used "vusb-20121206" and "WinAVR-20100110" only.
PS2: pictures are bigger, and cuted by forum, please open then in a new windows to see everything.