mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
BadKB fix MAC address byte order
This commit is contained in:
@@ -346,6 +346,7 @@ static bool ducky_set_bt_id(BadKbScript* bad_kb, const char* line) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
furi_hal_bt_reverse_mac_addr(cfg->bt_mac);
|
||||
|
||||
strlcpy(cfg->bt_name, line + mac_len, BAD_KB_NAME_LEN);
|
||||
FURI_LOG_D(WORKER_TAG, "set bt id: %s", line);
|
||||
|
||||
@@ -11,6 +11,7 @@ void bad_kb_scene_config_bt_mac_on_enter(void* context) {
|
||||
ByteInput* byte_input = bad_kb->byte_input;
|
||||
|
||||
memmove(bad_kb->bt_mac_buf, bad_kb->config.bt_mac, BAD_KB_MAC_LEN);
|
||||
furi_hal_bt_reverse_mac_addr(bad_kb->bt_mac_buf);
|
||||
byte_input_set_header_text(byte_input, "Set BT MAC address");
|
||||
|
||||
byte_input_set_result_callback(
|
||||
@@ -31,6 +32,7 @@ bool bad_kb_scene_config_bt_mac_on_event(void* context, SceneManagerEvent event)
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
consumed = true;
|
||||
if(event.event == BadKbAppCustomEventByteInputDone) {
|
||||
furi_hal_bt_reverse_mac_addr(bad_kb->bt_mac_buf);
|
||||
memmove(bad_kb->config.bt_mac, bad_kb->bt_mac_buf, BAD_KB_MAC_LEN);
|
||||
bad_kb_config_refresh(bad_kb);
|
||||
}
|
||||
|
||||
@@ -1117,6 +1117,7 @@ Function,+,furi_hal_bt_lock_core2,void,
|
||||
Function,+,furi_hal_bt_nvm_sram_sem_acquire,void,
|
||||
Function,+,furi_hal_bt_nvm_sram_sem_release,void,
|
||||
Function,+,furi_hal_bt_reinit,void,
|
||||
Function,+,furi_hal_bt_reverse_mac_addr,void,uint8_t[( 6 )]
|
||||
Function,+,furi_hal_bt_serial_notify_buffer_is_empty,void,
|
||||
Function,+,furi_hal_bt_serial_set_event_callback,void,"uint16_t, FuriHalBtSerialCallback, void*"
|
||||
Function,+,furi_hal_bt_serial_set_rpc_status,void,FuriHalBtSerialRpcStatus
|
||||
|
||||
|
@@ -461,6 +461,15 @@ uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi) {
|
||||
return since;
|
||||
}
|
||||
|
||||
void furi_hal_bt_reverse_mac_addr(uint8_t mac_addr[GAP_MAC_ADDR_SIZE]) {
|
||||
uint8_t tmp;
|
||||
for(size_t i = 0; i < GAP_MAC_ADDR_SIZE / 2; i++) {
|
||||
tmp = mac_addr[i];
|
||||
mac_addr[i] = mac_addr[GAP_MAC_ADDR_SIZE - 1 - i];
|
||||
mac_addr[GAP_MAC_ADDR_SIZE - 1 - i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void furi_hal_bt_set_profile_adv_name(
|
||||
FuriHalBtProfile profile,
|
||||
const char name[FURI_HAL_BT_ADV_NAME_LENGTH]) {
|
||||
|
||||
@@ -218,6 +218,11 @@ float furi_hal_bt_get_rssi();
|
||||
*/
|
||||
uint32_t furi_hal_bt_get_transmitted_packets();
|
||||
|
||||
/** Reverse a MAC address byte order in-place
|
||||
* @param[in] mac mac address to reverse
|
||||
*/
|
||||
void furi_hal_bt_reverse_mac_addr(uint8_t mac_addr[GAP_MAC_ADDR_SIZE]);
|
||||
|
||||
/** Modify profile advertisement name and restart bluetooth
|
||||
* @param[in] profile profile type
|
||||
* @param[in] name new adv name
|
||||
|
||||
Reference in New Issue
Block a user