1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00

usb: add trezor1-like debuglink

This commit is contained in:
Jan Pochyla 2017-10-30 17:34:21 +01:00
parent 6213974b6e
commit 431a711060

View File

@ -33,6 +33,30 @@ usb_wire = io.HID(
0xc0, # END_COLLECTION
]),
)
if __debug__:
usb_debug = io.HID(
iface_num=0x04,
ep_in=0x85,
ep_out=0x04,
report_desc=bytes([
0x06, 0x01, 0xff, # USAGE_PAGE (Vendor Defined)
0x09, 0x01, # USAGE (1)
0xa1, 0x01, # COLLECTION (Application)
0x09, 0x20, # USAGE (Input Report Data)
0x15, 0x00, # LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, # LOGICAL_MAXIMUM (255)
0x75, 0x08, # REPORT_SIZE (8)
0x95, 0x40, # REPORT_COUNT (64)
0x81, 0x02, # INPUT (Data,Var,Abs)
0x09, 0x21, # USAGE (Output Report Data)
0x15, 0x00, # LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, # LOGICAL_MAXIMUM (255)
0x75, 0x08, # REPORT_SIZE (8)
0x95, 0x40, # REPORT_COUNT (64)
0x91, 0x02, # OUTPUT (Data,Var,Abs)
0xc0, # END_COLLECTION
]),
)
usb_vcp = io.VCP(
iface_num=0x01,
data_iface_num=0x02,
@ -72,6 +96,8 @@ usb = io.USB(
serial_number="000000000000000000000000",
)
usb.add(usb_wire)
if __debug__:
usb.add(usb_debug)
usb.add(usb_vcp)
usb.add(usb_u2f)
@ -96,6 +122,8 @@ fido_u2f.boot(usb_u2f)
# initialize the wire codec and start the USB
wire.setup(usb_wire)
if __debug__:
wire.setup(usb_debug)
usb.open()
# load default homescreen