1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

trezorhal: remove configuration from usb string table

This commit is contained in:
Pavol Rusnak 2018-01-27 17:40:06 +01:00
parent 55d0416641
commit ba8224f598
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 3 additions and 16 deletions

View File

@ -37,7 +37,6 @@ static void usb_init_all(void) {
.manufacturer = "SatoshiLabs",
.product = "TREZOR",
.serial_number = "",
.configuration = "",
.interface = "TREZOR Interface",
};

View File

@ -37,7 +37,6 @@ static const char *get_0str(mp_obj_t o, size_t min_len, size_t max_len) {
/// manufacturer: str='',
/// product: str='',
/// serial_number: str='',
/// configuration: str='',
/// interface: str='') -> None:
/// '''
/// '''
@ -50,7 +49,6 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
{ MP_QSTR_manufacturer, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_product, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_serial_number, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_configuration, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_interface, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
};
mp_arg_val_t vals[MP_ARRAY_SIZE(allowed_args)];
@ -62,8 +60,7 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
const char *manufacturer = get_0str(vals[3].u_obj, 0, 32);
const char *product = get_0str(vals[4].u_obj, 0, 32);
const char *serial_number = get_0str(vals[5].u_obj, 0, 32);
const char *configuration = get_0str(vals[6].u_obj, 0, 32);
const char *interface = get_0str(vals[7].u_obj, 0, 32);
const char *interface = get_0str(vals[6].u_obj, 0, 32);
CHECK_PARAM_RANGE(vendor_id, 0, 65535)
CHECK_PARAM_RANGE(product_id, 0, 65535)
@ -77,9 +74,6 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
if (serial_number == NULL) {
mp_raise_ValueError("serial_number is invalid");
}
if (configuration == NULL) {
mp_raise_ValueError("configuration is invalid");
}
if (interface == NULL) {
mp_raise_ValueError("interface is invalid");
}
@ -95,7 +89,6 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
o->info.manufacturer = manufacturer;
o->info.product = product;
o->info.serial_number = serial_number;
o->info.configuration = configuration;
o->info.interface = interface;
mp_obj_list_init(&o->ifaces, 0);

View File

@ -92,7 +92,6 @@ static void usb_init_all(void)
.manufacturer = "SatoshiLabs",
.product = "TREZOR",
.serial_number = "000000000000",
.configuration = "",
.interface = "TREZOR Interface",
};

View File

@ -80,13 +80,11 @@ void usb_init(const usb_dev_info_t *dev_info) {
ensure(check_desc_str(dev_info->manufacturer), NULL);
ensure(check_desc_str(dev_info->product), NULL);
ensure(check_desc_str(dev_info->serial_number), NULL);
ensure(check_desc_str(dev_info->configuration), NULL);
ensure(check_desc_str(dev_info->interface), NULL);
usb_str_table.manufacturer = dev_info->manufacturer;
usb_str_table.product = dev_info->product;
usb_str_table.serial_number = dev_info->serial_number;
usb_str_table.configuration = dev_info->configuration;
usb_str_table.interface = dev_info->interface;
// Configuration descriptor
@ -95,7 +93,7 @@ void usb_init(const usb_dev_info_t *dev_info) {
usb_config_desc->wTotalLength = sizeof(usb_config_descriptor_t); // will be updated later via usb_desc_add_iface()
usb_config_desc->bNumInterfaces = 0; // will be updated later via usb_desc_add_iface()
usb_config_desc->bConfigurationValue = 0x01;
usb_config_desc->iConfiguration = USBD_IDX_CONFIG_STR;
usb_config_desc->iConfiguration = 0;
usb_config_desc->bmAttributes = 0x80; // 0x80 = bus powered; 0xC0 = self powered
usb_config_desc->bMaxPower = 0x32; // Maximum Power Consumption in 2mA units
@ -204,7 +202,7 @@ static uint8_t *usb_get_serial_str_descriptor(USBD_SpeedTypeDef speed, uint16_t
}
static uint8_t *usb_get_configuration_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString((uint8_t *)usb_str_table.configuration, usb_str_buf, length);
USBD_GetString((uint8_t *)"", usb_str_buf, length);
return usb_str_buf;
}

View File

@ -89,7 +89,6 @@ typedef struct {
const char *manufacturer;
const char *product;
const char *serial_number;
const char *configuration;
const char *interface;
} usb_dev_string_table_t;
@ -100,7 +99,6 @@ typedef struct {
const char *manufacturer;
const char *product;
const char *serial_number;
const char *configuration;
const char *interface;
} usb_dev_info_t;