SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By frank26080115
#107612
Hi, I'm building a USB mouse using a microcontroller, I have built one with vertical scrolling before using USAGE (Wheel) but I am not sure how to replicate the horizontal scrolling and back button features that a lot of good mice has. Does anybody here have experience with USB HID report descriptors who can help me?

Can anybody who have a mouse with those features give me some USB analysis data on it? I should just need the report descriptor, VID, and PID.
By frank26080115
#107963
wow 2nd page of the forums with 22 views and no replies, i'm sad
ok i got the analysis from a logitech mouse that had horizontal scrolling

"V100 Optical Mouse for Notebooks"
Code: Select all
File: \??\USB#VID_046D&PID_C019#5&2c384161&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
Driver key name: {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0054
Device instance ID: USB\VID_046D&PID_C019\5&2C384161&0&2
Device hardware ID: USB\VID_046D&PID_C019&REV_4301
Device service: HidUsb
Device friendly name: 
Device location: Port_#0002.Hub_#0001
Device physical object name: \Device\USBPDO-5
Device descriptor
  USB: 0x0200
  Device class: 0x00
  Device subclass: 0x00
  Device protocol: 0x00
  Max packet size: 0x08 (8)
  Vendor: 0x046D (Logitech, Inc.)
  Product ID: 0xC019 (Optical Tilt Wheel Mouse)
  Device ID: 0x4301
  Manufacturer: 0x01 (Logitech)
  Product: 0x02 (USB Optical Mouse)
  Serial number ID: 0x00
  Number of configurations: 1
  Connection status: Device connected
  Current config value: 0x01
  Device bus speed: Low (USB 1.1, 1.5 Mbit/s)
  Device address: 0x01
  Open pipes:  1
    Pipe information
      Endpoint address: 0x81, Input
      Transfer type: Interrupt
      Max packet size: 0x0005 (5)
      Interval: 0x0A (10)
Configuration descriptor
  Total length: 0x0022
  Number of interfaces: 1
  Configuration value: 0x01
  Configuration ID: 0x00
  Attributes: 0xA0 (Bus powered, Remote wakeup)
  Max power: 0x32 (100 Ma)
Interface descriptor
  Interface number: 0x00
  Alternate setting: 0x00
  Num of endpoints: 1
  Interface class: 0x03 (Human Interface Device)
  Interface subclass: 0x01 (Boot Interface Subclass)
  Interface protocol: 0x02 (Mouse)
  Interface ID: 0x00
HID descriptor
  HID: 0x0111
  Country code: 0x00
  Number of descriptors: 0x01
Endpoint descriptor
  Endpoint address: 0x81, Input
  Transfer type: Interrupt
  Max packet size: 0x0005 (5)
  Interval: 0x0A (10)
the report descriptor looks like
Code: Select all
char ReportDescriptor[61] = {
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x02,                    // USAGE (Mouse)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x09, 0x01,                    //   USAGE (Pointer)
    0xa1, 0x00,                    //   COLLECTION (Physical)
    0x05, 0x09,                    //     USAGE_PAGE (Button)
    0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
    0x29, 0x03,                    //     USAGE_MAXIMUM (Button 3)
    0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
    0x95, 0x03,                    //     REPORT_COUNT (3)
    0x75, 0x01,                    //     REPORT_SIZE (1)
    0x81, 0x02,                    //     INPUT (Data,Var,Abs)
    0x95, 0x01,                    //     REPORT_COUNT (1)
    0x75, 0x05,                    //     REPORT_SIZE (5)
    0x81, 0x03,                    //     INPUT (Cnst,Var,Abs)
    0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
    0x09, 0x30,                    //     USAGE (X)
    0x09, 0x31,                    //     USAGE (Y)
    0x09, 0x38,                    //     USAGE (Wheel)
    0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
    0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x03,                    //     REPORT_COUNT (3)
    0x81, 0x06,                    //     INPUT (Data,Var,Rel)
    0x05, 0x0c,                    //     USAGE_PAGE (Consumer Devices)
    0x0a, 0x38, 0x02,              //     USAGE (Undefined)
    0x95, 0x01,                    //     REPORT_COUNT (1)
    0x81, 0x06,                    //     INPUT (Data,Var,Rel)
    0xc0,                          //   END_COLLECTION
    0xc0                           // END_COLLECTION
};
so it is using an undefined usage under the consumer devices usage page to represent the last byte containing the horizontal scroll speed (it's two buttons, and so this byte is usually 0xFF for left, or 0x00 for no scroll, or 0x01 for right)

i'm still looking for a way to get the back button to work, does anybody have a mouse with this function who can get me some USB device analysis data for it? I actually have one but it causes my computer to lock up when I try to analyze it.