Page 1 of 2

Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Mon May 20, 2013 10:05 am
by mega_mozg_13
Endless loop. usbInterruptIsReady3() usbSetInterrupt3()
(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.
Image
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)
Image
b) MC make a endless loop at checking "usbInterruptIsReady3()"
Image

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.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 3:56 pm
by ulao
your not polling?

while (!usbInterruptIsReady()) usbPoll();
usbSendHidReport((void *)&gamepad_report_1, sizeof(gamepad_report_1));

while (!usbInterrup3tIsReady()) usbPoll(); //just a guess on the name here usbInterrup3tIsReady may not be the right name.
usbSendHidReport3((void *)&gamepad_report_2, sizeof(gamepad_report_2));

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:05 pm
by mega_mozg_13
ulao wrote:just a guess on the name here usbInterrup3tIsReady may not be the right name.


usbdrv.h

Code: Select all

#if USB_CFG_HAVE_INTRIN_ENDPOINT3
USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len);
#define usbInterruptIsReady3()   (usbTxLen3 & 0x10)
/* Same as above for endpoint 3 */
#endif


Code is compiling without errors.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:22 pm
by ulao
I'm confused by "Code is compiling without errors." do you mean the suggestion fixed the issue, or just that it compiles and you still have the endless loop?

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:30 pm
by mega_mozg_13
ulao wrote:I'm confused by "Code is compiling without errors." do you mean the suggestion fixed the issue, or just that it compiles and you still have the endless loop?

Nothing fixed. Code is compiling without errors. Firmware is uploaded to device, but program is freeze.
But, if I hide
//usbSendHidReport3((void *)&gamepad_report_2, sizeof(gamepad_report_2));

prorgam not freeze.

here "USBLyser Report" http://mmjoy.googlecode.com/svn/wiki/trash/V_USB_EP81_EP82_Report.rar

here another product working with two endpoints http://mmjoy.googlecode.com/svn/wiki/trash/USB_Discriptors_kreml.html
but it is not v-usb, and it is have two interface "0" and "1".

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:36 pm
by ulao
You didnt set the 3rd enpoint in config?

#define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
/* Define this to 1 if you want to compile a version with three endpoints: The
* default control endpoint 0, an interrupt-in endpoint 3 (or the number
* configured below) and a catch-all default interrupt-in endpoint as above.
* You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
*/

also where is your usbDescriptorConfiguration I didnt see that in the main.c?

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:42 pm
by mega_mozg_13
Rar File "V_USB_EP81_EP82.rar" usbconfig.h

Code: Select all

#define USB_CFG_HAVE_INTRIN_ENDPOINT3   1
/* Define this to 1 if you want to compile a version with three endpoints: The
 * default control endpoint 0, an interrupt-in endpoint 3 (or the number
 * configured below) and a catch-all default interrupt-in endpoint as above.
 * You must also define USB_CFG_HAVE_INTRIN_ENDPOINT to 1 for this feature.
 */
#define USB_CFG_EP3_NUMBER              2
/* If the so-called endpoint 3 is used, it can now be configured to any other
 * endpoint number (except 0) with this macro. Default if undefined is 3.
 */


also where is your usbDescriptorConfiguration I didnt see that in the main.c?

I'm never used this function...
It is built in "usbdrv.c"

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:43 pm
by ulao
Ok well I downloaded you files and you didnt have the set to 1? Update your zip file so we can help you better.

btw: you dont see to use ENDPOINT3 to do this? All you need to do is change the report id in your out going packets. Is there a reason you are trying to do this on its own pipe? Speed maybe?

I'm never used this function...
If your going to do something like adding a pipe you need to define it in the config.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:50 pm
by mega_mozg_13
ulao wrote: Is there a reason you are trying to do this on its own pipe? Speed maybe?

Yes. I want more reports per second, with legal tricks.

ulao wrote: If your going to do something like adding a pipe you need to define it in the config.

config is made by "v-usb" engine. you can see my "USBLyser report".

I think, two devices must be on two interfaces and have each endpoint.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Tue Jun 25, 2013 4:53 pm
by ulao
ok well this is how I would do it but yes you would loose 8 ms here.
EDIT : ( ok I see you are doing this here gamepad_report_1.report_id=1; ) then see comment below.

Code: Select all

usbSendHidReport((void *)&gamepad_report_1, sizeof(gamepad_report_1), 1);
usbSendHidReport((void *)&gamepad_report_1, sizeof(gamepad_report_1), 2);

