Teensyduino Joystick minor corrections to usb.c

gwideman

Well-known member
Hi Paul,
On examining data reported to USBLyzer for Joystick, I thought a couple of minor corrections in usb_hid/usb.c descriptors were in order.

1. In joystick_hid_report_desc, make the 0..315 degrees physical range apply only to the hat.
The lines:
Code:
  0x35, 0x00,           // Physical Minimum (0)
  0x46, 0x3B, 0x01,     // Physical Maximum (315)

... apply not just to the current control, but to all subsequent ones until Physical Min/Max are set to something else. (ie: they are "global" settings).

So, I inserted later instructions to set these to zero (probably only max needs to be set to zero) to revert to physical=logical mode:
Code:
  0x05, 0x01,                 // Usage Page (Generic Desktop)
  0x09, 0x01,                 // Usage (Pointer)
	
  0x35, 0x00,                 // Physical Minimum (0)       // GW Added: To reset physical to = logical
  0x46, 0x00, 0x00,           // Physical Maximum (0)       // GW Added: To reset physical to = logical	
	
  0xA1, 0x00,                 // Collection ()              // Analog Axes

2. Report that Teensy is bus-powered
As shipped, usb.c reports that Teensy is externally ("self") powered. This probably makes little difference, but in troubleshooting it occurred to us that this could fail to prompt miserly laptops to power the USB port. So we changed this to bus-powered.
Code:
//  0xC0,      // bmAttributes  
    0x80,       // bmAttributes   // GW revised to bus-powered, not self-powered

Hope this helps,
-- Graham
 
Back
Top