diff options
author | Ryan <fauxpark@gmail.com> | 2020-04-06 08:25:07 +1000 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-06-12 17:00:27 +0900 |
commit | 93d371890e503461492269be46eb0fdccaa2f07f (patch) | |
tree | 0ac467183c9bd401ced3d6fdbd44d02cb87ea8d0 /tmk_core/protocol | |
parent | 50b109c13393d61be68513bbf454312562248607 (diff) |
V-USB: Remove some stuff from usbconfig.h that should not be configurable (#8656)
* V-USB: Remove some stuff from usbconfig.h that should not be configurable
* Clean up some ifdefs
* And some more
* Even more
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 34 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/vusb.h | 16 |
2 files changed, 15 insertions, 35 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 588991524d..26472f8622 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c @@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "bootloader.h" #include <util/delay.h> -#if defined(RAW_ENABLE) +#ifdef RAW_ENABLE # include "raw_hid.h" #endif @@ -159,7 +159,7 @@ typedef struct { } __attribute__((packed)) vusb_mouse_report_t; static void send_mouse(report_mouse_t *report) { -#if defined(MOUSE_ENABLE) +#ifdef MOUSE_ENABLE vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report}; if (usbInterruptIsReady3()) { usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); @@ -421,7 +421,7 @@ const PROGMEM uchar mouse_extra_hid_report[] = { }; #endif -#if defined(RAW_ENABLE) +#ifdef RAW_ENABLE const PROGMEM uchar raw_hid_report[] = { 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined) 0x09, 0x61, // Usage (Vendor Defined) @@ -490,7 +490,6 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { .bString = LSTR(SERIAL_NUMBER) }; -#if USB_CFG_DESCR_PROPS_DEVICE /* * Device descriptor */ @@ -500,8 +499,8 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { .bDescriptorType = USBDESCR_DEVICE }, .bcdUSB = 0x0110, - .bDeviceClass = USB_CFG_DEVICE_CLASS, - .bDeviceSubClass = USB_CFG_DEVICE_SUBCLASS, + .bDeviceClass = 0x00, + .bDeviceSubClass = 0x00, .bDeviceProtocol = 0x00, .bMaxPacketSize0 = 8, .idVendor = VENDOR_ID, @@ -512,9 +511,7 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { .iSerialNumber = 0x03, .bNumConfigurations = 1 }; -#endif -#if USB_CFG_DESCR_PROPS_CONFIGURATION /* * Configuration descriptors */ @@ -546,10 +543,10 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { }, .bInterfaceNumber = 0, .bAlternateSetting = 0x00, - .bNumEndpoints = USB_CFG_HAVE_INTRIN_ENDPOINT, - .bInterfaceClass = USB_CFG_INTERFACE_CLASS, - .bInterfaceSubClass = USB_CFG_INTERFACE_SUBCLASS, - .bInterfaceProtocol = USB_CFG_INTERFACE_PROTOCOL, + .bNumEndpoints = 1, + .bInterfaceClass = 0x03, + .bInterfaceSubClass = 0x01, + .bInterfaceProtocol = 0x01, .iInterface = 0x00 }, .keyboardHID = { @@ -563,7 +560,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .bDescriptorType = USBDESCR_HID_REPORT, .wDescriptorLength = sizeof(keyboard_hid_report) }, -# ifdef USB_CFG_HAVE_INTRIN_ENDPOINT .keyboardINEndpoint = { .header = { .bLength = sizeof(usbEndpointDescriptor_t), @@ -574,7 +570,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .wMaxPacketSize = 8, .bInterval = USB_POLLING_INTERVAL_MS }, -# endif # if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) /* @@ -587,7 +582,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { }, .bInterfaceNumber = 1, .bAlternateSetting = 0x00, - .bNumEndpoints = USB_CFG_HAVE_INTRIN_ENDPOINT3, + .bNumEndpoints = 1, .bInterfaceClass = 0x03, .bInterfaceSubClass = 0x00, .bInterfaceProtocol = 0x00, @@ -604,7 +599,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .bDescriptorType = USBDESCR_HID_REPORT, .wDescriptorLength = sizeof(mouse_extra_hid_report) }, -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 .mouseExtraINEndpoint = { .header = { .bLength = sizeof(usbEndpointDescriptor_t), @@ -615,7 +609,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .wMaxPacketSize = 8, .bInterval = USB_POLLING_INTERVAL_MS } -# endif # elif defined(RAW_ENABLE) .rawInterface = { .header = { @@ -641,7 +634,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .bDescriptorType = USBDESCR_HID_REPORT, .wDescriptorLength = sizeof(raw_hid_report) }, -# if USB_CFG_HAVE_INTRIN_ENDPOINT3 .rawINEndpoint = { .header = { .bLength = sizeof(usbEndpointDescriptor_t), @@ -662,10 +654,8 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { .wMaxPacketSize = RAW_EPSIZE, .bInterval = USB_POLLING_INTERVAL_MS } -# endif # endif }; -#endif // clang-format on @@ -681,18 +671,14 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { debug_hex16(rq->wLength.word); debug("\n"); */ switch (rq->wValue.bytes[1]) { -#if USB_CFG_DESCR_PROPS_DEVICE case USBDESCR_DEVICE: usbMsgPtr = (unsigned char *)&usbDeviceDescriptor; len = sizeof(usbDeviceDescriptor_t); break; -#endif -#if USB_CFG_DESCR_PROPS_CONFIGURATION case USBDESCR_CONFIG: usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor; len = sizeof(usbConfigurationDescriptor_t); break; -#endif case USBDESCR_STRING: switch (rq->wValue.bytes[0]) { case 0: diff --git a/tmk_core/protocol/vusb/vusb.h b/tmk_core/protocol/vusb/vusb.h index 6d491266db..e097323fd0 100644 --- a/tmk_core/protocol/vusb/vusb.h +++ b/tmk_core/protocol/vusb/vusb.h @@ -87,23 +87,17 @@ typedef struct usbConfigurationDescriptor { usbConfigurationDescriptorHeader_t header; usbInterfaceDescriptor_t keyboardInterface; usbHIDDescriptor_t keyboardHID; -#ifdef USB_CFG_HAVE_INTRIN_ENDPOINT - usbEndpointDescriptor_t keyboardINEndpoint; -#endif + usbEndpointDescriptor_t keyboardINEndpoint; #if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) usbInterfaceDescriptor_t mouseExtraInterface; usbHIDDescriptor_t mouseExtraHID; -# ifdef USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbEndpointDescriptor_t mouseExtraINEndpoint; -# endif + usbEndpointDescriptor_t mouseExtraINEndpoint; #elif defined(RAW_ENABLE) usbInterfaceDescriptor_t rawInterface; usbHIDDescriptor_t rawHID; -# ifdef USB_CFG_HAVE_INTRIN_ENDPOINT3 - usbEndpointDescriptor_t rawINEndpoint; - usbEndpointDescriptor_t rawOUTEndpoint; -# endif + usbEndpointDescriptor_t rawINEndpoint; + usbEndpointDescriptor_t rawOUTEndpoint; #endif } __attribute__((packed)) usbConfigurationDescriptor_t; @@ -112,6 +106,6 @@ typedef struct usbConfigurationDescriptor { host_driver_t *vusb_driver(void); void vusb_transfer_keyboard(void); -#if defined(RAW_ENABLE) +#ifdef RAW_ENABLE void raw_hid_task(void); #endif |