mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-30 08:20:21 +00:00
free message queue and nrfsniff updates
nrfsniff updates by mothball187 and ESurge
This commit is contained in:
parent
8527b7a8ed
commit
3d723679bd
8 changed files with 14 additions and 7 deletions
|
@ -412,6 +412,7 @@ int32_t barcode_UPCA_generator_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
||||||
FURI_LOG_E("barcode_UPCA_generator", "cannot create mutex\r\n");
|
FURI_LOG_E("barcode_UPCA_generator", "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(plugin_state);
|
free(plugin_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ int32_t clock_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, plugin_state, sizeof(ClockState))) {
|
if(!init_mutex(&state_mutex, plugin_state, sizeof(ClockState))) {
|
||||||
FURI_LOG_E(TAG, "cannot create mutex\r\n");
|
FURI_LOG_E(TAG, "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(plugin_state);
|
free(plugin_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,6 +229,7 @@ int32_t mousejacker_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
||||||
FURI_LOG_E("mousejacker", "cannot create mutex\r\n");
|
FURI_LOG_E("mousejacker", "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(plugin_state);
|
free(plugin_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ typedef struct {
|
||||||
char rate_text_fmt[] = "Transfer rate: %dMbps";
|
char rate_text_fmt[] = "Transfer rate: %dMbps";
|
||||||
char channel_text_fmt[] = "Channel: %d";
|
char channel_text_fmt[] = "Channel: %d";
|
||||||
char preamble_text_fmt[] = "Preamble: %02X";
|
char preamble_text_fmt[] = "Preamble: %02X";
|
||||||
char sniff_text_fmt[] = "Sniffing: %s";
|
char sniff_text_fmt[] = "Sniffing: %s Found: %d";
|
||||||
char addresses_header_text[] = "Address,rate";
|
char addresses_header_text[] = "Address,rate";
|
||||||
char sniffed_address_fmt[] = "%s,%d";
|
char sniffed_address_fmt[] = "%s,%d";
|
||||||
char rate_text[46];
|
char rate_text[46];
|
||||||
|
@ -44,6 +44,7 @@ char sniff_text[38];
|
||||||
char sniffed_address[14];
|
char sniffed_address[14];
|
||||||
|
|
||||||
uint8_t target_channel = 0;
|
uint8_t target_channel = 0;
|
||||||
|
uint32_t found_count = 0;
|
||||||
uint8_t target_rate = 8; // rate can be either 8 (2Mbps) or 0 (1Mbps)
|
uint8_t target_rate = 8; // rate can be either 8 (2Mbps) or 0 (1Mbps)
|
||||||
uint8_t target_preamble[] = {0xAA, 0x00};
|
uint8_t target_preamble[] = {0xAA, 0x00};
|
||||||
uint8_t sniffing_state = false;
|
uint8_t sniffing_state = false;
|
||||||
|
@ -128,7 +129,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
|
||||||
snprintf(rate_text, sizeof(rate_text), rate_text_fmt, (int)rate);
|
snprintf(rate_text, sizeof(rate_text), rate_text_fmt, (int)rate);
|
||||||
snprintf(channel_text, sizeof(channel_text), channel_text_fmt, (int)target_channel);
|
snprintf(channel_text, sizeof(channel_text), channel_text_fmt, (int)target_channel);
|
||||||
snprintf(preamble_text, sizeof(preamble_text), preamble_text_fmt, target_preamble[0]);
|
snprintf(preamble_text, sizeof(preamble_text), preamble_text_fmt, target_preamble[0]);
|
||||||
snprintf(sniff_text, sizeof(sniff_text), sniff_text_fmt, sniffing);
|
snprintf(sniff_text, sizeof(sniff_text), sniff_text_fmt, sniffing, found_count);
|
||||||
snprintf(
|
snprintf(
|
||||||
sniffed_address, sizeof(sniffed_address), sniffed_address_fmt, top_address, (int)rate);
|
sniffed_address, sizeof(sniffed_address), sniffed_address_fmt, top_address, (int)rate);
|
||||||
canvas_draw_str_aligned(canvas, 10, 10, AlignLeft, AlignBottom, rate_text);
|
canvas_draw_str_aligned(canvas, 10, 10, AlignLeft, AlignBottom, rate_text);
|
||||||
|
@ -289,6 +290,7 @@ static void wrap_up(Storage* storage, NotificationApp* notification) {
|
||||||
if(ch <= LOGITECH_MAX_CHANNEL) {
|
if(ch <= LOGITECH_MAX_CHANNEL) {
|
||||||
hexlify(addr, 5, top_address);
|
hexlify(addr, 5, top_address);
|
||||||
save_addr_to_file(storage, addr, 5, notification);
|
save_addr_to_file(storage, addr, 5, notification);
|
||||||
|
found_count++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,6 +312,7 @@ int32_t nrfsniff_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) {
|
||||||
FURI_LOG_E(TAG, "cannot create mutex\r\n");
|
FURI_LOG_E(TAG, "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(plugin_state);
|
free(plugin_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +329,6 @@ int32_t nrfsniff_app(void* p) {
|
||||||
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
|
||||||
|
|
||||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
||||||
furi_hal_power_suppress_charge_enter();
|
|
||||||
|
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
storage_common_mkdir(storage, NRFSNIFF_APP_PATH_FOLDER);
|
storage_common_mkdir(storage, NRFSNIFF_APP_PATH_FOLDER);
|
||||||
|
@ -375,6 +377,7 @@ int32_t nrfsniff_app(void* p) {
|
||||||
// toggle sniffing
|
// toggle sniffing
|
||||||
sniffing_state = !sniffing_state;
|
sniffing_state = !sniffing_state;
|
||||||
if(sniffing_state) {
|
if(sniffing_state) {
|
||||||
|
found_count = 0;
|
||||||
start_sniffing();
|
start_sniffing();
|
||||||
start = furi_get_tick();
|
start = furi_get_tick();
|
||||||
} else
|
} else
|
||||||
|
@ -422,7 +425,6 @@ int32_t nrfsniff_app(void* p) {
|
||||||
furi_hal_spi_release(nrf24_HANDLE);
|
furi_hal_spi_release(nrf24_HANDLE);
|
||||||
view_port_enabled_set(view_port, false);
|
view_port_enabled_set(view_port, false);
|
||||||
gui_remove_view_port(gui, view_port);
|
gui_remove_view_port(gui, view_port);
|
||||||
furi_hal_power_suppress_charge_exit();
|
|
||||||
furi_record_close(RECORD_GUI);
|
furi_record_close(RECORD_GUI);
|
||||||
furi_record_close(RECORD_NOTIFICATION);
|
furi_record_close(RECORD_NOTIFICATION);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
@ -430,4 +432,4 @@ int32_t nrfsniff_app(void* p) {
|
||||||
furi_message_queue_free(event_queue);
|
furi_message_queue_free(event_queue);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -92,6 +92,7 @@ int32_t sentry_safe_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, sentry_state, sizeof(SentryState))) {
|
if(!init_mutex(&state_mutex, sentry_state, sizeof(SentryState))) {
|
||||||
FURI_LOG_E("SentrySafe", "cannot create mutex\r\n");
|
FURI_LOG_E("SentrySafe", "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(sentry_state);
|
free(sentry_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +124,6 @@ int32_t sentry_safe_app(void* p) {
|
||||||
break;
|
break;
|
||||||
case InputKeyLeft:
|
case InputKeyLeft:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputKeyOk:
|
case InputKeyOk:
|
||||||
|
|
||||||
if(sentry_state->status == 2) {
|
if(sentry_state->status == 2) {
|
||||||
|
|
|
@ -311,6 +311,7 @@ int32_t snake_game_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, snake_state, sizeof(SnakeState))) {
|
if(!init_mutex(&state_mutex, snake_state, sizeof(SnakeState))) {
|
||||||
FURI_LOG_E("SnakeGame", "cannot create mutex\r\n");
|
FURI_LOG_E("SnakeGame", "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(snake_state);
|
free(snake_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,6 +354,7 @@ int32_t tetris_game_app() {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, tetris_state, sizeof(TetrisState))) {
|
if(!init_mutex(&state_mutex, tetris_state, sizeof(TetrisState))) {
|
||||||
FURI_LOG_E("TetrisGame", "cannot create mutex\r\n");
|
FURI_LOG_E("TetrisGame", "cannot create mutex\r\n");
|
||||||
|
furi_message_queue_free(event_queue);
|
||||||
free(tetris_state);
|
free(tetris_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,8 +310,8 @@ int32_t tictactoe_game_app(void* p) {
|
||||||
ValueMutex state_mutex;
|
ValueMutex state_mutex;
|
||||||
if(!init_mutex(&state_mutex, tictactoe_state, sizeof(TicTacToeState))) {
|
if(!init_mutex(&state_mutex, tictactoe_state, sizeof(TicTacToeState))) {
|
||||||
FURI_LOG_E(TAG, "Cannot create mutex\r\n");
|
FURI_LOG_E(TAG, "Cannot create mutex\r\n");
|
||||||
free(tictactoe_state);
|
|
||||||
furi_message_queue_free(event_queue);
|
furi_message_queue_free(event_queue);
|
||||||
|
free(tictactoe_state);
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue