summaryrefslogtreecommitdiff
path: root/tmk_core/protocol
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2022-11-23 22:50:11 -0800
committerGitHub <noreply@github.com>2022-11-24 15:50:11 +0900
commit263bc7cf21e60ecefe602d8fe3d02945201eaf77 (patch)
tree16ad661fae12185c53fe11e4c4eed5bdb1f927e9 /tmk_core/protocol
parent64f04b30c2f48fc0e7c49ca043443f03dc56df94 (diff)
Remove Web USB (depreciated) (#361)
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r--tmk_core/protocol/chibios/chibios.c7
-rw-r--r--tmk_core/protocol/chibios/usb_main.c61
-rw-r--r--tmk_core/protocol/lufa/lufa.c114
-rw-r--r--tmk_core/protocol/usb_descriptor.c52
-rw-r--r--tmk_core/protocol/usb_descriptor.h20
5 files changed, 0 insertions, 254 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index bd6adbe17e..259fe31cc0 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -81,10 +81,6 @@ void console_task(void);
void midi_ep_task(void);
#endif
-#ifdef WEBUSB_ENABLE
-void webusb_task(void);
-#endif
-
/* TESTING
* Amber LED blinker thread, times are in milliseconds.
*/
@@ -222,8 +218,5 @@ void protocol_post_task(void) {
#ifdef RAW_ENABLE
raw_hid_task();
#endif
-#ifdef WEBUSB_ENABLE
- webusb_task();
-#endif
}
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index b61228511d..f9124f6b9d 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -58,10 +58,6 @@ extern keymap_config_t keymap_config;
# include "oryx.h"
#endif
-#ifdef WEBUSB_ENABLE
-# include "webusb.h"
-#endif
-
#ifdef JOYSTICK_ENABLE
# include "joystick.h"
#endif
@@ -331,9 +327,6 @@ typedef struct {
#ifdef VIRTSER_ENABLE
usb_driver_config_t serial_driver;
#endif
-#ifdef WEBUSB_ENABLE
- usb_driver_config_t webusb_driver;
-#endif
#ifdef JOYSTICK_ENABLE
usb_driver_config_t joystick_driver;
#endif
@@ -381,13 +374,6 @@ static usb_driver_configs_t drivers = {
.serial_driver = QMK_USB_DRIVER_CONFIG(CDC, CDC_NOTIFICATION_EPNUM, false),
#endif
-#ifdef WEBUSB_ENABLE
-# define WEBUSB_IN_CAPACITY 4
-# define WEBUSB_OUT_CAPACITY 4
-# define WEBUSB_IN_MODE USB_EP_MODE_TYPE_INTR
-# define WEBUSB_OUT_MODE USB_EP_MODE_TYPE_INTR
- .webusb_driver = QMK_USB_DRIVER_CONFIG(WEBUSB, 0, false),
-#endif
#ifdef JOYSTICK_ENABLE
# define JOYSTICK_IN_CAPACITY 4
# define JOYSTICK_OUT_CAPACITY 4
@@ -695,28 +681,6 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
break;
}
}
-
-#ifdef WEBUSB_ENABLE
- switch (usbp->setup[1]) {
- case WEBUSB_VENDOR_CODE:
- if (usbp->setup[4] == WebUSB_RTYPE_GetURL) {
- if (usbp->setup[2] == WEBUSB_LANDING_PAGE_INDEX) {
- usbSetupTransfer(usbp, (uint8_t *)&WebUSB_LandingPage, WebUSB_LandingPage.Header.Size, NULL);
- return TRUE;
- break;
- }
- }
- break;
-
- case MS_OS_20_VENDOR_CODE:
- if (usbp->setup[4] == MS_OS_20_DESCRIPTOR_INDEX) {
- usbSetupTransfer(usbp, (uint8_t *)&MS_OS_20_Descriptor, MS_OS_20_Descriptor.Header.TotalLength, NULL);
- return TRUE;
- break;
- }
- break;
- }
-#endif
/* Handle the Get_Descriptor Request for HID class (not handled by the default hook) */
if ((usbp->setup[0] == 0x81) && (usbp->setup[1] == USB_REQ_GET_DESCRIPTOR)) {
dp = usbp->config->get_descriptor_cb(usbp, usbp->setup[3], usbp->setup[2], get_hword(&usbp->setup[4]));
@@ -1166,31 +1130,6 @@ void raw_hid_task(void) {
#endif
-#ifdef WEBUSB_ENABLE
-void webusb_send(uint8_t *data, uint8_t length) {
- if (chnWriteTimeout(&drivers.webusb_driver.driver, data, length, TIME_IMMEDIATE) != length) {
- webusb_state.paired = false;
- webusb_state.pairing = false;
- }
-}
-
-// Users should #include "raw_hid.h" in their own code
-// and implement this function there. Leave this as weak linkage
-// so users can opt to not handle data coming in.
-
-void webusb_task(void) {
- uint8_t buffer[WEBUSB_EPSIZE];
- size_t size = 0;
- do {
- size_t size = chnReadTimeout(&drivers.webusb_driver.driver, buffer, sizeof(buffer), TIME_IMMEDIATE);
- if (size > 0) {
- webusb_receive(buffer, size);
- }
- } while (size > 0);
-}
-
-#endif
-
#ifdef MIDI_ENABLE
void send_midi_packet(MIDI_EventPacket_t *event) {
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 1084f67659..112d0964c9 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -86,9 +86,6 @@ extern keymap_config_t keymap_config;
# include "raw_hid.h"
#endif
-#ifdef WEBUSB_ENABLE
-# include "webusb.h"
-#endif
#ifdef JOYSTICK_ENABLE
# include "joystick.h"
#endif
@@ -274,65 +271,6 @@ static void Console_Task(void) {
}
#endif
-#ifdef WEBUSB_ENABLE
-void webusb_send(uint8_t *data, uint8_t length) {
- if (USB_DeviceState != DEVICE_STATE_Configured) {
- return;
- }
-
- Endpoint_SelectEndpoint(WEBUSB_IN_EPNUM);
-
- if (Endpoint_Write_Stream_LE(data, length, NULL)) {
- // Stream failed to complete, resetting WEBUSB's state
- webusb_state.paired = false;
- webusb_state.pairing = false;
- }
- Endpoint_ClearIN();
-}
-
-static void webusb_task(void) {
- // Create a temporary buffer to hold the read in data from the host
- uint8_t data[WEBUSB_EPSIZE];
- bool data_read = false;
-
- // Device must be connected and configured for the task to run
- if (USB_DeviceState != DEVICE_STATE_Configured) return;
-
- Endpoint_SelectEndpoint(WEBUSB_OUT_EPNUM);
-
- // Check to see if a packet has been sent from the host
- if (Endpoint_IsOUTReceived()) {
- // Check to see if the packet contains data
- if (Endpoint_IsReadWriteAllowed()) {
- /* Read data */
- Endpoint_Read_Stream_LE(data, sizeof(data), NULL);
- data_read = true;
- }
-
- // Finalize the stream transfer to receive the last packet
- Endpoint_ClearOUT();
-
- if (data_read) {
- webusb_receive(data, sizeof(data));
- }
- }
-}
-
-/** Microsoft OS 2.0 Descriptor. This is used by Windows to select the USB driver for the device.
- *
- * For WebUSB in Chrome, the correct driver is WinUSB, which is selected via CompatibleID.
- *
- * Additionally, while Chrome is built using libusb, a magic registry key needs to be set containing a GUID for
- * the device.
- */
-const MS_OS_20_Descriptor_t PROGMEM MS_OS_20_Descriptor = MS_OS_20_DESCRIPTOR;
-
-/** URL descriptor string. This is a UTF-8 string containing a URL excluding the prefix. At least one of these must be
- * defined and returned when the Landing Page descriptor index is requested.
- */
-const WebUSB_URL_Descriptor_t PROGMEM WebUSB_LandingPage = WEBUSB_URL_DESCRIPTOR(WEBUSB_LANDING_PAGE_URL);
-#endif
-
/*******************************************************************************
* Joystick
******************************************************************************/
@@ -544,12 +482,6 @@ void EVENT_USB_Device_ConfigurationChanged(void) {
# endif
#endif
-#ifdef WEBUSB_ENABLE
- /* Setup Webusb Endpoints */
- ConfigSuccess &= Endpoint_ConfigureEndpoint(WEBUSB_IN_EPADDR, EP_TYPE_INTERRUPT, WEBUSB_EPSIZE, 1);
- ConfigSuccess &= Endpoint_ConfigureEndpoint(WEBUSB_OUT_EPADDR, EP_TYPE_INTERRUPT, WEBUSB_EPSIZE, 1);
-#endif
-
#ifdef MIDI_ENABLE
/* Setup MIDI stream endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint((MIDI_STREAM_IN_EPNUM | ENDPOINT_DIR_IN), EP_TYPE_BULK, MIDI_STREAM_EPSIZE, 1);
@@ -695,48 +627,6 @@ void EVENT_USB_Device_ControlRequest(void) {
}
break;
-#ifdef WEBUSB_ENABLE
- case WEBUSB_VENDOR_CODE:
- if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE)) {
- switch (USB_ControlRequest.wIndex) {
- case WebUSB_RTYPE_GetURL:
- switch (USB_ControlRequest.wValue) {
- case WEBUSB_LANDING_PAGE_INDEX:
- Endpoint_ClearSETUP();
- /* Write the descriptor data to the control endpoint */
- Endpoint_Write_Control_PStream_LE(&WebUSB_LandingPage, WebUSB_LandingPage.Header.Size);
- /* Release the endpoint after transaction. */
- Endpoint_ClearStatusStage();
- break;
- default: /* Stall transfer on invalid index. */
- Endpoint_StallTransaction();
- break;
- }
- break;
- default: /* Stall on unknown WebUSB request */
- Endpoint_StallTransaction();
- break;
- }
- }
-
- break;
- case MS_OS_20_VENDOR_CODE:
- if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE)) {
- switch (USB_ControlRequest.wIndex) {
- case MS_OS_20_DESCRIPTOR_INDEX:
- Endpoint_ClearSETUP();
- /* Write the descriptor data to the control endpoint */
- Endpoint_Write_Control_PStream_LE(&MS_OS_20_Descriptor, MS_OS_20_Descriptor.Header.TotalLength);
- /* Release the endpoint after transaction. */
- Endpoint_ClearStatusStage();
- break;
- default: /* Stall on unknown MS OS 2.0 request */
- Endpoint_StallTransaction();
- break;
- }
- }
- break;
-#endif
}
#ifdef VIRTSER_ENABLE
@@ -1209,10 +1099,6 @@ void protocol_post_task(void) {
raw_hid_task();
#endif
-#ifdef WEBUSB_ENABLE
- webusb_task();
-#endif
-
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 4905096354..21795cef60 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -39,9 +39,6 @@
#include "util.h"
#include "report.h"
#include "usb_descriptor.h"
-#ifdef WEBUSB_ENABLE
-# include "webusb_descriptor.h"
-#endif
#include "usb_descriptor_common.h"
#ifdef JOYSTICK_ENABLE
@@ -365,12 +362,6 @@ 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
#ifdef JOYSTICK_ENABLE
const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = {
HID_RI_USAGE_PAGE(8, 0x01), // Generic Desktop
@@ -438,11 +429,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = {
.Size = sizeof(USB_Descriptor_Device_t),
.Type = DTYPE_Device
},
-#if defined(WEBUSB_ENABLE) && !defined(STENO_ENABLE)
- .USBSpecification = VERSION_BCD(2, 1, 0),
-#else
.USBSpecification = VERSION_BCD(2, 0, 0),
-#endif
#if VIRTSER_ENABLE
.Class = USB_CSCP_IADDeviceClass,
@@ -718,38 +705,6 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = {
},
#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
@@ -1144,13 +1099,6 @@ 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);
diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h
index fd25376f90..d9a11e204a 100644
--- a/tmk_core/protocol/usb_descriptor.h
+++ b/tmk_core/protocol/usb_descriptor.h
@@ -51,9 +51,6 @@
# define USB_ENDPOINTS_ARE_REORDERABLE
# endif
#endif
-#ifdef WEBUSB_ENABLE
-# include "webusb_descriptor.h"
-#endif
/*
* USB descriptor structure
@@ -103,12 +100,6 @@ typedef struct {
USB_Descriptor_Endpoint_t Console_OUTEndpoint;
#endif
-#ifdef WEBUSB_ENABLE
- USB_Descriptor_Interface_t WebUSB_Interface;
- USB_Descriptor_Endpoint_t WebUSB_DataInEndpoint;
- USB_Descriptor_Endpoint_t WebUSB_DataOutEndpoint;
-#endif
-
#ifdef MIDI_ENABLE
USB_Descriptor_Interface_Association_t Audio_Interface_Association;
// MIDI Audio Control Interface
@@ -196,10 +187,6 @@ enum usb_interfaces {
CDI_INTERFACE,
#endif
-#ifdef WEBUSB_ENABLE
- INTERFACE_ID_WebUSB,
-#endif
-
#if defined(JOYSTICK_ENABLE)
JOYSTICK_INTERFACE,
#endif
@@ -279,13 +266,6 @@ enum usb_endpoints {
# endif
#endif
-#ifdef WEBUSB_ENABLE
- WEBUSB_IN_EPNUM = NEXT_EPNUM,
- WEBUSB_OUT_EPNUM = NEXT_EPNUM,
-# define WEBUSB_IN_EPADDR (ENDPOINT_DIR_IN | WEBUSB_IN_EPNUM)
-# define WEBUSB_OUT_EPADDR (ENDPOINT_DIR_OUT | WEBUSB_OUT_EPNUM)
-#endif
-
#ifdef JOYSTICK_ENABLE
JOYSTICK_IN_EPNUM = NEXT_EPNUM,
# ifdef USB_ENDPOINTS_ARE_REORDERABLE