mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-06-15 12:38:46 +00:00
trezorhal: more switch formatting
This commit is contained in:
parent
30ff61b588
commit
9d10a7a508
@ -217,14 +217,14 @@ static const USBD_DescriptorsTypeDef usb_descriptors = {
|
|||||||
static uint8_t usb_class_init(USBD_HandleTypeDef *dev, uint8_t cfg_idx) {
|
static uint8_t usb_class_init(USBD_HandleTypeDef *dev, uint8_t cfg_idx) {
|
||||||
for (int i = 0; i < USBD_MAX_NUM_INTERFACES; i++) {
|
for (int i = 0; i < USBD_MAX_NUM_INTERFACES; i++) {
|
||||||
switch (usb_ifaces[i].type) {
|
switch (usb_ifaces[i].type) {
|
||||||
case USB_IFACE_TYPE_HID:
|
case USB_IFACE_TYPE_HID:
|
||||||
usb_hid_class_init(dev, &usb_ifaces[i].hid, cfg_idx);
|
usb_hid_class_init(dev, &usb_ifaces[i].hid, cfg_idx);
|
||||||
break;
|
break;
|
||||||
case USB_IFACE_TYPE_VCP:
|
case USB_IFACE_TYPE_VCP:
|
||||||
usb_vcp_class_init(dev, &usb_ifaces[i].vcp, cfg_idx);
|
usb_vcp_class_init(dev, &usb_ifaces[i].vcp, cfg_idx);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return USBD_OK;
|
return USBD_OK;
|
||||||
|
@ -248,25 +248,25 @@ static int usb_hid_class_setup(USBD_HandleTypeDef *dev, usb_hid_state_t *state,
|
|||||||
case USB_REQ_TYPE_CLASS:
|
case USB_REQ_TYPE_CLASS:
|
||||||
switch (req->bRequest) {
|
switch (req->bRequest) {
|
||||||
|
|
||||||
case USB_HID_REQ_SET_PROTOCOL:
|
case USB_HID_REQ_SET_PROTOCOL:
|
||||||
state->protocol = req->wValue;
|
state->protocol = req->wValue;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_HID_REQ_GET_PROTOCOL:
|
case USB_HID_REQ_GET_PROTOCOL:
|
||||||
USBD_CtlSendData(dev, &state->protocol, sizeof(state->protocol));
|
USBD_CtlSendData(dev, &state->protocol, sizeof(state->protocol));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_HID_REQ_SET_IDLE:
|
case USB_HID_REQ_SET_IDLE:
|
||||||
state->idle_rate = req->wValue >> 8;
|
state->idle_rate = req->wValue >> 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_HID_REQ_GET_IDLE:
|
case USB_HID_REQ_GET_IDLE:
|
||||||
USBD_CtlSendData(dev, &state->idle_rate, sizeof(state->idle_rate));
|
USBD_CtlSendData(dev, &state->idle_rate, sizeof(state->idle_rate));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
USBD_CtlError(dev, req);
|
USBD_CtlError(dev, req);
|
||||||
return USBD_FAIL;
|
return USBD_FAIL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user