• AVR Freaks

Hid keyboard + feature report

Author
hypo
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2007/01/01 16:46:35
  • Location: 0
  • Status: offline
2007/01/01 17:00:21 (permalink)
0

Hid keyboard + feature report

hello
 
 
i'm trying to build a hid keyboard
 
i started with the standard HID keyboard descriptor and everything works fine
now i'd like to add a feature report for sending configuration parameters to the microcontroller, but everytime i try to add it to the descriptor, my device is not identified by windows
 
here's my last test (with some inspiration from this post)
 
 
char ReportDescriptor[83] = {
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x06,                    // USAGE (Keyboard)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x85, 0x01,                    //   REPORT_ID (1)
    0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
    0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
    0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
    0x75, 0x01,                    //   REPORT_SIZE (1)
    0x95, 0x08,                    //   REPORT_COUNT (8)
    0x81, 0x02,                    //   INPUT (Data,Var,Abs)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0x75, 0x08,                    //   REPORT_SIZE (8)
    0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
    0x95, 0x05,                    //   REPORT_COUNT (5)
    0x75, 0x01,                    //   REPORT_SIZE (1)
    0x05, 0x08,                    //   USAGE_PAGE (LEDs)
    0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
    0x29, 0x05,                    //   USAGE_MAXIMUM (Kana)
    0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0x75, 0x03,                    //   REPORT_SIZE (3)
    0x91, 0x01,                    //   OUTPUT (Cnst,Ary,Abs)
    0x95, 0x06,                    //   REPORT_COUNT (6)
    0x75, 0x08,                    //   REPORT_SIZE (8)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
    0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
    0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
    0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
    0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
    0xc0,                          // END_COLLECTION
    0xa1, 0x01,                    // COLLECTION (Application)
    0x85, 0x02,                    //   REPORT_ID (2)
    0x09, 0x01,                    //   USAGE (Vendor Usage 1)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
    0x75, 0x08,                    //   REPORT_SIZE (8)
    0x95, 0x01,                    //   REPORT_COUNT (1)
    0xb1, 0x02,                    //   FEATURE (Data,Var,Abs)
    0xc0                           // END_COLLECTION
};

#1

