Browse Source

Fix USB descriptors for Windows

main
PaulStoffregen 4 years ago
parent
commit
e599c1acc7
2 changed files with 18 additions and 5 deletions
  1. +15
    -2
      teensy4/usb_desc.c
  2. +3
    -3
      teensy4/usb_desc.h

+ 15
- 2
teensy4/usb_desc.c View File

#define LSB(n) ((n) & 255) #define LSB(n) ((n) & 255)
#define MSB(n) (((n) >> 8) & 255) #define MSB(n) (((n) >> 8) & 255)


#ifdef CDC_IAD_DESCRIPTOR
#ifndef DEVICE_CLASS
#define DEVICE_CLASS 0xEF
#endif
#ifndef DEVICE_SUBCLASS
#define DEVICE_SUBCLASS 0x02
#endif
#ifndef DEVICE_PROTOCOL
#define DEVICE_PROTOCOL 0x01
#endif
#endif


// USB Device Descriptor. The USB host reads this first, to learn // USB Device Descriptor. The USB host reads this first, to learn
// what type of device is connected. // what type of device is connected.
static uint8_t device_descriptor[] = { static uint8_t device_descriptor[] = {
4, // bDescriptorType 4, // bDescriptorType
EXPERIMENTAL_INTERFACE, // bInterfaceNumber EXPERIMENTAL_INTERFACE, // bInterfaceNumber
0, // bAlternateSetting 0, // bAlternateSetting
1, // bNumEndpoints
2, // bNumEndpoints
0xFF, // bInterfaceClass (0xFF = Vendor) 0xFF, // bInterfaceClass (0xFF = Vendor)
0x6A, // bInterfaceSubClass 0x6A, // bInterfaceSubClass
0xFF, // bInterfaceProtocol 0xFF, // bInterfaceProtocol
4, // bDescriptorType 4, // bDescriptorType
EXPERIMENTAL_INTERFACE, // bInterfaceNumber EXPERIMENTAL_INTERFACE, // bInterfaceNumber
0, // bAlternateSetting 0, // bAlternateSetting
1, // bNumEndpoints
2, // bNumEndpoints
0xFF, // bInterfaceClass (0xFF = Vendor) 0xFF, // bInterfaceClass (0xFF = Vendor)
0x6A, // bInterfaceSubClass 0x6A, // bInterfaceSubClass
0xFF, // bInterfaceProtocol 0xFF, // bInterfaceProtocol

+ 3
- 3
teensy4/usb_desc.h View File

#if defined(USB_SERIAL) #if defined(USB_SERIAL)
#define VENDOR_ID 0x16C0 #define VENDOR_ID 0x16C0
#define PRODUCT_ID 0x0483 #define PRODUCT_ID 0x0483
#define DEVICE_CLASS 2 // 2 = Communication Class
#define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'} #define MANUFACTURER_NAME {'T','e','e','n','s','y','d','u','i','n','o'}
#define MANUFACTURER_NAME_LEN 11 #define MANUFACTURER_NAME_LEN 11
#define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'} #define PRODUCT_NAME {'U','S','B',' ','S','e','r','i','a','l'}
#define EP0_SIZE 64 #define EP0_SIZE 64
#define NUM_ENDPOINTS 4 #define NUM_ENDPOINTS 4
#define NUM_USB_BUFFERS 12 #define NUM_USB_BUFFERS 12
#define NUM_INTERFACE 3
#define NUM_INTERFACE 2
#define CDC_IAD_DESCRIPTOR 1 // Serial
#define CDC_STATUS_INTERFACE 0 #define CDC_STATUS_INTERFACE 0
#define CDC_DATA_INTERFACE 1 #define CDC_DATA_INTERFACE 1
#define CDC_ACM_ENDPOINT 2 #define CDC_ACM_ENDPOINT 2
#define CDC_TX_SIZE_480 512 #define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64 #define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64 #define CDC_TX_SIZE_12 64
#define EXPERIMENTAL_INTERFACE 2
//#define EXPERIMENTAL_INTERFACE 2
#define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT #define ENDPOINT2_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_INTERRUPT
#define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED #define ENDPOINT3_CONFIG ENDPOINT_RECEIVE_BULK + ENDPOINT_TRANSMIT_UNUSED
#define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK #define ENDPOINT4_CONFIG ENDPOINT_RECEIVE_UNUSED + ENDPOINT_TRANSMIT_BULK

Loading…
Cancel
Save