Page 1 of 1

V-USB+Arduino+Consumer Devices+Me <> Work

Posted: Tue Jun 11, 2013 1:15 am
by MikeG
Help (please).

I'm trying to implement a dedicated multimedia controller (Play/Pause, Vol +/- Next/previous track) on Windows7 with little success.
I started with the Arduino Keyboard sketch (http://blog.petrockblock.com/2012/05/19/usb-keyboard-with-arduino-and-v-usb-library-an-example/ with vusb-for-arduino-005.zip. Got that to work (1/2W Zener Diodes NOT 1W, libusb).

Then changed the report descriptor to a consumer device.

Code: Select all

PROGMEM char usbHidReportDescriptor[31] = { // USB report descriptor
0×05, 0×0c,                    // USAGE_PAGE (Consumer Devices)
0×09, 0×06,                    // USAGE (Keyboard)
0xa1, 0×01,                    // COLLECTION (Application)
0×05, 0x0c,                    //   USAGE_PAGE (Consumer Devices)
0×09, 0xcd,                    //   play/pause
0×09, 0xe9,                    //   volume up
0×09, 0xea,                    //   volume down
0×09, 0xb5,                    //   next track
0×09, 0xb6,                     // previous track
0×09, 0xec,                      // mute
0×15, 0×00,                    //   LOGICAL_MINIMUM (0)
0×25, 0×01,                    //   LOGICAL_MAXIMUM (1)
0×95, 0×06,                    //   REPORT_COUNT (6)
0×75, 0×01,                    //   REPORT_SIZE (1)
0×81, 0×02,                    // INPUT (Data,Var,Abs)
0xc0
};


Changed the VID/PID, reset libusb...
Changed code in USBKeyboard.h

Code: Select all

void sendKeyStroke(byte keyStroke, byte modifiers) {
     
    while (!usbInterruptIsReady()) {
      // Note: We wait until we can send keystroke
      //       so we know the previous keystroke was
      //       sent.
    }
     
    memset(reportBuffer, 0, sizeof(reportBuffer));


    reportBuffer[0] = keyStroke;


Windows reports a USB Inout Device (with proper VID/PID). Sending 1 or 2 as a keystroke should Play/Pause and Vol. +.
Nothing happens.

Any assistance Sensi's.
I am but a grasshopper.

Mike G.