resolved - more then 8 packets fail on some computers

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
ulao
Rank 4
Rank 4
Posts: 481
Joined: Mon Aug 25, 2008 8:45 pm

resolved - more then 8 packets fail on some computers

Post by ulao » Fri Apr 16, 2010 6:43 pm

Not sure how I go about doing this but here is what I see.

On some, unfortunately I dont know what the difference is but on some computers I can not use more then an 8 packet descriptor. If I do no packets get sent. The computers that had the issues were formatted and had a new version of xp on them. Test each sp 1,2 and 3.

symptom: No packets are sent.

this desc fails

Code: Select all

const char analog_usbHidReportDescriptor[] PROGMEM = {
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x05,                    // USAGE (Gamepad)
    0xa1, 0x01,                    // COLLECTION (Application)
   
    0x09, 0x01,                    //   USAGE (Pointer)   
   0xa1, 0x00,                    //   COLLECTION (Physical)
   0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
    0x09, 0x30,                    //     USAGE (X)
    0x09, 0x31,                    //     USAGE (Y)
   
   0x09, 0x33,                  //     USAGE (Rx)
   0x09, 0x34,                  //     USAGE (Ry)

   0x09, 0x35,                  //     USAGE (Rz)   
   0x09, 0x36,                  //     USAGE (Slider)   

    0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
    0x26, 0xFF, 0x00,              //     LOGICAL_MAXIMUM (255)
    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x06,                    //     REPORT_COUNT (6)
    0x81, 0x02,                    //     INPUT (Data,Var,Abs)
   0xc0,                          //   END_COLLECTION (Physical)

    0x05, 0x09,                    //   USAGE_PAGE (Button)
    0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)
    0x29, 0x18,                    //   USAGE_MAXIMUM (Button 24)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
    0x75, 0x01,                    //   REPORT_SIZE (1)
    0x95, 0x18,                    //   REPORT_COUNT (24)
    0x81, 0x02,                    //   INPUT (Data,Var,Abs)

    0xc0
};


this one works

Code: Select all

const char analog_usbHidReportDescriptor[] PROGMEM = {
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x05,                    // USAGE (Gamepad)
    0xa1, 0x01,                    // COLLECTION (Application)
   
    0x09, 0x01,                    //   USAGE (Pointer)   
   0xa1, 0x00,                    //   COLLECTION (Physical)
   0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
    0x09, 0x30,                    //     USAGE (X)
    0x09, 0x31,                    //     USAGE (Y)
   
   0x09, 0x33,                  //     USAGE (Rx)
   0x09, 0x34,                  //     USAGE (Ry)

   0x09, 0x35,                  //     USAGE (Rz)   
   0x09, 0x36,                  //     USAGE (Slider)   

    0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
    0x26, 0xFF, 0x00,              //     LOGICAL_MAXIMUM (255)
    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x06,                    //     REPORT_COUNT (6)
    0x81, 0x02,                    //     INPUT (Data,Var,Abs)
   0xc0,                          //   END_COLLECTION (Physical)

    0x05, 0x09,                    //   USAGE_PAGE (Button)
    0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)
    0x29, 0x18,                    //   USAGE_MAXIMUM (Button 24)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
    0x75, 0x01,                    //   REPORT_SIZE (1)
    0x95, 0x10,                    //   REPORT_COUNT (16)
    0x81, 0x02,                    //   INPUT (Data,Var,Abs)

    0xc0
};
As you can see the only change were the number of buttons making it less then 8 packets.

FYI I send more then 8 via

Code: Select all

      while (!usbInterruptIsReady()) usbPoll();
      usbSetInterrupt((void *)&reportBuffer + 0, curGamepad->report_size);

      while (!usbInterruptIsReady()) usbPoll();
      usbSetInterrupt((void *)&reportBuffer + 8, curGamepad->report_size);

Will do some more testing here but I dont have a computer in front of me that has the issue at the moment.


Fix::
Had to make sure I only did the correct number of packets.

Code: Select all

      while (!usbInterruptIsReady()) usbPoll();
      usbSetInterrupt((void *)&reportBuffer + 0, curGamepad->report_size);

      while (!usbInterruptIsReady()) usbPoll();
      usbSetInterrupt((void *)&reportBuffer + 8, 1);
The odd things is on some computers its not needed. Not sure why?

Post Reply