5 Replies Related Threads

    lbodnar
    Super Member
    • Total Posts : 1148
    • Reward points : 0
    • Joined: 2005/12/18 06:06:09
    • Location: UK
    • Status: offline
    RE: Hid keyboard + feature report 2007/01/02 02:04:48 (permalink)
    0
    You're still on keyboard's usage page in report 2.

    Leo
    #2
    hypo
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2007/01/01 16:46:35
    • Location: 0
    • Status: offline
    RE: Hid keyboard + feature report 2007/01/03 15:24:45 (permalink)
    0
    after several attempts, i think this is the least bad solution, but the problem is still there
     
    const byte ReportDescriptor[] = {
       0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
       0x09, 0x06,                    // USAGE (Keyboard)
       0xa1, 0x01,                    // COLLECTION (Application)
       0x85, 0x01,                    //   REPORT_ID (1)
       0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
       0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
       0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
       0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
       0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
       0x75, 0x01,                    //   REPORT_SIZE (1)
       0x95, 0x08,                    //   REPORT_COUNT (8)
       0x81, 0x02,                    //   INPUT (Data,Var,Abs)
       0x95, 0x01,                    //   REPORT_COUNT (1)
       0x75, 0x08,                    //   REPORT_SIZE (8)
       0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
       0x95, 0x05,                    //   REPORT_COUNT (5)
       0x75, 0x01,                    //   REPORT_SIZE (1)
       0x05, 0x08,                    //   USAGE_PAGE (LEDs)
       0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
       0x29, 0x05,                    //   USAGE_MAXIMUM (Kana)
       0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
       0x95, 0x01,                    //   REPORT_COUNT (1)
       0x75, 0x03,                    //   REPORT_SIZE (3)
       0x91, 0x01,                    //   OUTPUT (Cnst,Ary,Abs)
       0x95, 0x06,                    //   REPORT_COUNT (6)
       0x75, 0x08,                    //   REPORT_SIZE (8)
       0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
       0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
       0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
       0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
       0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
       0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
       0xc0,                          // END_COLLECTION
       0x06, 0x00, 0xff,        // USAGE_PAGE (Vendor Defined Page 1)
       0xa1, 0x01,                    // COLLECTION (Application)
       0x85, 0x02,                    //   REPORT_ID (2)
       0x09, 0x01,                    //   USAGE (Vendor Usage 1)
       0x75, 0x08,                    //   REPORT_SIZE (8)
       0x95, 0x08,                    //   REPORT_COUNT (8)
       0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
       0x25, 0x7f,                    //   LOGICAL_MAXIMUM (127)
       0xb1, 0x02,                    //   FEATURE (Data,Var,Abs)
       0xc0                           // END_COLLECTION
    };

     
    as i understood, i must add the Usage_page, Usage and Report_ID elements if i want to add a feature report (please correct me if i am mistaken), and each report must have a different ID
     
    what did i miss?
    #3
    lbodnar
    Super Member
    • Total Posts : 1148
    • Reward points : 0
    • Joined: 2005/12/18 06:06:09
    • Location: UK
    • Status: offline
    RE: Hid keyboard + feature report 2007/01/04 04:17:09 (permalink)
    0

    as i understood, i must add the Usage_page, Usage and Report_ID elements if i want to add a feature report (please correct me if i am mistaken), and each report must have a different ID
    You don't need to specify new usage page unless you use a usage from a different page that you did (you were on keyboard's but put in vendor usage)

    You also don't have to use report IDs in this case as the reports are of different types (input and feature.)

    Did you run the descriptor past USB command verifier?

    Leo
    #4
    hypo
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2007/01/01 16:46:35
    • Location: 0
    • Status: offline
    RE: Hid keyboard + feature report 2007/01/04 12:21:37 (permalink)
    0
    the USB command verifier doesn't work on my computer
     
    the only devices detected are my onboard wifi card and its integrated hub
    #5
    hypo
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2007/01/01 16:46:35
    • Location: 0
    • Status: offline
    RE: Hid keyboard + feature report 2007/01/04 15:30:23 (permalink)
    0
    mmm, guess i've been searching too much [&:]
     
    I restarted my project from the basic keyboard code and added just the feature report, the device was enumerated without problem.
    Seems that one of the modifications I made to the main code was crashing the microcontroller [:o]
     
    thanks for the help
     
     
    const byte ReportDesc[]=
        {         
        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
        0x09, 0x06,                    // USAGE (Keyboard)
        0xa1, 0x01,                    // COLLECTION (Application)
        0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
        0x19, 0xe0,                    //   USAGE_MINIMUM (Keyboard LeftControl)
        0x29, 0xe7,                    //   USAGE_MAXIMUM (Keyboard Right GUI)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
        0x75, 0x01,                    //   REPORT_SIZE (1)
        0x95, 0x08,                    //   REPORT_COUNT (8)
        0x81, 0x02,                    //   INPUT (Data,Var,Abs)
        0x95, 0x01,                    //   REPORT_COUNT (1)
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
        0x95, 0x05,                    //   REPORT_COUNT (5)
        0x75, 0x01,                    //   REPORT_SIZE (1)
        0x05, 0x08,                    //   USAGE_PAGE (LEDs)
        0x19, 0x01,                    //   USAGE_MINIMUM (Num Lock)
        0x29, 0x05,                    //   USAGE_MAXIMUM (Kana)
        0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)
        0x95, 0x01,                    //   REPORT_COUNT (1)
        0x75, 0x03,                    //   REPORT_SIZE (3)
        0x91, 0x01,                    //   OUTPUT (Cnst,Ary,Abs)
        0x95, 0x06,                    //   REPORT_COUNT (6)
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x25, 0x65,                    //   LOGICAL_MAXIMUM (101)
        0x05, 0x07,                    //   USAGE_PAGE (Keyboard)
        0x19, 0x00,                    //   USAGE_MINIMUM (Reserved (no event indicated))
        0x29, 0x65,                    //   USAGE_MAXIMUM (Keyboard Application)
        0x81, 0x00,                    //   INPUT (Data,Ary,Abs)
        0x09, 0x00,                    //   USAGE (Reserved (no event indicated))
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x95, 0x01,                    //   REPORT_COUNT (1)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x25, 0x7f,                    //   LOGICAL_MAXIMUM (127)
        0xb1, 0x02,                    //   FEATURE (Data,Var,Abs)
        0xc0                           // END_COLLECTION
        };

     
     
    tested with Jan's HID Tester
    #6
    Jump to:
    © 2019 APG vNext Commercial Version 4.5