diff -r teensy.original/avr/boards.txt teensy/avr/boards.txt
429a430,432
> teensy36.menu.usb.mpa=MPA
> teensy36.menu.usb.mpa.build.usbtype=USB_MPA
> teensy36.menu.usb.mpa.fake_serial=teensy_gateway
diff -r teensy.original/avr/cores/teensy3/WProgram.h teensy/avr/cores/teensy3/WProgram.h
66a67,68
> #include "usb_mpa.h"
>
diff -r teensy.original/avr/cores/teensy3/usb_desc.c teensy/avr/cores/teensy3/usb_desc.c
70a71,73
> #ifdef BCD_USB
> LSB(BCD_USB), MSB(BCD_USB),
> #else
71a75
> #endif
112c116
< 3, // iSerialNumber
---
> 0, // iSerialNumber
352a357,426
> #ifdef MPA_INTERFACE
> static uint8_t mpa_report_desc[] = {
> 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
> 0x09, 0x05, // Usage (Game Pad)
> 0xA1, 0x01, // Collection (Application)
> 0x15, 0x00, // Logical Minimum (0)
> 0x25, 0x01, // Logical Maximum (1)
> 0x35, 0x00, // Physical Minimum (0)
> 0x45, 0x01, // Physical Maximum (1)
> 0x75, 0x01, // Report Size (1)
> 0x95, 0x0D, // Report Count (13)
> 0x05, 0x09, // Usage Page (Button)
> 0x19, 0x01, // Usage Minimum (0x01)
> 0x29, 0x0D, // Usage Maximum (0x0D)
> 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0x95, 0x03, // Report Count (3)
> 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
> 0x25, 0x07, // Logical Maximum (7)
> 0x46, 0x3B, 0x01, // Physical Maximum (315)
> 0x75, 0x04, // Report Size (4)
> 0x95, 0x01, // Report Count (1)
> 0x65, 0x14, // Unit (System: English Rotation, Length: Centimeter)
> 0x09, 0x39, // Usage (Hat switch)
> 0x81, 0x42, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
> 0x65, 0x00, // Unit (None)
> 0x95, 0x01, // Report Count (1)
> 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0x26, 0xFF, 0x00, // Logical Maximum (255)
> 0x46, 0xFF, 0x00, // Physical Maximum (255)
> 0x09, 0x30, // Usage (X)
> 0x09, 0x31, // Usage (Y)
> 0x09, 0x32, // Usage (Z)
> 0x09, 0x35, // Usage (Rz)
> 0x75, 0x08, // Report Size (8)
> 0x95, 0x04, // Report Count (4)
> 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00)
> 0x09, 0x20, // Usage (0x20)
> 0x09, 0x21, // Usage (0x21)
> 0x09, 0x22, // Usage (0x22)
> 0x09, 0x23, // Usage (0x23)
> 0x09, 0x24, // Usage (0x24)
> 0x09, 0x25, // Usage (0x25)
> 0x09, 0x26, // Usage (0x26)
> 0x09, 0x27, // Usage (0x27)
> 0x09, 0x28, // Usage (0x28)
> 0x09, 0x29, // Usage (0x29)
> 0x09, 0x2A, // Usage (0x2A)
> 0x09, 0x2B, // Usage (0x2B)
> 0x95, 0x0C, // Report Count (12)
> 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0x0A, 0x21, 0x26, // Usage (0x2621)
> 0x95, 0x08, // Report Count (8)
> 0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
> 0x0A, 0x21, 0x26, // Usage (0x2621)
> 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
> 0x26, 0xFF, 0x03, // Logical Maximum (1023)
> 0x46, 0xFF, 0x03, // Physical Maximum (1023)
> 0x09, 0x2C, // Usage (0x2C)
> 0x09, 0x2D, // Usage (0x2D)
> 0x09, 0x2E, // Usage (0x2E)
> 0x09, 0x2F, // Usage (0x2F)
> 0x75, 0x10, // Report Size (16)
> 0x95, 0x04, // Report Count (4)
> 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
> 0xC0 // End Collection
> };
> #endif // MPA_INTERFACE
>
574a649
> #ifndef MPA_INTERFACE
576c651
<
---
> #endif
593a669
> /* bryn
595a672,674
> */
> 0x80,
> 0x20,
1093a1173,1207
> #ifdef MPA_INTERFACE
> // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
> 9, // bLength
> 4, // bDescriptorType
> MPA_INTERFACE, // bInterfaceNumber
> 0, // bAlternateSetting
> 2, // bNumEndpoints
> 0x03, // bInterfaceClass (0x03 = HID)
> 0x00, // bInterfaceSubClass
> 0x00, // bInterfaceProtocol
> 0, // iInterface
> // HID interface descriptor, HID 1.11 spec, section 6.2.1
> 9, // bLength
> 0x21, // bDescriptorType
> 0x11, 0x01, // bcdHID
> 0, // bCountryCode
> 1, // bNumDescriptors
> 0x22, // bDescriptorType
> LSB(sizeof(mpa_report_desc)), // wDescriptorLength
> MSB(sizeof(mpa_report_desc)),
> // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
> 7, // bLength
> 5, // bDescriptorType
> MPA_ENDPOINT | 0x80, // bEndpointAddress
> 0x03, // bmAttributes (0x03=intr)
> MPA_MAX_SIZE, 0, // wMaxPacketSize
> MPA_INTERVAL, // bInterval
> 7, // bLength
> 5, // bDescriptorType
> 0x02, // bEndpointAddress
> 0x03, // bmAttributes (0x03=intr)
> MPA_MAX_SIZE, 0, // wMaxPacketSize
> MPA_INTERVAL, // bInterval
> #endif // MPA_INTERFACE
>
1518a1633,1636
> #endif
> #ifdef MPA_INTERFACE
> {0x2200, MPA_INTERFACE, mpa_report_desc, sizeof(mpa_report_desc)},
> {0x2100, MPA_INTERFACE, config_descriptor + MPA_DESC_OFFSET, 9},
diff -r teensy.original/avr/cores/teensy3/usb_desc.h teensy/avr/cores/teensy3/usb_desc.h
175a176,210
> #elif defined(USB_MPA)
> #define VENDOR_ID 0x12BA
> #define PRODUCT_ID 0x0218
>
> #define MANUFACTURER_NAME {'L', 'i', 'c', 'e', 'n', 's', 'e', 'd', ' ', 'b', 'y', ' ', 'S', 'o', 'n', 'y', ' ', 'C', 'o', 'm', 'p', 'u', 't', 'e', 'r', ' ', 'E', 'n', 't', 'e', 'r', 't', 'a', 'i', 'n', 'm', 'e', 'n', 't', ' ', 'A', 'm', 'e', 'r', 'i', 'c', 'a'}
> #define MANUFACTURER_NAME_LEN 47
> #define PRODUCT_NAME {'H', 'a', 'r', 'm', 'o', 'n', 'i', 'x', ' ', 'D', 'r', 'u', 'm', ' ', 'k', 'i', 't', ' ', 'f', 'o', 'r', ' ', 'P', 'l', 'a', 'y', 'S', 't', 'a', 't', 'i', 'o', 'n', 0xae, '3'}
> #define PRODUCT_NAME_LEN 35
>
> /*
> #define MANUFACTURER_NAME {'c', 'u', 'r', 'i', 'o', 'u', 's', '.', 'j', 'p', '@', 'g', 'm', 'a', 'i', 'l', '.', 'c', 'o', 'm'}
> #define MANUFACTURER_NAME_LEN 20
> #define PRODUCT_NAME {'T', 'e', 'e', 'n', 's', 'y', 'M', 'P', 'A'}
> #define PRODUCT_NAME_LEN 9
> */
>
> #define DEVICE_CLASS 0x00
> #define DEVICE_SUBCLASS 0x00
> #define DEVICE_PROTOCOL 0x00
> #define BCD_DEVICE 0x0200
> #define BCD_USB 0x0200
> #define EP0_SIZE 16
> #define NUM_ENDPOINTS 2
> #define NUM_USB_BUFFERS 30
> #define NUM_INTERFACE 1
> #define MPA_INTERFACE 0 // Midi Pro Adapter
> #define MPA_ENDPOINT 1
> #define MPA_PACK_SIZE 0x1B
> #define MPA_MAX_SIZE 0x40
> #define MPA_INTERVAL 0xA
> #define MPA_DESC_OFFSET (9)
> #define CONFIG_DESC_SIZE (9+9+9+7+7)
> #define ENDPOINT1_CONFIG ENDPOINT_TRANSMIT_ONLY
> #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_ONLY
>
177c212
< #define VENDOR_ID 0x16C0
---
> #define VENDOR_ID 0x16C0
diff -r teensy.original/avr/cores/teensy3/usb_dev.c teensy/avr/cores/teensy3/usb_dev.c
390c390,391
< #if defined(SEREMU_INTERFACE) || defined(KEYBOARD_INTERFACE)
---
> //#if defined(SEREMU_INTERFACE) || defined(KEYBOARD_INTERFACE)
> #if defined(SEREMU_INTERFACE) || defined(KEYBOARD_INTERFACE) || defined(MPA_INTERFACE)
485a487,503
>
> // 'magic bytes' per https://github.com/johnburkert/YeOldeJoystick/tree/master/ps3_gamepad
> #if defined(MPA_INTERFACE)
> if( setup.bmRequestType == 0xA1 && setup.bRequest == 0x01 ) {
> reply_buffer[0] = 0x21;
> reply_buffer[1] = 0x26;
> reply_buffer[2] = 0x01;
> reply_buffer[3] = 0x07;
> reply_buffer[4] = 0x00;
> reply_buffer[5] = 0x00;
> reply_buffer[6] = 0x00;
> reply_buffer[7] = 0x00;
> data = reply_buffer;
> datalen = 8;
> }
> #endif
>
Only in teensy/avr/cores/teensy3: usb_mpa.c
Only in teensy/avr/cores/teensy3: usb_mpa.h
diff -r teensy.original/avr/cores/teensy3/yield.cpp teensy/avr/cores/teensy3/yield.cpp
40a41
> #if !defined(USB_MPA)
41a43
> #endif
diff -r teensy.original/avr/libraries/USBHost_t36/antplus.cpp teensy/avr/libraries/USBHost_t36/antplus.cpp
45c45
< #define printf(...) Serial.printf(__VA_ARGS__); Serial.write("\r\n")
---
> #define printf(...) /* Serial.printf(__VA_ARGS__); Serial.write("\r\n") */
diff -r teensy.original/avr/libraries/USBHost_t36/joystick.cpp teensy/avr/libraries/USBHost_t36/joystick.cpp
216c216
< Serial.printf("Joystick update Rumble/LEDs");
---
> //Serial.printf("Joystick update Rumble/LEDs");
287c287
< Serial.printf("Claim Additional axis: %x %x %d\n", additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);
---
> //Serial.printf("Claim Additional axis: %x %x %d\n", additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);
355c355
< Serial.printf("UP: usage_page=%x usage=%x add: %x %x %d\n", usage_page, usage, additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);
---
> //Serial.printf("UP: usage_page=%x usage=%x add: %x %x %d\n", usage_page, usage, additional_axis_usage_page_, additional_axis_usage_start_, additional_axis_usage_count_);