mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-13 08:50:56 +00:00
core: show webusb popup only in bootloader and only if firmware is not installed
This commit is contained in:
parent
0ec628ccd4
commit
07cd73ce57
@ -50,8 +50,8 @@ static const uint8_t * const BOOTLOADER_KEYS[] = {
|
|||||||
|
|
||||||
#define USB_IFACE_NUM 0
|
#define USB_IFACE_NUM 0
|
||||||
|
|
||||||
static void usb_init_all(void) {
|
static void usb_init_all(secbool usb21_landing) {
|
||||||
static const usb_dev_info_t dev_info = {
|
usb_dev_info_t dev_info = {
|
||||||
.device_class = 0x00,
|
.device_class = 0x00,
|
||||||
.device_subclass = 0x00,
|
.device_subclass = 0x00,
|
||||||
.device_protocol = 0x00,
|
.device_protocol = 0x00,
|
||||||
@ -63,7 +63,7 @@ static void usb_init_all(void) {
|
|||||||
.serial_number = "000000000000000000000000",
|
.serial_number = "000000000000000000000000",
|
||||||
.interface = "TREZOR Interface",
|
.interface = "TREZOR Interface",
|
||||||
.usb21_enabled = sectrue,
|
.usb21_enabled = sectrue,
|
||||||
.usb21_landing = sectrue,
|
.usb21_landing = usb21_landing,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t rx_buffer[USB_PACKET_SIZE];
|
static uint8_t rx_buffer[USB_PACKET_SIZE];
|
||||||
@ -88,7 +88,9 @@ static void usb_init_all(void) {
|
|||||||
|
|
||||||
static secbool bootloader_usb_loop(const vendor_header *const vhdr,
|
static secbool bootloader_usb_loop(const vendor_header *const vhdr,
|
||||||
const image_header *const hdr) {
|
const image_header *const hdr) {
|
||||||
usb_init_all();
|
// if both are NULL, we don't have a firmware installed
|
||||||
|
// let's show a webusb landing page in this case
|
||||||
|
usb_init_all((vhdr == NULL && hdr == NULL) ? sectrue : secfalse);
|
||||||
|
|
||||||
uint8_t buf[USB_PACKET_SIZE];
|
uint8_t buf[USB_PACKET_SIZE];
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ bus = io.USB(
|
|||||||
product="TREZOR",
|
product="TREZOR",
|
||||||
interface="TREZOR Interface",
|
interface="TREZOR Interface",
|
||||||
serial_number=get_device_id(),
|
serial_number=get_device_id(),
|
||||||
|
usb21_landing=False,
|
||||||
)
|
)
|
||||||
bus.add(iface_wire)
|
bus.add(iface_wire)
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
@ -18,6 +18,7 @@ usb = io.USB(
|
|||||||
manufacturer="SatoshiLabs",
|
manufacturer="SatoshiLabs",
|
||||||
product="TREZOR",
|
product="TREZOR",
|
||||||
serial_number="000000000000000000000000",
|
serial_number="000000000000000000000000",
|
||||||
|
usb21_landing=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
usb.add(usb_vcp)
|
usb.add(usb_vcp)
|
||||||
|
Loading…
Reference in New Issue
Block a user