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

trezorhal: remove unnecessary casting for usb strings

This commit is contained in:
Pavol Rusnak 2018-01-25 15:34:45 +01:00
parent d39ceb0d99
commit 1280073c04
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 32 additions and 32 deletions

View File

@ -34,11 +34,11 @@ static void usb_init_all(void) {
.vendor_id = 0x1209,
.product_id = 0x53C0,
.release_num = 0x0002,
.manufacturer = (const uint8_t *)"SatoshiLabs",
.product = (const uint8_t *)"TREZOR Bootloader",
.serial_number = (const uint8_t *)"",
.configuration = (const uint8_t *)"",
.interface = (const uint8_t *)"TREZOR Interface",
.manufacturer = "SatoshiLabs",
.product = "TREZOR Bootloader",
.serial_number = "",
.configuration = "",
.interface = "TREZOR Interface",
};
static uint8_t rx_buffer[USB_PACKET_SIZE];

View File

@ -92,11 +92,11 @@ STATIC mp_obj_t mod_trezorio_USB_make_new(const mp_obj_type_t *type, size_t n_ar
o->info.vendor_id = (uint16_t)(vendor_id);
o->info.product_id = (uint16_t)(product_id);
o->info.release_num = (uint16_t)(release_num);
o->info.manufacturer = (const uint8_t *)(manufacturer);
o->info.product = (const uint8_t *)(product);
o->info.serial_number = (const uint8_t *)(serial_number);
o->info.configuration = (const uint8_t *)(configuration);
o->info.interface = (const uint8_t *)(interface);
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);
return MP_OBJ_FROM_PTR(o);

View File

@ -89,11 +89,11 @@ static void usb_init_all(void)
.vendor_id = 0x1209,
.product_id = 0x53C1,
.release_num = 0x0002,
.manufacturer = (const uint8_t *)"SatoshiLabs",
.product = (const uint8_t *)"TREZOR",
.serial_number = (const uint8_t *)"000000000000",
.configuration = (const uint8_t *)"",
.interface = (const uint8_t *)"TREZOR Interface",
.manufacturer = "SatoshiLabs",
.product = "TREZOR",
.serial_number = "000000000000",
.configuration = "",
.interface = "TREZOR Interface",
};
static uint8_t tx_packet[VCP_PACKET_LEN];

View File

@ -52,9 +52,9 @@ static USBD_HandleTypeDef usb_dev_handle;
static const USBD_DescriptorsTypeDef usb_descriptors;
static const USBD_ClassTypeDef usb_class;
static secbool __wur check_desc_str(const uint8_t *s) {
static secbool __wur check_desc_str(const char *s) {
if (NULL == s) return secfalse;
if (strlen((const char *)s) > USB_MAX_STR_SIZE) return secfalse;
if (strlen(s) > USB_MAX_STR_SIZE) return secfalse;
return sectrue;
}
@ -189,27 +189,27 @@ static uint8_t *usb_get_langid_str_descriptor(USBD_SpeedTypeDef speed, uint16_t
}
static uint8_t *usb_get_manufacturer_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString(usb_str_table.manufacturer, usb_str_buf, length);
USBD_GetString((uint8_t *)usb_str_table.manufacturer, usb_str_buf, length);
return usb_str_buf;
}
static uint8_t *usb_get_product_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString(usb_str_table.product, usb_str_buf, length);
USBD_GetString((uint8_t *)usb_str_table.product, usb_str_buf, length);
return usb_str_buf;
}
static uint8_t *usb_get_serial_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString(usb_str_table.serial_number, usb_str_buf, length);
USBD_GetString((uint8_t *)usb_str_table.serial_number, usb_str_buf, length);
return usb_str_buf;
}
static uint8_t *usb_get_configuration_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString(usb_str_table.configuration, usb_str_buf, length);
USBD_GetString((uint8_t *)usb_str_table.configuration, usb_str_buf, length);
return usb_str_buf;
}
static uint8_t *usb_get_interface_str_descriptor(USBD_SpeedTypeDef speed, uint16_t *length) {
USBD_GetString(usb_str_table.interface, usb_str_buf, length);
USBD_GetString((uint8_t *)usb_str_table.interface, usb_str_buf, length);
return usb_str_buf;
}

View File

@ -86,22 +86,22 @@ typedef enum {
} usb_language_id_t;
typedef struct {
const uint8_t *manufacturer;
const uint8_t *product;
const uint8_t *serial_number;
const uint8_t *configuration;
const uint8_t *interface;
const char *manufacturer;
const char *product;
const char *serial_number;
const char *configuration;
const char *interface;
} usb_dev_string_table_t;
typedef struct {
uint16_t vendor_id;
uint16_t product_id;
uint16_t release_num;
const uint8_t *manufacturer;
const uint8_t *product;
const uint8_t *serial_number;
const uint8_t *configuration;
const uint8_t *interface;
const char *manufacturer;
const char *product;
const char *serial_number;
const char *configuration;
const char *interface;
} usb_dev_info_t;
typedef enum {