Author Topic: help with a simple report design change  (Read 5216 times)

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
help with a simple report design change
« on: August 15, 2017, 10:08:54 pm »
I'm having trouble with this. I want to change the following report.

Currently the 17 and 18 allowing 128 bytes.  Or at least this is what it show allow. 18 has 131 because its 128+report id + address. I'm not %100  sure why the 17 shows 127. 129 would make more sense to me. (this was a borrowed example).


 0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x11,                    //   REPORT_ID (17)
        0x95, 0x7f,                    //   REPORT_COUNT (127) ***
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x12,                    //   REPORT_ID (18)
        0x95, 0x83,                    //   REPORT_COUNT (131) ***
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION


My goal is to allow both reports to allow 512


but everything I try fails enumeration. I'm thinking the header bytes need to change for larger amounts (i.e 0x26 to 0x27) .  I'm also not sure if I need to change my logical max. I bolded the areas I think have to change.

0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255) <---1024?
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x11,                    //   REPORT_ID (17)
        0x95, 0x7f, #x##,          //   REPORT_COUNT (127) <---513 ?
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x12,                    //   REPORT_ID (18)
        0x95, 0x83 #x##,           //   REPORT_COUNT (131)  <---515 ?
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: help with a simple report design change
« Reply #1 on: August 16, 2017, 08:54:31 am »
Report count does not include report ID or other info, just the number of bytes of report data, assuming report size = 8..

If report size = 512 (200h), the first item should be 96.

26h for logical max = 512 (200h) is correct.

See 6.2.2.7 in the HID spec.

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: help with a simple report design change
« Reply #2 on: August 16, 2017, 08:15:07 pm »
So I did this but on my report 17 I get "get descriptor" instead of "get report" ?

     //long
    0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff,                    //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x13,                    //   REPORT_ID (19)
        0x96, 0x02, 0x01,              //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x00,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x14,                    //   REPORT_ID (20)
        0x96, 0x02, 0x00,              //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION
   
    //short
    0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff,                    //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x11,                    //   REPORT_ID (17)
        0x95, 0x40,                    //   REPORT_COUNT (64)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x00,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x12,                    //   REPORT_ID (18)
        0x95, 0x40,                   //   REPORT_COUNT (64)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION


I can't imagine what I did wrong there.  Maybe my error is else where.

this is my code
device.GetFeatureReport(inputReportBuffer, 64); //64
« Last Edit: August 16, 2017, 11:44:40 pm by ulao »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: help with a simple report design change
« Reply #3 on: August 17, 2017, 08:56:49 am »
I don't know what you mean by this:

on my report 17 I get "get descriptor" instead of "get report" ?

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: help with a simple report design change
« Reply #4 on: August 17, 2017, 01:06:42 pm »
Sorry, I was sniffing the USB and this report should be a get report but I'm seeing get descriptor instead? Somehow this descriptor change has corrupt things. Previous advice about uninstalling already applied.

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: help with a simple report design change
« Reply #5 on: August 17, 2017, 08:04:02 pm »
Ok ignore that I was not seeing the real picture. I didnt know a get descriptor was being issue before get report. So I though it was sending the wrong controller type. What really is going on is, using the 17(get) report or 18(set) report < 128 is not showing up. Any thing > 128 is.

example
0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff,                    //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x11,                    //   REPORT_ID (17)
         0x96, 0x02, 0x00,               //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x00,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x12,                    //   REPORT_ID (18)
        0x96, 0x02, 0x00,              //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION

 device.GetFeatureReport(inputReportBuffer, 200); //shows up when sniffing

 device.GetFeatureReport(inputReportBuffer, 100);//does not show up.

Why, I can not figure that out? I want my report 17 to be 512 and request the size I need. I also tried to set it to 64 and request 64 but still my get report request is not showing up. It almost has to be the hid library but I find that extremely hard to believe.
« Last Edit: August 17, 2017, 09:56:05 pm by ulao »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: help with a simple report design change
« Reply #6 on: August 17, 2017, 09:54:29 pm »
If the report size is 512 bytes, you can't request < 512 bytes.

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: help with a simple report design change
« Reply #7 on: August 17, 2017, 09:58:52 pm »
 I also tried to set the descriptor  64 and request 64 so they match but still my get report request is not showing up. 

0xa1, 0x01,                    // COLLECTION (Application)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff,                    //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
   
        0x85, 0x11,                    //   REPORT_ID (17)
        0x96, 0x40                      //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x00,              //   FEATURE (Data,Var,Abs,Buf)
   
        0x85, 0x12,                    //   REPORT_ID (18)
        0x96, 0x40                    //   REPORT_COUNT (512)
        0x09, 0x00,                    //   USAGE (Undefined)
        0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
    0xc0,                           // END_COLLECTION

 device.GetFeatureReport(inputReportBuffer, 200); //shows up when sniffing

 device.GetFeatureReport(inputReportBuffer, 100);//does not show up.

and of course I tried
device.GetFeatureReport(inputReportBuffer, 64); //but anything less then 128 fails.

Though if I change the ReportID to 3 (one of my other reports) any size will work.  It gets more data then I needed, and junk data at that but at least it works. I''m so confused why this report in particulate will not allow me to send less then 128. I understand what you mean, per documentation they must match. Though even if I match it still never shows up. It's like the report does not exist.
« Last Edit: August 17, 2017, 10:06:12 pm by ulao »

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: help with a simple report design change
« Reply #8 on: August 17, 2017, 10:09:05 pm »
Never mind, moron error.  I was not flashing the right hex file.
« Last Edit: August 17, 2017, 10:19:36 pm by ulao »