void usbSendHidReport(uchar * data, uchar len, reportID)
{
   while(1)
   {   DBG1(0x03, 0, 0);   /* debug output: interrupt report prepared */
      usbPoll();
      if (usbInterruptIsReady())
      {
         DBG1(0x04, 0, 0);   /* debug output: interrupt report prepared */
         data[0] = rereportID;//what report to write to
         usbSetInterrupt(data, len);
         break;
      }
   }
}


now if you want to use another in end pipe you need to define it? I have never left the config open like that so maybe you know more then I but this is how most of us set the config up.

Code: Select all

char usbDescriptorConfiguration[] = { 0 }; // dummy


uchar my_usbDescriptorConfiguration[] = {    /* USB configuration descriptor */
     9,          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
    USBDESCR_CONFIG,    /* descriptor type */
    18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 /** USB_CFG_HAVE_INTRIN_ENDPOINT3 + 7*/ + 9, 0,
                /* total length of data returned (including inlined descriptors) */
    1,          /* number of interfaces in this configuration */
    1,          /* index of this configuration */
    0,          /* configuration name string index */
    USB_CFG_IS_SELF_POWERED,  /* attributes */

    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */
/* interface descriptor follows inline: */
    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE, /* descriptor type */
    0,          /* index of this interface */
    0,          /* alternate setting for this interface */
    1 + USB_CFG_HAVE_INTRIN_ENDPOINT /*+ USB_CFG_HAVE_INTRIN_ENDPOINT3*/,   /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,
    USB_CFG_INTERFACE_SUBCLASS,
    USB_CFG_INTERFACE_PROTOCOL,
    0,          /* string index for interface */


    9,          /* sizeof(usbDescrHID): length of descriptor in bytes */
    USBDESCR_HID,   /* descriptor type: HID */
    0x10, 0x01, /* BCD representation of HID version */
    0x00,       /* target country code */
    0x01,       /* number of HID Report (or other HID class) Descriptor infos to follow */
    0x22,       /* descriptor type: report */
    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,  /* total length of report descriptor *///
//#endif


#if USB_CFG_HAVE_INTRIN_ENDPOINT    /* endpoint descriptor for endpoint 1 */
    7,          /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    //0x81,       /* IN endpoint number 1 */
   0x81,       // bulk IN endpoint number 1
    0x03,       /* attrib: Interrupt endpoint */
    8, 0,       /* maximum packet size */
    0x04, /* in ms */

//the output.

    7,          // sizeof(usbDescrEndpoint)
    5,  // descriptor type = endpoint
    0x02,      // out endpoint number 2
    0x03,       // attrib: Interrupt endpoint
    8, 0,       // maximum packet size
    USB_CFG_INTR_POLL_INTERVAL, // in ms

#endif

now that does not include a 3rd pipe but maybe it will show you how to properly configure it. Outside of that your doing it in a way I can not help you, In your pic above I only see the default 80 and one end point 81 not the 3rd.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Wed Jun 26, 2013 8:29 am
by mega_mozg_13
ulao
maybe you mistake.
I have two virtual devices "Virtual_Joystick#1" and "Virtual_Joystick#2"

each virtual joystick have report:
"Virtual_Joystick#1"
report buffer gamepad_report_1

Code: Select all

gamepad_report_1.report_id=1;

HID 0x85, 0x01, // REPORT_ID (1)

"Virtual_Joystick#2"
report buffer gamepad_report_2
HID 0x85, 0x02, // REPORT_ID (2)

Code: Select all

gamepad_report_2.report_id=2;

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Wed Jun 26, 2013 1:28 pm
by ulao
no I get that, didnt you see my "edit" note in bold?

let us go back to the need of the 3rd pipe here? You said "Yes. I want more reports per second, with legal tricks." Can you try to explain that in more detail. Also what OS are you targeting here. Because I too would like to be faster then 8ms but I can not find a way to do that myself. Does your project work without using the usbSetInterrupt3()and just send them both on usbSetInterrupt()?

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Wed Jun 26, 2013 1:42 pm
by mega_mozg_13
ulao wrote:let us go back to the need of the 3rd pipe here? You said "Yes. I want more reports per second, with legal tricks." Can you try to explain that in more detail.

If I'm use standart 8 ms poll, and one endpoint - I'm have total 120 packets per second (report 1, report 2, report 1, report 2...)
60 packets "report 1" and 60 packets "report 2".
I want open two pipes and send pipe 1 = 120 packets "report 1" and pipe 2 = 120 packets "report 2".

ulao wrote:Also what OS are you targeting here. Because I too would like to be faster then 8ms but I can not find a way to do that myself.

Windows. Also I know hack solutions like "500Hz mouse usb", but I want legal solution without hack tricks.

ulao wrote:Does your project work without using the usbSetInterrupt3()and just send them both on usbSetInterrupt()?

Yes. Project working - one pipe send total 120 packets per second (report 1, report 2, report 1, report 2...)

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Wed Jun 26, 2013 3:41 pm
by ulao
Ok its clear to me what you want now but I still can not see how you can do that without defining your pipes in the usb Descriptor Config. Your screen shots above only shows the default and another end in point not 3. So either a) configure it like I showed you or b) prove to me with your usb sniffing/analyzing software that 3 endpoints are there. Remember usbSetInterrupt3() is for the 3rd, (default + 1 in + 2 in).

