diff options
Diffstat (limited to 'tmk_core/protocol/vusb/vusb.c')
| -rw-r--r-- | tmk_core/protocol/vusb/vusb.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c index 470d29ba3..c4baf5ab0 100644 --- a/tmk_core/protocol/vusb/vusb.c +++ b/tmk_core/protocol/vusb/vusb.c | |||
| @@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 28 | #include "vusb.h" | 28 | #include "vusb.h" |
| 29 | #include <util/delay.h> | 29 | #include <util/delay.h> |
| 30 | 30 | ||
| 31 | #if defined(RAW_ENABLE) | 31 | #ifdef RAW_ENABLE |
| 32 | # include "raw_hid.h" | 32 | # include "raw_hid.h" |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| @@ -158,7 +158,7 @@ typedef struct { | |||
| 158 | } __attribute__((packed)) vusb_mouse_report_t; | 158 | } __attribute__((packed)) vusb_mouse_report_t; |
| 159 | 159 | ||
| 160 | static void send_mouse(report_mouse_t *report) { | 160 | static void send_mouse(report_mouse_t *report) { |
| 161 | #if defined(MOUSE_ENABLE) | 161 | #ifdef MOUSE_ENABLE |
| 162 | vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report}; | 162 | vusb_mouse_report_t r = {.report_id = REPORT_ID_MOUSE, .report = *report}; |
| 163 | if (usbInterruptIsReady3()) { | 163 | if (usbInterruptIsReady3()) { |
| 164 | usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); | 164 | usbSetInterrupt3((void *)&r, sizeof(vusb_mouse_report_t)); |
| @@ -410,7 +410,7 @@ const PROGMEM uchar mouse_extra_hid_report[] = { | |||
| 410 | }; | 410 | }; |
| 411 | #endif | 411 | #endif |
| 412 | 412 | ||
| 413 | #if defined(RAW_ENABLE) | 413 | #ifdef RAW_ENABLE |
| 414 | const PROGMEM uchar raw_hid_report[] = { | 414 | const PROGMEM uchar raw_hid_report[] = { |
| 415 | 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined) | 415 | 0x06, 0x60, 0xFF, // Usage Page (Vendor Defined) |
| 416 | 0x09, 0x61, // Usage (Vendor Defined) | 416 | 0x09, 0x61, // Usage (Vendor Defined) |
| @@ -479,7 +479,6 @@ const PROGMEM usbStringDescriptor_t usbStringDescriptorSerial = { | |||
| 479 | .bString = LSTR(SERIAL_NUMBER) | 479 | .bString = LSTR(SERIAL_NUMBER) |
| 480 | }; | 480 | }; |
| 481 | 481 | ||
| 482 | #if USB_CFG_DESCR_PROPS_DEVICE | ||
| 483 | /* | 482 | /* |
| 484 | * Device descriptor | 483 | * Device descriptor |
| 485 | */ | 484 | */ |
| @@ -489,8 +488,8 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { | |||
| 489 | .bDescriptorType = USBDESCR_DEVICE | 488 | .bDescriptorType = USBDESCR_DEVICE |
| 490 | }, | 489 | }, |
| 491 | .bcdUSB = 0x0110, | 490 | .bcdUSB = 0x0110, |
| 492 | .bDeviceClass = USB_CFG_DEVICE_CLASS, | 491 | .bDeviceClass = 0x00, |
| 493 | .bDeviceSubClass = USB_CFG_DEVICE_SUBCLASS, | 492 | .bDeviceSubClass = 0x00, |
| 494 | .bDeviceProtocol = 0x00, | 493 | .bDeviceProtocol = 0x00, |
| 495 | .bMaxPacketSize0 = 8, | 494 | .bMaxPacketSize0 = 8, |
| 496 | .idVendor = VENDOR_ID, | 495 | .idVendor = VENDOR_ID, |
| @@ -501,9 +500,7 @@ const PROGMEM usbDeviceDescriptor_t usbDeviceDescriptor = { | |||
| 501 | .iSerialNumber = 0x03, | 500 | .iSerialNumber = 0x03, |
| 502 | .bNumConfigurations = 1 | 501 | .bNumConfigurations = 1 |
| 503 | }; | 502 | }; |
| 504 | #endif | ||
| 505 | 503 | ||
| 506 | #if USB_CFG_DESCR_PROPS_CONFIGURATION | ||
| 507 | /* | 504 | /* |
| 508 | * Configuration descriptors | 505 | * Configuration descriptors |
| 509 | */ | 506 | */ |
| @@ -535,10 +532,10 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 535 | }, | 532 | }, |
| 536 | .bInterfaceNumber = 0, | 533 | .bInterfaceNumber = 0, |
| 537 | .bAlternateSetting = 0x00, | 534 | .bAlternateSetting = 0x00, |
| 538 | .bNumEndpoints = USB_CFG_HAVE_INTRIN_ENDPOINT, | 535 | .bNumEndpoints = 1, |
| 539 | .bInterfaceClass = USB_CFG_INTERFACE_CLASS, | 536 | .bInterfaceClass = 0x03, |
| 540 | .bInterfaceSubClass = USB_CFG_INTERFACE_SUBCLASS, | 537 | .bInterfaceSubClass = 0x01, |
| 541 | .bInterfaceProtocol = USB_CFG_INTERFACE_PROTOCOL, | 538 | .bInterfaceProtocol = 0x01, |
| 542 | .iInterface = 0x00 | 539 | .iInterface = 0x00 |
| 543 | }, | 540 | }, |
| 544 | .keyboardHID = { | 541 | .keyboardHID = { |
| @@ -552,7 +549,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 552 | .bDescriptorType = USBDESCR_HID_REPORT, | 549 | .bDescriptorType = USBDESCR_HID_REPORT, |
| 553 | .wDescriptorLength = sizeof(keyboard_hid_report) | 550 | .wDescriptorLength = sizeof(keyboard_hid_report) |
| 554 | }, | 551 | }, |
| 555 | # ifdef USB_CFG_HAVE_INTRIN_ENDPOINT | ||
| 556 | .keyboardINEndpoint = { | 552 | .keyboardINEndpoint = { |
| 557 | .header = { | 553 | .header = { |
| 558 | .bLength = sizeof(usbEndpointDescriptor_t), | 554 | .bLength = sizeof(usbEndpointDescriptor_t), |
| @@ -563,7 +559,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 563 | .wMaxPacketSize = 8, | 559 | .wMaxPacketSize = 8, |
| 564 | .bInterval = USB_POLLING_INTERVAL_MS | 560 | .bInterval = USB_POLLING_INTERVAL_MS |
| 565 | }, | 561 | }, |
| 566 | # endif | ||
| 567 | 562 | ||
| 568 | # if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) | 563 | # if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) |
| 569 | /* | 564 | /* |
| @@ -576,7 +571,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 576 | }, | 571 | }, |
| 577 | .bInterfaceNumber = 1, | 572 | .bInterfaceNumber = 1, |
| 578 | .bAlternateSetting = 0x00, | 573 | .bAlternateSetting = 0x00, |
| 579 | .bNumEndpoints = USB_CFG_HAVE_INTRIN_ENDPOINT3, | 574 | .bNumEndpoints = 1, |
| 580 | .bInterfaceClass = 0x03, | 575 | .bInterfaceClass = 0x03, |
| 581 | .bInterfaceSubClass = 0x00, | 576 | .bInterfaceSubClass = 0x00, |
| 582 | .bInterfaceProtocol = 0x00, | 577 | .bInterfaceProtocol = 0x00, |
| @@ -593,7 +588,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 593 | .bDescriptorType = USBDESCR_HID_REPORT, | 588 | .bDescriptorType = USBDESCR_HID_REPORT, |
| 594 | .wDescriptorLength = sizeof(mouse_extra_hid_report) | 589 | .wDescriptorLength = sizeof(mouse_extra_hid_report) |
| 595 | }, | 590 | }, |
| 596 | # if USB_CFG_HAVE_INTRIN_ENDPOINT3 | ||
| 597 | .mouseExtraINEndpoint = { | 591 | .mouseExtraINEndpoint = { |
| 598 | .header = { | 592 | .header = { |
| 599 | .bLength = sizeof(usbEndpointDescriptor_t), | 593 | .bLength = sizeof(usbEndpointDescriptor_t), |
| @@ -604,7 +598,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 604 | .wMaxPacketSize = 8, | 598 | .wMaxPacketSize = 8, |
| 605 | .bInterval = USB_POLLING_INTERVAL_MS | 599 | .bInterval = USB_POLLING_INTERVAL_MS |
| 606 | } | 600 | } |
| 607 | # endif | ||
| 608 | # elif defined(RAW_ENABLE) | 601 | # elif defined(RAW_ENABLE) |
| 609 | .rawInterface = { | 602 | .rawInterface = { |
| 610 | .header = { | 603 | .header = { |
| @@ -630,7 +623,6 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 630 | .bDescriptorType = USBDESCR_HID_REPORT, | 623 | .bDescriptorType = USBDESCR_HID_REPORT, |
| 631 | .wDescriptorLength = sizeof(raw_hid_report) | 624 | .wDescriptorLength = sizeof(raw_hid_report) |
| 632 | }, | 625 | }, |
| 633 | # if USB_CFG_HAVE_INTRIN_ENDPOINT3 | ||
| 634 | .rawINEndpoint = { | 626 | .rawINEndpoint = { |
| 635 | .header = { | 627 | .header = { |
| 636 | .bLength = sizeof(usbEndpointDescriptor_t), | 628 | .bLength = sizeof(usbEndpointDescriptor_t), |
| @@ -651,10 +643,8 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = { | |||
| 651 | .wMaxPacketSize = RAW_EPSIZE, | 643 | .wMaxPacketSize = RAW_EPSIZE, |
| 652 | .bInterval = USB_POLLING_INTERVAL_MS | 644 | .bInterval = USB_POLLING_INTERVAL_MS |
| 653 | } | 645 | } |
| 654 | # endif | ||
| 655 | # endif | 646 | # endif |
| 656 | }; | 647 | }; |
| 657 | #endif | ||
| 658 | 648 | ||
| 659 | // clang-format on | 649 | // clang-format on |
| 660 | 650 | ||
| @@ -670,18 +660,14 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) { | |||
| 670 | debug_hex16(rq->wLength.word); debug("\n"); | 660 | debug_hex16(rq->wLength.word); debug("\n"); |
| 671 | */ | 661 | */ |
| 672 | switch (rq->wValue.bytes[1]) { | 662 | switch (rq->wValue.bytes[1]) { |
| 673 | #if USB_CFG_DESCR_PROPS_DEVICE | ||
| 674 | case USBDESCR_DEVICE: | 663 | case USBDESCR_DEVICE: |
| 675 | usbMsgPtr = (unsigned char *)&usbDeviceDescriptor; | 664 | usbMsgPtr = (unsigned char *)&usbDeviceDescriptor; |
| 676 | len = sizeof(usbDeviceDescriptor_t); | 665 | len = sizeof(usbDeviceDescriptor_t); |
| 677 | break; | 666 | break; |
| 678 | #endif | ||
| 679 | #if USB_CFG_DESCR_PROPS_CONFIGURATION | ||
| 680 | case USBDESCR_CONFIG: | 667 | case USBDESCR_CONFIG: |
| 681 | usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor; | 668 | usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor; |
| 682 | len = sizeof(usbConfigurationDescriptor_t); | 669 | len = sizeof(usbConfigurationDescriptor_t); |
| 683 | break; | 670 | break; |
| 684 | #endif | ||
| 685 | case USBDESCR_STRING: | 671 | case USBDESCR_STRING: |
| 686 | switch (rq->wValue.bytes[0]) { | 672 | switch (rq->wValue.bytes[0]) { |
| 687 | case 0: | 673 | case 0: |
