diff options
Diffstat (limited to 'tmk_core/protocol/usb_descriptor.c')
-rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index ffcf0957f3..dff3d48bad 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c @@ -39,7 +39,9 @@ #include "util.h" #include "report.h" #include "usb_descriptor.h" - +#ifdef WEBUSB_ENABLE +#include "webusb.h" +#endif /* * HID report descriptors */ @@ -274,11 +276,18 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM ConsoleReport[] = { }; #endif +#ifdef WEBUSB_ENABLE +const USB_Descriptor_BOS_t PROGMEM BOSDescriptor = BOS_DESCRIPTOR( + (MS_OS_20_PLATFORM_DESCRIPTOR(MS_OS_20_VENDOR_CODE, MS_OS_20_DESCRIPTOR_SET_TOTAL_LENGTH)) + (WEBUSB_PLATFORM_DESCRIPTOR(WEBUSB_VENDOR_CODE, WEBUSB_LANDING_PAGE_INDEX)) +); +#endif + /* * Device descriptor */ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = {.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - .USBSpecification = VERSION_BCD(1, 1, 0), + .USBSpecification = VERSION_BCD(2, 1, 0), #if VIRTSER_ENABLE .Class = USB_CSCP_IADDeviceClass, .SubClass = USB_CSCP_IADDeviceSubclass, @@ -381,6 +390,38 @@ const USB_Descriptor_Configuration_t PROGMEM .Console_OUTEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_OUT | CONSOLE_OUT_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = CONSOLE_EPSIZE, .PollingIntervalMS = 0x01}, #endif +#ifdef WEBUSB_ENABLE + /* + * Webusb + */ + .WebUSB_Interface = {.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_WebUSB, + .AlternateSetting = 0x00, + + .TotalEndpoints = 2, + + .Class = USB_CSCP_VendorSpecificClass, + .SubClass = 0x00, + .Protocol = 0x00, + + .InterfaceStrIndex = NO_DESCRIPTOR}, + + .WebUSB_DataInEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = WEBUSB_IN_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = WEBUSB_EPSIZE, + .PollingIntervalMS = 0x05}, + + .WebUSB_DataOutEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = WEBUSB_OUT_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = WEBUSB_EPSIZE, + .PollingIntervalMS = 0x05}, +#endif + #ifdef MIDI_ENABLE /* * MIDI @@ -520,6 +561,13 @@ uint16_t get_usb_descriptor(const uint16_t wValue, const uint16_t wIndex, const Size = sizeof(USB_Descriptor_Device_t); break; +#ifdef WEBUSB_ENABLE + case DTYPE_BOS: + Address = &BOSDescriptor; + Size = pgm_read_byte(&BOSDescriptor.TotalLength); + + break; +#endif case DTYPE_Configuration: Address = &ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); |