Again for me its easier to control everything myself so maybe I'm not following here but you should have
pipe0 default
pipe1 81
pipe2 82

not

pipe0 81
pipe1 82

can you show the device config from the analyzer software.

Re: Endless loop. usbInterruptIsReady3() usbSetInterrupt3()

Posted: Wed Jun 26, 2013 3:58 pm
by mega_mozg_13
ulao wrote:Remember usbSetInterrupt3() is for the 3rd, (default + 1 in + 2 in)

1st - Endpoint is default builtin "endpoint 0"
2nd - Endpoint 81
3rd - Endpoint 82

Try One interface

Code: Select all

//Массив Дискриптор USB Configuration
static char dynamical_usbDescriptorConfiguration[] = {

/*9 USB configuration descriptor */
    9,                                    //баит 0          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
    USBDESCR_CONFIG,                        //баит 1    /* descriptor type */
    9 + (9 + 9 + 7 + 7),
    0,
    1,                                    //баит4    /* number of interfaces in this configuration */
    1,                                    //баит5          /* index of this configuration */
    0,                                    //баит6          /* configuration name string index */
    USBATTR_BUSPOWER,   /* attributes */         //баит7
    USB_CFG_MAX_BUS_POWER/2,                     //баит8      /* max USB current in 2mA units */
   
/*9 interface 0 descriptor follows inline: */
    9,                                    //байт9          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE,                      //байт10/* descriptor type */
    0,                                    //байт11          /* index of this interface */
    0,                                    //байт12          /* alternate setting for this interface */
    2,                                      //байт13 /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,                  //байт14
    USB_CFG_INTERFACE_SUBCLASS,                  //байт15
    USB_CFG_INTERFACE_PROTOCOL,                  //байт16   
    0,                                    //байт17          /* string index for interface */
   
/*9 interface 0 HID descriptor */
    9,                                    //байт18    /* sizeof(usbDescrHID): length of descriptor in bytes */
    USBDESCR_HID,                           //байт19   /* descriptor type: HID */
    0x01, 0x01,                            //байт20,21   /* BCD representation of HID version */
    0x00,                                  //байт22   /* target country code */
    0x01,                                 //байт23   /* number of HID Report (or other HID class) Descriptor infos to follow */
    0x22,                                  //байт24   /* descriptor type: report */
    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,        //байт25,26   /* total length of report descriptor */


/*7 interface 0 endpoint descriptor for endpoint 81 */
    7,                                     //байт27   /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,                       //байт28   /* descriptor type = endpoint */
    0x81,                                  //байт29   /* IN endpoint number 81 */
    0x03,                                  //байт30   /* attrib: Interrupt endpoint */
    8, 0,                                  //байт31,32   /* maximum packet size */
    10,                                  //байт33   /* in ms */
   
/*7 interface 0 endpoint descriptor for endpoint 82 */
    7,                                     //байт27   /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,                       //байт28   /* descriptor type = endpoint */
    0x82,                                  //байт29   /* IN endpoint number 81 */
    0x03,                                  //байт30   /* attrib: Interrupt endpoint */
    8, 0,                                  //байт31,32   /* maximum packet size */
    10,                                  //байт33   /* in ms */
   
   
};

USBlyzer log http://mmjoy.googlecode.com/svn/wiki/trash/V_USB_EP81_EP82_interface1.ulz


I make "my usbDescriptorConfiguration" and try setup Two Interfaces:

Code: Select all

