mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
trezor.io: remove unused fields from WebUSB class
This commit is contained in:
parent
8bf19b4c92
commit
aa8c192040
@ -39,8 +39,6 @@ typedef struct {
|
|||||||
uint8_t ep_out;
|
uint8_t ep_out;
|
||||||
uint8_t max_packet_len;
|
uint8_t max_packet_len;
|
||||||
|
|
||||||
uint8_t protocol; // For SET_PROTOCOL/GET_PROTOCOL setup reqs
|
|
||||||
uint8_t idle_rate; // For SET_IDLE/GET_IDLE setup reqs
|
|
||||||
uint8_t alt_setting; // For SET_INTERFACE/GET_INTERFACE setup reqs
|
uint8_t alt_setting; // For SET_INTERFACE/GET_INTERFACE setup reqs
|
||||||
uint8_t last_read_len; // Length of data read into rx_buffer
|
uint8_t last_read_len; // Length of data read into rx_buffer
|
||||||
uint8_t ep_in_is_idle; // Set to 1 after IN endpoint gets idle
|
uint8_t ep_in_is_idle; // Set to 1 after IN endpoint gets idle
|
||||||
|
@ -83,8 +83,6 @@ secbool usb_webusb_add(const usb_webusb_info_t *info) {
|
|||||||
iface->webusb.ep_in = info->ep_in;
|
iface->webusb.ep_in = info->ep_in;
|
||||||
iface->webusb.ep_out = info->ep_out;
|
iface->webusb.ep_out = info->ep_out;
|
||||||
iface->webusb.max_packet_len = info->max_packet_len;
|
iface->webusb.max_packet_len = info->max_packet_len;
|
||||||
iface->webusb.protocol = 0;
|
|
||||||
iface->webusb.idle_rate = 0;
|
|
||||||
iface->webusb.alt_setting = 0;
|
iface->webusb.alt_setting = 0;
|
||||||
iface->webusb.last_read_len = 0;
|
iface->webusb.last_read_len = 0;
|
||||||
iface->webusb.ep_in_is_idle = 1;
|
iface->webusb.ep_in_is_idle = 1;
|
||||||
@ -210,8 +208,6 @@ static void usb_webusb_class_init(USBD_HandleTypeDef *dev, usb_webusb_state_t *s
|
|||||||
USBD_LL_OpenEP(dev, state->ep_out, USBD_EP_TYPE_INTR, state->max_packet_len);
|
USBD_LL_OpenEP(dev, state->ep_out, USBD_EP_TYPE_INTR, state->max_packet_len);
|
||||||
|
|
||||||
// Reset the state
|
// Reset the state
|
||||||
state->protocol = 0;
|
|
||||||
state->idle_rate = 0;
|
|
||||||
state->alt_setting = 0;
|
state->alt_setting = 0;
|
||||||
state->last_read_len = 0;
|
state->last_read_len = 0;
|
||||||
state->ep_in_is_idle = 1;
|
state->ep_in_is_idle = 1;
|
||||||
@ -240,21 +236,9 @@ static int usb_webusb_class_setup(USBD_HandleTypeDef *dev, usb_webusb_state_t *s
|
|||||||
|
|
||||||
switch (req->bmRequest & USB_REQ_TYPE_MASK) {
|
switch (req->bmRequest & USB_REQ_TYPE_MASK) {
|
||||||
|
|
||||||
case USB_REQ_TYPE_CLASS: // Class request
|
case USB_REQ_TYPE_VENDOR: // Vendor request
|
||||||
|
|
||||||
switch (req->bRequest) {
|
switch (req->bRequest) {
|
||||||
case USB_WEBUSB_REQ_SET_PROTOCOL:
|
|
||||||
state->protocol = req->wValue;
|
|
||||||
break;
|
|
||||||
case USB_WEBUSB_REQ_GET_PROTOCOL:
|
|
||||||
USBD_CtlSendData(dev, &state->protocol, sizeof(state->protocol));
|
|
||||||
break;
|
|
||||||
case USB_WEBUSB_REQ_SET_IDLE:
|
|
||||||
state->idle_rate = req->wValue >> 8;
|
|
||||||
break;
|
|
||||||
case USB_WEBUSB_REQ_GET_IDLE:
|
|
||||||
USBD_CtlSendData(dev, &state->idle_rate, sizeof(state->idle_rate));
|
|
||||||
break;
|
|
||||||
case USB_WEBUSB_VENDOR_CODE:
|
case USB_WEBUSB_VENDOR_CODE:
|
||||||
switch (req->wIndex) {
|
switch (req->wIndex) {
|
||||||
case USB_WEBUSB_REQ_GET_URL:
|
case USB_WEBUSB_REQ_GET_URL:
|
||||||
|
Loading…
Reference in New Issue
Block a user