From 6b07961cf68759b5afd53d8ed8fbc18f2e45a2d8 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sat, 25 Mar 2017 14:45:10 +0100 Subject: [PATCH] trezorhal: set iface.type --- micropython/trezorhal/usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/micropython/trezorhal/usb.c b/micropython/trezorhal/usb.c index 2de882bb98..a763a5f093 100644 --- a/micropython/trezorhal/usb.c +++ b/micropython/trezorhal/usb.c @@ -224,6 +224,7 @@ int usb_hid_add(const usb_hid_info_t *info) { // Interface state usb_iface_t *i = &usb_ifaces[info->iface_num]; + i->type = USB_IFACE_TYPE_HID; i->hid.ep_in = info->ep_in; i->hid.ep_out = info->ep_out; i->hid.rx_buffer = info->rx_buffer; @@ -254,7 +255,7 @@ int usb_hid_read(uint8_t iface_num, uint8_t *buf, uint32_t len) { return -1; // Invalid interface number } if (usb_ifaces[iface_num].type != USB_IFACE_TYPE_HID) { - return -1; // Invalid interface number + return -2; // Invalid interface type } usb_hid_state_t *state = &usb_ifaces[iface_num].hid; if (len < state->rx_buffer_len) { @@ -274,7 +275,7 @@ int usb_hid_write(uint8_t iface_num, const uint8_t *buf, uint32_t len) { return -1; // Invalid interface number } if (usb_ifaces[iface_num].type != USB_IFACE_TYPE_HID) { - return -1; // Invalid interface number + return -2; // Invalid interface type } usb_hid_state_t *state = &usb_ifaces[iface_num].hid;