• AVR Freaks

[ resolved ] hid joystick/keyboard multimedia key

Author
exor_6
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2013/03/03 03:39:26
  • Location: 0
  • Status: offline
2013/03/03 05:04:21 (permalink)
0

[ resolved ] hid joystick/keyboard multimedia key

Hello
I debuted in programming. until today I read on the help forum. but now I'm blocking!
I'm on a draft HID keyboard device joystick. function joystick works very well but the keyboard only in part.
the key from A to Z and numbers works well but not the volume + and volume -
I work with http://www.freebsddiary.org/APC/usb_hid_usages.php
the HID descriptor is :
  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, 0x08,                    //     USAGE_MAXIMUM (Button 8)
    0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
    0x95, 0x08,                    //     REPORT_COUNT (8)
    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)
    0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
    0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x02,                    //     REPORT_COUNT (2)
    0x81, 0x02,                    //     INPUT (Data,Var,Abs)
    0xc0,                          //     END_COLLECTION
    0xc0,                          // END_COLLECTION
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x06,                    // USAGE (Keyboard)
    0xa1, 0x01,                    // COLLECTION (Application)
    0xa1, 0x00,                    //   COLLECTION (Physical)
    0x85, 0x02,                    //     REPORT_ID (2)
    0x05, 0x07,                    //     USAGE_PAGE (Keyboard)
    0x19, 0x00,                    //     USAGE_MINIMUM (Keyboard a and A)
    0x29, 0xe7,                    //     USAGE_MAXIMUM (Keyboard z and Z)
    0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
    0x25, 0xff,                    //     LOGICAL_MAXIMUM (255)
    0x95, 0x01,                    //     REPORT_COUNT (1)
    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x81, 0x00,                    //     INPUT (Data,Var,Abs)
    0xc0,                          //               END_COLLECTION
    0xc0                           //               END_COLLECTION
 
 


Example data sent: joystick_data2 [0] = 2 (report ID 2)
joystick_data2 [1] = 0x29 (space)
if the data sent is supperior to 0x63 (99 decimal) they are not processed by the computer.
volume + (0x80 = 128) volume - (0x81 = 129)
do you know where is the problem for volume + and volume - ?
 
post edited by exor_6 - 2013/03/03 16:56:22
#1

2 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:hid keyboard multimedia key 2013/03/03 11:15:51 (permalink)
    +2 (1)
    volume + and volume - belong to HID consumer control device, not to keyboard.
    You'll append another TLC (Top-Level collection) for the consumer control.

    There are a couple of topics on this forum, discussed on this implementation.

    USB HID - Implement "Consumer Device" to allow Volume Up/Down Control?
    http://www.microchip.com/forums/m618147.aspx

    HID controller for media player...
    www.microchip.com/forums/m440956.aspx

    mute on consumer control
    http://www.microchip.com/forums/m493142.aspx

    Tsuneo
    #2
    exor_6
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2013/03/03 03:39:26
    • Location: 0
    • Status: offline
    Re:hid keyboard multimedia key 2013/03/03 16:54:08 (permalink)
    0
    THANX YOU SO MUTCH CHINZEI !!!!!!!
    My new HID descriptor for those interested its:
       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, 0x08,                    //     USAGE_MAXIMUM (Button 8)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
        0x95, 0x08,                    //     REPORT_COUNT (8)
        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)
        0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
        0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
        0x75, 0x08,                    //     REPORT_SIZE (8)
        0x95, 0x02,                    //     REPORT_COUNT (2)
        0x81, 0x02,                    //     INPUT (Data,Var,Abs)
        0xc0,                          //     END_COLLECTION
        0xc0,                          // END_COLLECTION
        0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
        0x09, 0x06,                    // USAGE (Keyboard)
        0xa1, 0x01,                    // COLLECTION (Application)
        0xa1, 0x00,                    //   COLLECTION (Physical)
        0x85, 0x02,                    //     REPORT_ID (2)
        0x05, 0x07,                    //     USAGE_PAGE (Keyboard)
        0x19, 0x00,                    //     USAGE_MINIMUM (Reserved (no event indicated))
        0x29, 0x58,                    //     USAGE_MAXIMUM (Keypad ENTER)
        0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //     LOGICAL_MAXIMUM (255)
        0x95, 0x01,                    //     REPORT_COUNT (1)
        0x75, 0x08,                    //     REPORT_SIZE (8)
        0x81, 0x00,                    //     INPUT (Data,Ary,Abs)
        0xc0,                          //     END_COLLECTION
        0xc0,                          // END_COLLECTION
           0x05, 0x0c,                    // USAGE_PAGE (Consumer Devices)
        0x09, 0x01,                    // USAGE (Consumer Control)
        0xa1, 0x01,                    // COLLECTION (Application)
        0x85, 0x03,                    //   REPORT_ID (3)
        0x05, 0x0c,                    //   USAGE_PAGE (Consumer Devices)
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
        0x75, 0x01,                    //   REPORT_SIZE (1)
        0x95, 0x0a,                    //   REPORT_COUNT (10)
        0x09, 0xb5,                    //   USAGE (Scan Next Track)
        0x09, 0xb6,                    //   USAGE (Scan Previous Track)
        0x09, 0xb7,                    //   USAGE (Stop)
        0x09, 0xb0,                    //   USAGE (Play)
        0x09, 0xe2,                    //   USAGE (Mute)
        0x09, 0xe9,                    //   USAGE (Volume Up)
        0x09, 0xea,                    //   USAGE (Volume Down)
        0x09, 0xe7,                    //   USAGE (Loudness)
        0x09, 0xbc,                    //   USAGE (Repeat)
        0x09, 0xe3,                    //   USAGE (Bass)
        0x81, 0x02,                    //   INPUT (Data,Var,Abs)
        0x95, 0x06,                    //   REPORT_COUNT (6)
        0x81, 0x01,                    //   INPUT (Cnst,Ary,Abs)
        0xc0                           //     END_COLLECTION

    Them i send for volume up :
     joystick_data3[0] = 3          ( id 3)
    joystick_data3[1] = 0x20     ( volume up )
    joystick_data3[2] = 0x00     ( 0 )
    joystick_data3[3] = 0x00     (0 )
     
    Thank you again for your referrals. it was two weeks I test without success. but thanks to you I did it
    thank you again
    post edited by exor_6 - 2013/03/03 17:02:57
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5