Based on USBKeyboardMouse example. I added USB String Descriptor so mbed reports itself to host not only with VID & PID but also with name of manufacturer, product name, serial number, configuration number and interface name. These can be changed to matching Yours in USBhid.cpp file on lines 88 - 122.

Dependencies:   mbed

Committer:
llumpu
Date:
Thu Sep 08 15:01:33 2011 +0000
Revision:
0:f97b1f255167
Added USB String Descriptor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
llumpu 0:f97b1f255167 1 #include "usbhid.h"
llumpu 0:f97b1f255167 2
llumpu 0:f97b1f255167 3 #ifndef MBED_USBMOUSE_H
llumpu 0:f97b1f255167 4 #define MBED_USBMOUSE_H
llumpu 0:f97b1f255167 5
llumpu 0:f97b1f255167 6 /* Class: USBMouse
llumpu 0:f97b1f255167 7 * Emulate a USB Mouse HID device
llumpu 0:f97b1f255167 8 *
llumpu 0:f97b1f255167 9 * Example:
llumpu 0:f97b1f255167 10 * > #include "mbed.h"
llumpu 0:f97b1f255167 11 * > #include "USBMouse.h"
llumpu 0:f97b1f255167 12 * >
llumpu 0:f97b1f255167 13 * > USBMouse mouse;
llumpu 0:f97b1f255167 14 * >
llumpu 0:f97b1f255167 15 * > int main() {
llumpu 0:f97b1f255167 16 * > while(1) {
llumpu 0:f97b1f255167 17 * > mouse.move(10, 0);
llumpu 0:f97b1f255167 18 * > wait(2);
llumpu 0:f97b1f255167 19 * > }
llumpu 0:f97b1f255167 20 * > }
llumpu 0:f97b1f255167 21 */
llumpu 0:f97b1f255167 22 class USBMouse : private usbhid {
llumpu 0:f97b1f255167 23 public:
llumpu 0:f97b1f255167 24 /* Constructor: USBMouse
llumpu 0:f97b1f255167 25 * Create a USB Mouse using the mbed USB Device interface
llumpu 0:f97b1f255167 26 */
llumpu 0:f97b1f255167 27 USBMouse();
llumpu 0:f97b1f255167 28
llumpu 0:f97b1f255167 29 /* Function: move
llumpu 0:f97b1f255167 30 * Move the mouse
llumpu 0:f97b1f255167 31 *
llumpu 0:f97b1f255167 32 * Variables:
llumpu 0:f97b1f255167 33 * x - Distance to move in x-axis
llumpu 0:f97b1f255167 34 * y - Distance to move in y-axis
llumpu 0:f97b1f255167 35 */
llumpu 0:f97b1f255167 36 void move(int x, int y);
llumpu 0:f97b1f255167 37
llumpu 0:f97b1f255167 38 /* Function: scroll
llumpu 0:f97b1f255167 39 * Scroll the scroll wheel
llumpu 0:f97b1f255167 40 *
llumpu 0:f97b1f255167 41 * Variables:
llumpu 0:f97b1f255167 42 * z - Distance to scroll scroll wheel
llumpu 0:f97b1f255167 43 */
llumpu 0:f97b1f255167 44 void scroll(int z);
llumpu 0:f97b1f255167 45
llumpu 0:f97b1f255167 46 /* Function: buttons
llumpu 0:f97b1f255167 47 * Set the state of the buttons
llumpu 0:f97b1f255167 48 *
llumpu 0:f97b1f255167 49 * Variables:
llumpu 0:f97b1f255167 50 * left - set the left button as down (1) or up (0)
llumpu 0:f97b1f255167 51 * middle - set the middle button as down (1) or up (0)
llumpu 0:f97b1f255167 52 * right - set the right button as down (1) or up (0)
llumpu 0:f97b1f255167 53 */
llumpu 0:f97b1f255167 54 void buttons(int left, int middle, int right);
llumpu 0:f97b1f255167 55
llumpu 0:f97b1f255167 56 private:
llumpu 0:f97b1f255167 57 int _buttons;
llumpu 0:f97b1f255167 58 };
llumpu 0:f97b1f255167 59
llumpu 0:f97b1f255167 60 #endif