|
@@ -13,7 +13,7 @@
|
|
|
#include "../type-code-common.h"
|
|
#include "../type-code-common.h"
|
|
|
#include "../../features_config.h"
|
|
#include "../../features_config.h"
|
|
|
|
|
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
#define TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH
|
|
#define TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN FURI_HAL_BT_ADV_NAME_LENGTH
|
|
|
#define TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE
|
|
#define TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN GAP_MAC_ADDR_SIZE
|
|
|
#endif
|
|
#endif
|
|
@@ -29,7 +29,7 @@ struct TotpBtTypeCodeWorkerContext {
|
|
|
Bt* bt;
|
|
Bt* bt;
|
|
|
bool is_advertising;
|
|
bool is_advertising;
|
|
|
bool is_connected;
|
|
bool is_connected;
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
char previous_bt_name[TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN];
|
|
char previous_bt_name[TOTP_BT_WORKER_BT_ADV_NAME_MAX_LEN];
|
|
|
uint8_t previous_bt_mac[TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN];
|
|
uint8_t previous_bt_mac[TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN];
|
|
|
#endif
|
|
#endif
|
|
@@ -39,7 +39,7 @@ static inline bool totp_type_code_worker_stop_requested() {
|
|
|
return furi_thread_flags_get() & TotpBtTypeCodeWorkerEventStop;
|
|
return furi_thread_flags_get() & TotpBtTypeCodeWorkerEventStop;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
static void totp_type_code_worker_bt_set_app_mac(uint8_t* mac) {
|
|
static void totp_type_code_worker_bt_set_app_mac(uint8_t* mac) {
|
|
|
uint8_t max_i;
|
|
uint8_t max_i;
|
|
|
size_t uid_size = furi_hal_version_uid_size();
|
|
size_t uid_size = furi_hal_version_uid_size();
|
|
@@ -49,7 +49,7 @@ static void totp_type_code_worker_bt_set_app_mac(uint8_t* mac) {
|
|
|
max_i = TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN;
|
|
max_i = TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const uint8_t* uid = furi_hal_version_uid();
|
|
|
|
|
|
|
+ const uint8_t* uid = (const uint8_t*)UID64_BASE;
|
|
|
memcpy(mac, uid, max_i);
|
|
memcpy(mac, uid, max_i);
|
|
|
for(uint8_t i = max_i; i < TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN; i++) {
|
|
for(uint8_t i = max_i; i < TOTP_BT_WORKER_BT_MAC_ADDRESS_LEN; i++) {
|
|
|
mac[i] = 0;
|
|
mac[i] = 0;
|
|
@@ -161,7 +161,7 @@ TotpBtTypeCodeWorkerContext* totp_bt_type_code_worker_init() {
|
|
|
furi_delay_ms(200);
|
|
furi_delay_ms(200);
|
|
|
bt_keys_storage_set_storage_path(context->bt, HID_BT_KEYS_STORAGE_PATH);
|
|
bt_keys_storage_set_storage_path(context->bt, HID_BT_KEYS_STORAGE_PATH);
|
|
|
|
|
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
memcpy(
|
|
memcpy(
|
|
|
&context->previous_bt_name[0],
|
|
&context->previous_bt_name[0],
|
|
|
furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard),
|
|
furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard),
|
|
@@ -184,7 +184,7 @@ TotpBtTypeCodeWorkerContext* totp_bt_type_code_worker_init() {
|
|
|
|
|
|
|
|
furi_hal_bt_start_advertising();
|
|
furi_hal_bt_start_advertising();
|
|
|
|
|
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
bt_enable_peer_key_update(context->bt);
|
|
bt_enable_peer_key_update(context->bt);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -211,7 +211,7 @@ void totp_bt_type_code_worker_free(TotpBtTypeCodeWorkerContext* context) {
|
|
|
furi_delay_ms(200);
|
|
furi_delay_ms(200);
|
|
|
bt_keys_storage_set_default_path(context->bt);
|
|
bt_keys_storage_set_default_path(context->bt);
|
|
|
|
|
|
|
|
-#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME
|
|
|
|
|
|
|
+#if TOTP_TARGET_FIRMWARE == TOTP_FIRMWARE_XTREME_UL
|
|
|
furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, context->previous_bt_name);
|
|
furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, context->previous_bt_name);
|
|
|
furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, context->previous_bt_mac);
|
|
furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, context->previous_bt_mac);
|
|
|
#endif
|
|
#endif
|