mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
usb: use HS_IN_FS
TODO: with more interfaces, static usb state is getting bigger, maybe we should move it to dynamic memory. at the very least, concepts of physical and logical interfaces should be separate
This commit is contained in:
parent
d77373eef7
commit
880faa10b0
@ -46,7 +46,9 @@
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
|
||||
#define USE_USB_FS
|
||||
// #define USE_USB_FS
|
||||
#define USE_USB_HS
|
||||
#define USE_USB_HS_IN_FS
|
||||
|
||||
/* ########################## Module Selection ############################## */
|
||||
/**
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#define UNCONST(X) ((uint8_t *)(X))
|
||||
|
||||
#define USB_MAX_CONFIG_DESC_SIZE 128
|
||||
#define USB_MAX_CONFIG_DESC_SIZE 256
|
||||
#define USB_MAX_STR_SIZE 62
|
||||
#define USB_MAX_STR_DESC_SIZE (USB_MAX_STR_SIZE * 2 + 2)
|
||||
|
||||
|
@ -62,7 +62,8 @@
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Common Config */
|
||||
#define USB_PHY_FS_ID 0
|
||||
#define USBD_MAX_NUM_INTERFACES 3
|
||||
#define USB_PHY_HS_ID 1
|
||||
#define USBD_MAX_NUM_INTERFACES 8
|
||||
#define USBD_MAX_NUM_CONFIGURATION 1
|
||||
#define USBD_SUPPORT_USER_STRING 0
|
||||
#define USBD_SELF_POWERED 0
|
||||
|
@ -311,7 +311,7 @@ def send_cmd(cmd: Cmd, iface: int) -> None:
|
||||
|
||||
|
||||
def boot():
|
||||
iface = 0x00
|
||||
iface = 0x03
|
||||
loop.schedule_task(handle_reports(iface))
|
||||
|
||||
|
||||
|
28
src/main.py
28
src/main.py
@ -15,7 +15,7 @@ from apps import homescreen
|
||||
from apps import management
|
||||
from apps import wallet
|
||||
from apps import ethereum
|
||||
# from apps import fido_u2f
|
||||
from apps import fido_u2f
|
||||
|
||||
# Initialize all applications
|
||||
if __debug__:
|
||||
@ -24,7 +24,7 @@ homescreen.boot()
|
||||
management.boot()
|
||||
wallet.boot()
|
||||
ethereum.boot()
|
||||
# fido_u2f.boot()
|
||||
fido_u2f.boot()
|
||||
|
||||
# HACK: keep storage loaded at all times
|
||||
from apps.common import storage
|
||||
@ -35,9 +35,9 @@ ui.display.backlight(ui.BACKLIGHT_NORMAL)
|
||||
# Register USB ifaces
|
||||
|
||||
_IFACE_WIRE = const(0x00)
|
||||
_IFACE_U2F = const(0x00)
|
||||
_IFACE_VCP = const(0x01)
|
||||
_IFACE_VCP_DATA = const(0x02)
|
||||
_IFACE_U2F = const(0x03)
|
||||
|
||||
hid_wire = msg.HID(
|
||||
iface_num=_IFACE_WIRE,
|
||||
@ -63,10 +63,18 @@ hid_wire = msg.HID(
|
||||
]),
|
||||
)
|
||||
|
||||
vcp = msg.VCP(
|
||||
iface_num=_IFACE_VCP,
|
||||
data_iface_num=_IFACE_VCP_DATA,
|
||||
ep_in=0x82,
|
||||
ep_out=0x02,
|
||||
ep_cmd=0x83,
|
||||
)
|
||||
|
||||
hid_u2f = msg.HID(
|
||||
iface_num=_IFACE_U2F,
|
||||
ep_in=0x81,
|
||||
ep_out=0x01,
|
||||
ep_in=0x84,
|
||||
ep_out=0x03,
|
||||
report_desc=bytes([
|
||||
0x06, 0xd0, 0xf1, # USAGE_PAGE (FIDO Alliance)
|
||||
0x09, 0x01, # USAGE (U2F HID Authenticator Device)
|
||||
@ -87,14 +95,6 @@ hid_u2f = msg.HID(
|
||||
]),
|
||||
)
|
||||
|
||||
vcp = msg.VCP(
|
||||
iface_num=_IFACE_VCP,
|
||||
data_iface_num=_IFACE_VCP_DATA,
|
||||
ep_in=0x82,
|
||||
ep_out=0x02,
|
||||
ep_cmd=0x83,
|
||||
)
|
||||
|
||||
msg.init_usb(msg.USB(
|
||||
vendor_id=0x1209,
|
||||
product_id=0x53C1,
|
||||
@ -102,7 +102,7 @@ msg.init_usb(msg.USB(
|
||||
manufacturer_str="SatoshiLabs",
|
||||
product_str="TREZOR",
|
||||
serial_number_str="000000000000000000000000"
|
||||
), (hid_wire, vcp))
|
||||
), (hid_wire, vcp, hid_u2f))
|
||||
|
||||
# Initialize the wire codec pipeline
|
||||
wire.setup(_IFACE_WIRE)
|
||||
|
Loading…
Reference in New Issue
Block a user