//Массив Дискриптор USB Configuration
static char dynamical_usbDescriptorConfiguration[] = {

/*9 USB configuration descriptor */
    9,                                    //баит 0          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
    USBDESCR_CONFIG,                        //баит 1    /* descriptor type */
    9 + (9 + 9 + 7) + (9 + 9 + 7) ,
    0,
    2,                                    //баит4    /* number of interfaces in this configuration */
    1,                                    //баит5          /* index of this configuration */
    0,                                    //баит6          /* configuration name string index */
    USBATTR_BUSPOWER,   /* attributes */         //баит7
    USB_CFG_MAX_BUS_POWER/2,                     //баит8      /* max USB current in 2mA units */
   
/*9 interface 0 descriptor follows inline: */
    9,                                    //байт9          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE,                      //байт10/* descriptor type */
    0,                                    //байт11          /* index of this interface */
    0,                                    //байт12          /* alternate setting for this interface */
    USB_CFG_HAVE_INTRIN_ENDPOINT,                 //байт13 /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,                  //байт14
    USB_CFG_INTERFACE_SUBCLASS,                  //байт15
    USB_CFG_INTERFACE_PROTOCOL,                  //байт16   
    0,                                    //байт17          /* string index for interface */
   
/*9 interface 0 HID descriptor */
    9,                                    //байт18    /* sizeof(usbDescrHID): length of descriptor in bytes */
    USBDESCR_HID,                           //байт19   /* descriptor type: HID */
    0x01, 0x01,                            //байт20,21   /* BCD representation of HID version */
    0x00,                                  //байт22   /* target country code */
    0x01,                                 //байт23   /* number of HID Report (or other HID class) Descriptor infos to follow */
    0x22,                                  //байт24   /* descriptor type: report */
    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,        //байт25,26   /* total length of report descriptor */


/*7 interface 0 endpoint descriptor for endpoint 81 */
    7,                                     //байт27   /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,                       //байт28   /* descriptor type = endpoint */
    0x81,                                  //байт29   /* IN endpoint number 81 */
    0x03,                                  //байт30   /* attrib: Interrupt endpoint */
    8, 0,                                  //байт31,32   /* maximum packet size */
    10,                                  //байт33   /* in ms */
   
/*9 interface 1 descriptor follows inline: */
    9,                                    //байт34          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE,                      //байт35/* descriptor type */
    1,                                    //байт36          /* index of this interface */
    0,                                    //байт37          /* alternate setting for this interface */
    USB_CFG_HAVE_INTRIN_ENDPOINT3,                //байт38 /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,                  //байт39
    USB_CFG_INTERFACE_SUBCLASS,                  //байт40
    USB_CFG_INTERFACE_PROTOCOL,                  //байт41   
    0,                                    //байт42          /* string index for interface */
   
/*9 interface 1 HID descriptor */
    9,                                    //байт43    /* sizeof(usbDescrHID): length of descriptor in bytes */
    USBDESCR_HID,                           //байт44   /* descriptor type: HID */
    0x01, 0x01,                            //байт45,46   /* BCD representation of HID version */
    0x00,                                  //байт47   /* target country code */
    0x01,                                 //байт48   /* number of HID Report (or other HID class) Descriptor infos to follow */
    0x22,                                  //байт49   /* descriptor type: report */
    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,        //байт50,51   /* total length of report descriptor */


/*7 interface 1 endpoint descriptor for endpoint 82 */
    7,                                     //байт52   /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,                       //байт53   /* descriptor type = endpoint */
    0x82,                                  //байт54   /* IN endpoint number 82 */
    0x03,                                  //байт55   /* attrib: Interrupt endpoint */
    8, 0,                                  //байт56,57   /* maximum packet size */
    10,                                  //байт58   /* in ms */
   
   
};


and make usbFunctionDescriptor

Code: Select all

//Функция Обработчик ответов дискрипторов
usbMsgLen_t   usbFunctionDescriptor(struct usbRequest *rq)
{
   if ((rq->bmRequestType & USBRQ_TYPE_MASK) != USBRQ_TYPE_STANDARD) return 0;

   if (rq->bRequest == USBRQ_GET_DESCRIPTOR)
   {
      switch (rq->wValue.bytes[1])
      {
        case USBDESCR_HID_REPORT: { usbMsgPtr = (uchar *)config.usb_disc_hid_rep;                return ( config.usb_disc_hid_len );}
        case USBDESCR_DEVICE:     { usbMsgPtr = (uchar *)dynamical_usbDescriptorDevice;             return ( sizeof(dynamical_usbDescriptorDevice) );}         
        case USBDESCR_CONFIG:     { usbMsgPtr = (uchar *)dynamical_usbDescriptorConfiguration;      return ( sizeof(dynamical_usbDescriptorConfiguration));}         
          case USBDESCR_HID :      { usbMsgPtr = (uchar *)dynamical_usbDescriptorConfiguration + 18 ;   return (9);}                  
          case USBDESCR_STRING:    { if (rq->wValue.bytes[0]==2) { usbMsgPtr = (uchar *)usbDescriptorStringDevice; return (22);}} 
      };
   };
   return 0;
}

But windows still cannot setup device.
Screen Image
USBlyzer log http://mmjoy.googlecode.com/svn/wiki/trash/V_USB_EP81_EP82_interface2.ulz