1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-22 06:28:13 +00:00

feat(nordic,core): change device code to single byte value

[no changelog]
This commit is contained in:
tychovrahe 2025-06-05 17:06:28 +02:00 committed by TychoVrahe
parent ab4d9d49bd
commit 12b4d46691
5 changed files with 9 additions and 9 deletions

View File

@ -19,6 +19,8 @@
#ifdef KERNEL_MODE
#include <trezor_bsp.h>
#include <trezor_model.h>
#include <trezor_rtl.h>
#include <io/ble.h>
@ -99,7 +101,7 @@ static bool ble_send_advertising_on(ble_driver_t *drv, bool whitelist) {
.whitelist = whitelist ? 1 : 0,
.color = props.color,
.static_addr = drv->adv_cmd.static_mac,
.device_code = HW_MODEL,
.device_code = MODEL_BLE_CODE,
};
memcpy(data.name, drv->adv_cmd.name, BLE_ADV_NAME_LEN);

View File

@ -73,7 +73,7 @@ typedef struct {
uint8_t whitelist;
uint8_t color;
uint8_t static_addr;
uint32_t device_code;
uint8_t device_code;
uint8_t name[BLE_ADV_NAME_LEN];
} cmd_advertising_on_t;

View File

@ -33,6 +33,7 @@
#define MODEL_USB_MANUFACTURER "Trezor Company"
#define MODEL_USB_PRODUCT MODEL_FULL_NAME
#define MODEL_HOMESCREEN_MAXSIZE 65536
#define MODEL_BLE_CODE 6
#define MODEL_BOARDLOADER_KEYS \
(const uint8_t *)"\xe8\x91\x2f\x81\xb3\xe7\x80\xee\x65\x0e\xd3\x85\x6d\xb5\x32\x6e\x0b\x9e\xff\x10\x36\x4b\x33\x91\x93\xe7\xa8\xf1\x0f\x76\x21\xb9", \

View File

@ -65,7 +65,7 @@ void advertising_setup_wl(void) {
bt_foreach_bond(BT_ID_DEFAULT, add_to_whitelist, NULL);
}
void advertising_start(bool wl, uint8_t color, uint32_t device_code,
void advertising_start(bool wl, uint8_t color, uint8_t device_code,
bool static_addr, char *name, int name_len) {
if (advertising) {
LOG_WRN("Restarting advertising");
@ -90,10 +90,7 @@ void advertising_start(bool wl, uint8_t color, uint32_t device_code,
}
manufacturer_data[3] = color;
manufacturer_data[4] = device_code & 0xff;
manufacturer_data[5] = (device_code >> 8) & 0xff;
manufacturer_data[6] = (device_code >> 16) & 0xff;
manufacturer_data[7] = (device_code >> 24) & 0xff;
manufacturer_data[4] = device_code;
advertising_data[0].type = BT_DATA_FLAGS;
advertising_data[0].data_len = 1;

View File

@ -103,7 +103,7 @@ typedef struct {
uint8_t whitelist;
uint8_t color;
uint8_t static_addr;
uint32_t device_code;
uint8_t device_code;
uint8_t name[BLE_ADV_NAME_LEN];
} cmd_advertising_on_t;
@ -146,7 +146,7 @@ bool bonds_erase_current(void);
// Initialization
void advertising_init(void);
// Start advertising, with or without whitelist
void advertising_start(bool wl, uint8_t color, uint32_t device_code,
void advertising_start(bool wl, uint8_t color, uint8_t device_code,
bool static_addr, char *name, int name_len);
// Stop advertising
void advertising_stop(void);