HID USB Multimedia Keypad


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Posts
    14

    Default HID USB Multimedia Keypad

    Hi, I am trying to make a simple multimedia keypad (Next, Previous, Play, Stop, Eject, Volume Up, Volume Down) and can't seem to get it to work. I started with the example HID Keyboard and it worked fine so I modified the USB Descriptor for the Consumer Device which supports the correct buttons but can't get it to work. Either I am sending the data from the PIC to the PC incorrectly or something is wrong in the USB Descriptor.

    I have included my PBP code, hopefully someone out there might have a better understanding of how it would work.

    Any help would be greatly appreciated, Thanks.
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2011
    Posts
    14

    Default Re: HID USB Multimedia Keypad

    Well looks like nobody had any luck figuring this out but thats ok. It was a simple problem in the HID Descriptor I missed but its fixed now.

    Only problem I am having now it the keys keep repeating but that should be an easy fix

  3. #3
    Join Date
    Feb 2011
    Posts
    14

    Default Re: HID USB Multimedia Keypad

    Ok now that that is worked out its time to move on to next stage, adding a standard HID or CDC interface to access the PIC from a PC/Mac.

    Is it possible to combine a second interface to the same device?

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default Re: HID USB Multimedia Keypad

    I would say yes, but how to... hell I don't know.

    What I would suggest, is to develop a pure HID device, from there you develop a Driver. This driver (or standalone application) will take care of sending the keystrokes and perform other tasks.

    MIDI devices use 2 Generic Classes, MIDI Device and Audio Composite, but it is still considered as a single device...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Feb 2011
    Posts
    14

    Default Re: HID USB Multimedia Keypad

    Sounds good but I need this to be universal meaning must work with Mac and Linux as well as PC. Standalone app with custom driver would not work in this case.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: HID USB Multimedia Keypad

    Standalone app with custom driver would not work in this case.
    Depends on what you write it in...
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Sep 2015
    Posts
    4

    Default Re: HID USB Multimedia Keypad

    hi guys i know this thread is a little bit old but im sure you can help me...
    when i try to compile the hid usb keypad it doesnt compile (too many errors) im using pbp 2.60 and microcode studio, but, i have used another device and string descriptor with peter's report descriptor and it compiles but when i put something on the buffer no mater if buffer is a byte variable array or not the pc show 4 key pressed at the same time, i think that the problem is that the descriptor sends the data but the endpoint or the hid descriptor is handling it in a different way not acording with the report descriptor...
    thanks a lot for your help!!!

  8. #8
    Join Date
    Sep 2015
    Posts
    4

    Default Re: HID USB Multimedia Keypad

    update: it compiles now. the pbp folder had some missing files...

    but when i plug in the device windows say "the device can't start"

    as far as i know it could be a descriptor problem right?

    thanks

  9. #9
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default Re: HID USB Multimedia Keypad

    Sorry I have been away working on other projects. Are you compiling the original source or your modified one?

  10. #10
    Join Date
    Sep 2015
    Posts
    4

    Default Re: HID USB Multimedia Keypad

    i have downloaded the las HID USB Multimedia Keypad.zip attachment and now it compiles. but still the pc doesnt recognizes the device...

    i´ve changed the original reportdescriptor1, to the \usb18 folder mouse in a circle example keeping all the keypad original code and the pc recognizes the hid mouse, of course it moves the mouse pointer weird because the main program code is made for another reportdescriptor.
    that makes me doubt about the original reportdescriptor.


    ReportDescriptor1
    retlw 0x05
    retlw 0x01 ;usage page (generic desktop)
    retlw 0x09
    retlw 0x02 ;usage (mouse)
    retlw 0xA1
    retlw 0x01 ;collection (application)
    retlw 0x09
    retlw 0x01 ;usage (pointer)
    retlw 0xA1
    retlw 0x00 ;collection (linked)
    retlw 0x05
    retlw 0x09 ;usage page (buttons)
    retlw 0x19
    retlw 0x01 ;usage minimum (1)
    retlw 0x29
    retlw 0x03 ;usage maximum (3)
    retlw 0x15
    retlw 0x00 ;logical minimum (0)
    retlw 0x25
    retlw 0x01 ;logical maximum (1)
    retlw 0x95
    retlw 0x03 ;report count (3)
    retlw 0x75
    retlw 0x01 ;report size (1)
    retlw 0x81
    retlw 0x02 ;input (3 button bits)
    retlw 0x95
    retlw 0x01 ;report count (1)
    retlw 0x75
    retlw 0x05 ;report size (5)
    retlw 0x81
    retlw 0x01 ;input (constant 5 bit padding)
    retlw 0x05
    retlw 0x01 ;usage page (generic desktop)
    retlw 0x09
    retlw 0x30 ;usage (X)
    retlw 0x09
    retlw 0x31 ;usage (Y)
    retlw 0x15
    retlw 0x81 ;logical minimum (-127)
    retlw 0x25
    retlw 0x7F ;logical maximum (127)
    retlw 0x75
    retlw 0x08 ;report size (8)
    retlw 0x95
    retlw 0x02 ;report count (2)
    retlw 0x81
    retlw 0x06 ;input (2 position bytes X & Y)
    retlw 0xC0 ;end collection
    retlw 0xC0 ;end collection
    EndReportDescriptor1

  11. #11
    Join Date
    Jan 2006
    Location
    Toronto
    Posts
    109

    Default Re: HID USB Multimedia Keypad

    If you have doubts about it did you at least test the original code as is to verify?

  12. #12
    Join Date
    Sep 2015
    Posts
    4

    Default Re: HID USB Multimedia Keypad

    yes i did... i compiled the whole original project and tested it in a 18f2550 and didn't work...

    after testing many different configs and even not too logical things i found the problem...

    i managed to use a different report descriptor and the rest from the circle in a mouse descriptor example.
    now the pc recognizes the device but when i put in the buffer anything it sends many keys at the same time, that's because i had the endopint buffer size set to 1 byte so it only sends the first byte of data and discard the rest...

    #define USB_POLLING
    #define HID_INTF_ID 0x00
    #define HID_EP 1
    #define HID_INT_OUT_EP_SIZE 3 ; 1
    #define HID_INT_IN_EP_SIZE 3 ; 1
    #define HID_NUM_OF_DSC 1

    now that i have changed the HID_INT_IN_EP_SIZE from 1 to 3 it let me to put on the buffer a variable array and send for example

    variable[0]=%00000000
    variable[1]=%00000001

    the usb raw data will llok like this

    00 01

    thanks for your help!!!

  13. #13
    Join Date
    Feb 2013
    Posts
    1,078

    Default Re: HID USB Multimedia Keypad

    So will this work in PBP3?
    I want to have such a keypad, and ashamed to have to use Arduino Pro Micro

  14. #14
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default Re: HID USB Multimedia Keypad

    Give it a try and report your results. I use HIDMaker for USB stuff. The last time I had to create a USB project (this time using XC8), nothing compiled. I got numerous errors. I tried generating the code for PBP, XC8, even ASM... Dr. Bob worked with me, and it appears the newer MPLABX versions generated curious errors. I had to use an older MPLABX v1.45 to get it working (MPLABX is currently at version 5.45). You may find issues that require you to link PBP to an older version of MPLABX.
    Last edited by mpgmike; - 18th April 2021 at 16:01. Reason: Added clarification

  15. #15
    Join Date
    Feb 2013
    Posts
    1,078

    Default Re: HID USB Multimedia Keypad

    Thanks, will try all this this weekend....

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts