mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-23 06:58:13 +00:00
feat(nordic,core): change device code to single byte value
[no changelog]
This commit is contained in:
parent
ab4d9d49bd
commit
12b4d46691
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#ifdef KERNEL_MODE
|
#ifdef KERNEL_MODE
|
||||||
|
|
||||||
|
#include <trezor_bsp.h>
|
||||||
|
#include <trezor_model.h>
|
||||||
#include <trezor_rtl.h>
|
#include <trezor_rtl.h>
|
||||||
|
|
||||||
#include <io/ble.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,
|
.whitelist = whitelist ? 1 : 0,
|
||||||
.color = props.color,
|
.color = props.color,
|
||||||
.static_addr = drv->adv_cmd.static_mac,
|
.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);
|
memcpy(data.name, drv->adv_cmd.name, BLE_ADV_NAME_LEN);
|
||||||
|
@ -73,7 +73,7 @@ typedef struct {
|
|||||||
uint8_t whitelist;
|
uint8_t whitelist;
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
uint8_t static_addr;
|
uint8_t static_addr;
|
||||||
uint32_t device_code;
|
uint8_t device_code;
|
||||||
uint8_t name[BLE_ADV_NAME_LEN];
|
uint8_t name[BLE_ADV_NAME_LEN];
|
||||||
} cmd_advertising_on_t;
|
} cmd_advertising_on_t;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#define MODEL_USB_MANUFACTURER "Trezor Company"
|
#define MODEL_USB_MANUFACTURER "Trezor Company"
|
||||||
#define MODEL_USB_PRODUCT MODEL_FULL_NAME
|
#define MODEL_USB_PRODUCT MODEL_FULL_NAME
|
||||||
#define MODEL_HOMESCREEN_MAXSIZE 65536
|
#define MODEL_HOMESCREEN_MAXSIZE 65536
|
||||||
|
#define MODEL_BLE_CODE 6
|
||||||
|
|
||||||
#define MODEL_BOARDLOADER_KEYS \
|
#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", \
|
(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", \
|
||||||
|
@ -65,7 +65,7 @@ void advertising_setup_wl(void) {
|
|||||||
bt_foreach_bond(BT_ID_DEFAULT, add_to_whitelist, NULL);
|
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) {
|
bool static_addr, char *name, int name_len) {
|
||||||
if (advertising) {
|
if (advertising) {
|
||||||
LOG_WRN("Restarting 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[3] = color;
|
||||||
manufacturer_data[4] = device_code & 0xff;
|
manufacturer_data[4] = device_code;
|
||||||
manufacturer_data[5] = (device_code >> 8) & 0xff;
|
|
||||||
manufacturer_data[6] = (device_code >> 16) & 0xff;
|
|
||||||
manufacturer_data[7] = (device_code >> 24) & 0xff;
|
|
||||||
|
|
||||||
advertising_data[0].type = BT_DATA_FLAGS;
|
advertising_data[0].type = BT_DATA_FLAGS;
|
||||||
advertising_data[0].data_len = 1;
|
advertising_data[0].data_len = 1;
|
||||||
|
@ -103,7 +103,7 @@ typedef struct {
|
|||||||
uint8_t whitelist;
|
uint8_t whitelist;
|
||||||
uint8_t color;
|
uint8_t color;
|
||||||
uint8_t static_addr;
|
uint8_t static_addr;
|
||||||
uint32_t device_code;
|
uint8_t device_code;
|
||||||
uint8_t name[BLE_ADV_NAME_LEN];
|
uint8_t name[BLE_ADV_NAME_LEN];
|
||||||
} cmd_advertising_on_t;
|
} cmd_advertising_on_t;
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ bool bonds_erase_current(void);
|
|||||||
// Initialization
|
// Initialization
|
||||||
void advertising_init(void);
|
void advertising_init(void);
|
||||||
// Start advertising, with or without whitelist
|
// 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);
|
bool static_addr, char *name, int name_len);
|
||||||
// Stop advertising
|
// Stop advertising
|
||||||
void advertising_stop(void);
|
void advertising_stop(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user