mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-22 12:51:39 +03:00
merge manually formatted stuff too
This commit is contained in:
parent
a9f050f367
commit
57f3bce8e3
@ -4,7 +4,8 @@
|
||||
#include <cli/cli.h>
|
||||
#include <toolbox/args.h>
|
||||
|
||||
#define TAG "SpeakerDebug"
|
||||
#define TAG "SpeakerDebug"
|
||||
|
||||
#define CLI_COMMAND "speaker_debug"
|
||||
|
||||
typedef enum {
|
||||
|
@ -9,9 +9,10 @@
|
||||
#include <notification/notification.h>
|
||||
#include <notification/notification_messages.h>
|
||||
|
||||
#define TAG "UartEcho"
|
||||
|
||||
#define LINES_ON_SCREEN 6
|
||||
#define COLUMNS_ON_SCREEN 21
|
||||
#define TAG "UartEcho"
|
||||
#define DEFAULT_BAUD_RATE 230400
|
||||
|
||||
typedef struct UartDumpModel UartDumpModel;
|
||||
@ -147,7 +148,7 @@ static void uart_echo_push_to_list(UartDumpModel* model, const char data) {
|
||||
bool new_string_needed = false;
|
||||
if(furi_string_size(model->list[model->line]->text) >= COLUMNS_ON_SCREEN) {
|
||||
new_string_needed = true;
|
||||
} else if((data == '\n' || data == '\r')) {
|
||||
} else if(data == '\n' || data == '\r') {
|
||||
// pack line breaks
|
||||
if(model->last_char != '\n' && model->last_char != '\r') {
|
||||
new_string_needed = true;
|
||||
|
@ -42,7 +42,8 @@ typedef struct {
|
||||
|
||||
static RpcSessionContext rpc_session[TEST_RPC_SESSIONS];
|
||||
|
||||
#define TAG "UnitTestsRpc"
|
||||
#define TAG "UnitTestsRpc"
|
||||
|
||||
#define MAX_RECEIVE_OUTPUT_TIMEOUT 3000
|
||||
#define MAX_NAME_LENGTH 255
|
||||
#define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c
|
||||
@ -554,7 +555,7 @@ static bool test_rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_
|
||||
time_left = MAX(time_left, 0);
|
||||
bytes_received =
|
||||
furi_stream_buffer_receive(session_context->output_stream, buf, count, time_left);
|
||||
return (count == bytes_received);
|
||||
return count == bytes_received;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include <lib/subghz/devices/devices.h>
|
||||
#include <lib/subghz/devices/cc1101_configs.h>
|
||||
|
||||
#define TAG "SubGhzTest"
|
||||
#define TAG "SubGhzTest"
|
||||
|
||||
#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes")
|
||||
#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo")
|
||||
#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s")
|
||||
|
@ -390,7 +390,7 @@ bool subghz_device_cc1101_ext_is_rx_data_crc_valid(void) {
|
||||
cc1101_read_reg(
|
||||
subghz_device_cc1101_ext->spi_bus_handle, CC1101_STATUS_LQI | CC1101_BURST, data);
|
||||
furi_hal_spi_release(subghz_device_cc1101_ext->spi_bus_handle);
|
||||
if(((data[0] >> 7) & 0x01)) {
|
||||
if((data[0] >> 7) & 0x01) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -879,9 +879,8 @@ bool subghz_device_cc1101_ext_start_async_tx(SubGhzDeviceCC1101ExtCallback callb
|
||||
}
|
||||
|
||||
bool subghz_device_cc1101_ext_is_async_tx_complete(void) {
|
||||
return (
|
||||
(subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) &&
|
||||
(LL_TIM_GetAutoReload(TIM17) == 0));
|
||||
return (subghz_device_cc1101_ext->state == SubGhzDeviceCC1101ExtStateAsyncTx) &&
|
||||
(LL_TIM_GetAutoReload(TIM17) == 0);
|
||||
}
|
||||
|
||||
void subghz_device_cc1101_ext_stop_async_tx(void) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define TAG "ble_beacon_app"
|
||||
#define TAG "BleBeaconApp"
|
||||
|
||||
static bool ble_beacon_app_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
|
@ -344,7 +344,7 @@ bool archive_is_home(ArchiveBrowserView* browser) {
|
||||
}
|
||||
|
||||
const char* default_path = archive_get_default_path(archive_get_tab(browser));
|
||||
return (furi_string_cmp_str(browser->path, default_path) == 0);
|
||||
return furi_string_cmp_str(browser->path, default_path) == 0;
|
||||
}
|
||||
|
||||
const char* archive_get_name(ArchiveBrowserView* browser) {
|
||||
|
@ -67,7 +67,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) {
|
||||
}
|
||||
|
||||
inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
|
||||
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
|
||||
return type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown;
|
||||
}
|
||||
|
||||
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include "ducky_script_i.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#define TAG "BadUsb"
|
||||
#define TAG "BadUsb"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define BADUSB_ASCII_TO_KEY(script, x) \
|
||||
@ -46,7 +47,7 @@ uint32_t ducky_get_command_len(const char* line) {
|
||||
}
|
||||
|
||||
bool ducky_is_line_end(const char chr) {
|
||||
return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n'));
|
||||
return (chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n');
|
||||
}
|
||||
|
||||
uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) {
|
||||
@ -56,7 +57,7 @@ uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept
|
||||
}
|
||||
|
||||
if((accept_chars) && (strlen(param) > 0)) {
|
||||
return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF);
|
||||
return BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -309,7 +310,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur - 1U);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
return delay_val + bad_usb->defdelay;
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,7 +349,7 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %zu", bad_usb->st.line_cur);
|
||||
return SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
return (delay_val + bad_usb->defdelay);
|
||||
return delay_val + bad_usb->defdelay;
|
||||
}
|
||||
} else {
|
||||
furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]);
|
||||
|
@ -215,7 +215,8 @@ static const DuckyCmd ducky_commands[] = {
|
||||
{"GLOBE", ducky_fnc_globe, -1},
|
||||
};
|
||||
|
||||
#define TAG "BadUsb"
|
||||
#define TAG "BadUsb"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) {
|
||||
@ -231,7 +232,7 @@ int32_t ducky_execute_cmd(BadUsbScript* bad_usb, const char* line) {
|
||||
if(ducky_commands[i].callback == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return ((ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param));
|
||||
return (ducky_commands[i].callback)(bad_usb, line, ducky_commands[i].param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ static bool infrared_move_view_input_callback(InputEvent* event, void* context)
|
||||
|
||||
bool consumed = false;
|
||||
|
||||
if(((event->type == InputTypeShort || event->type == InputTypeRepeat)) &&
|
||||
if((event->type == InputTypeShort || event->type == InputTypeRepeat) &&
|
||||
((event->key == InputKeyUp) || (event->key == InputKeyDown))) {
|
||||
with_view_model(
|
||||
move_view->view,
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "HI!"
|
||||
#define TAG "HI!"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define HI_KEY_TO_GEN 5
|
||||
#define UID_LENGTH 7
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "Microel"
|
||||
#define TAG "Microel"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define UID_LENGTH 4
|
||||
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "MiZIP"
|
||||
#define TAG "MiZIP"
|
||||
|
||||
#define KEY_LENGTH 6
|
||||
#define MIZIP_KEY_TO_GEN 5
|
||||
#define UID_LENGTH 4
|
||||
|
@ -9,7 +9,8 @@
|
||||
|
||||
#include <bit_lib.h>
|
||||
|
||||
#define TAG "Saflok"
|
||||
#define TAG "Saflok"
|
||||
|
||||
#define MAGIC_TABLE_SIZE 192
|
||||
#define KEY_LENGTH 6
|
||||
#define UID_LENGTH 4
|
||||
|
@ -38,7 +38,7 @@ bool parse_datetime(uint16_t date, DateTime* result) {
|
||||
result->year = 2000 + (date >> 9);
|
||||
result->month = date >> 5 & 0x0F;
|
||||
result->day = date & 0x1F;
|
||||
return (date != 0);
|
||||
return date != 0;
|
||||
}
|
||||
|
||||
static bool umarsh_parse(const NfcDevice* device, FuriString* parsed_data) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "subghz_chat.h"
|
||||
#include <lib/subghz/subghz_tx_rx_worker.h>
|
||||
|
||||
#define TAG "SubGhzChat"
|
||||
#define TAG "SubGhzChat"
|
||||
|
||||
#define SUBGHZ_CHAT_WORKER_TIMEOUT_BETWEEN_MESSAGES 500
|
||||
|
||||
struct SubGhzChatWorker {
|
||||
|
@ -2,7 +2,8 @@
|
||||
#include <float_tools.h>
|
||||
#include "../subghz_i.h"
|
||||
|
||||
#define TAG "SubGhzThresholdRssi"
|
||||
#define TAG "SubGhzThresholdRssi"
|
||||
|
||||
#define THRESHOLD_RSSI_LOW_COUNT 10
|
||||
|
||||
struct SubGhzThresholdRssi {
|
||||
|
@ -528,22 +528,19 @@ SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) {
|
||||
|
||||
bool subghz_txrx_protocol_is_serializable(SubGhzTxRx* instance) {
|
||||
furi_assert(instance);
|
||||
return (
|
||||
(instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
SubGhzProtocolFlag_Save);
|
||||
return (instance->decoder_result->protocol->flag & SubGhzProtocolFlag_Save) ==
|
||||
SubGhzProtocolFlag_Save;
|
||||
}
|
||||
|
||||
bool subghz_txrx_protocol_is_transmittable(SubGhzTxRx* instance, bool check_type) {
|
||||
furi_assert(instance);
|
||||
const SubGhzProtocol* protocol = instance->decoder_result->protocol;
|
||||
if(check_type) {
|
||||
return (
|
||||
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic);
|
||||
return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize && protocol->type == SubGhzProtocolTypeStatic;
|
||||
}
|
||||
return (
|
||||
((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize);
|
||||
return ((protocol->flag & SubGhzProtocolFlag_Send) == SubGhzProtocolFlag_Send) &&
|
||||
protocol->encoder->deserialize;
|
||||
}
|
||||
|
||||
void subghz_txrx_receiver_set_filter(SubGhzTxRx* instance, SubGhzProtocolFlag filter) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "../subghz_i.h"
|
||||
|
||||
#define TAG "SubGhzDecodeRaw"
|
||||
#define TAG "SubGhzDecodeRaw"
|
||||
|
||||
#define SAMPLES_TO_READ_PER_TICK 400
|
||||
|
||||
static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
|
@ -414,7 +414,7 @@ void subghz_unlock(SubGhz* subghz) {
|
||||
|
||||
bool subghz_is_locked(SubGhz* subghz) {
|
||||
furi_assert(subghz);
|
||||
return (subghz->lock == SubGhzLockOn);
|
||||
return subghz->lock == SubGhzLockOn;
|
||||
}
|
||||
|
||||
void subghz_rx_key_state_set(SubGhz* subghz, SubGhzRxKeyState state) {
|
||||
|
@ -186,7 +186,7 @@ void subghz_view_receiver_add_item_to_menu(
|
||||
item_menu->time = furi_string_alloc_set(time);
|
||||
item_menu->item_str = furi_string_alloc_set(name);
|
||||
item_menu->type = type;
|
||||
if((model->idx == model->history_item - 1)) {
|
||||
if(model->idx == model->history_item - 1) {
|
||||
model->history_item++;
|
||||
model->idx++;
|
||||
subghz_view_receiver_show_time_moment(subghz_receiver);
|
||||
|
@ -11,7 +11,8 @@
|
||||
#include <mbedtls/ecdsa.h>
|
||||
#include <mbedtls/error.h>
|
||||
|
||||
#define TAG "U2f"
|
||||
#define TAG "U2f"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define MCHECK(expr) furi_check((expr) == 0)
|
||||
@ -315,7 +316,7 @@ static uint16_t u2f_register(U2fData* U2F, uint8_t* buf) {
|
||||
uint8_t signature_len = u2f_der_encode_signature(resp->cert + cert_len, signature);
|
||||
memcpy(resp->cert + cert_len + signature_len, state_no_error, 2);
|
||||
|
||||
return (sizeof(U2fRegisterResp) + cert_len + signature_len + 2);
|
||||
return sizeof(U2fRegisterResp) + cert_len + signature_len + 2;
|
||||
}
|
||||
|
||||
static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) {
|
||||
@ -410,7 +411,7 @@ static uint16_t u2f_authenticate(U2fData* U2F, uint8_t* buf) {
|
||||
|
||||
if(U2F->callback != NULL) U2F->callback(U2fNotifyAuthSuccess, U2F->context);
|
||||
|
||||
return (sizeof(U2fAuthResp) + signature_len + 2);
|
||||
return sizeof(U2fAuthResp) + signature_len + 2;
|
||||
}
|
||||
|
||||
uint16_t u2f_msg_parse(U2fData* U2F, uint8_t* buf, uint16_t len) {
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <furi_hal_usb_hid_u2f.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAG "U2fHid"
|
||||
#define TAG "U2fHid"
|
||||
|
||||
#define WORKER_TAG TAG "Worker"
|
||||
|
||||
#define U2F_HID_MAX_PAYLOAD_LEN ((HID_U2F_PACKET_LEN - 7) + 128 * (HID_U2F_PACKET_LEN - 5))
|
||||
|
@ -79,7 +79,7 @@ size_t cli_read_timeout(Cli* cli, uint8_t* buffer, size_t size, uint32_t timeout
|
||||
bool cli_is_connected(Cli* cli) {
|
||||
furi_check(cli);
|
||||
if(cli->session != NULL) {
|
||||
return (cli->session->is_connected());
|
||||
return cli->session->is_connected();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo
|
||||
if(is_folder) {
|
||||
// Skip assets folders (if enabled)
|
||||
if(browser->skip_assets) {
|
||||
return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true));
|
||||
return (furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -303,7 +303,7 @@ static bool browser_folder_load_chunked(
|
||||
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return (items_cnt == count);
|
||||
return items_cnt == count;
|
||||
}
|
||||
|
||||
// Load all files at once, may cause memory overflow so need to limit that to about 400 files
|
||||
@ -571,7 +571,7 @@ void file_browser_worker_folder_enter(BrowserWorker* browser, FuriString* path,
|
||||
|
||||
bool file_browser_worker_is_in_start_folder(BrowserWorker* browser) {
|
||||
furi_check(browser);
|
||||
return (furi_string_cmp(browser->path_start, browser->path_current) == 0);
|
||||
return furi_string_cmp(browser->path_start, browser->path_current) == 0;
|
||||
}
|
||||
|
||||
void file_browser_worker_folder_exit(BrowserWorker* browser) {
|
||||
|
@ -157,7 +157,7 @@ void menu_free(Menu* menu) {
|
||||
|
||||
View* menu_get_view(Menu* menu) {
|
||||
furi_check(menu);
|
||||
return (menu->view);
|
||||
return menu->view;
|
||||
}
|
||||
|
||||
void menu_add_item(
|
||||
|
@ -136,7 +136,7 @@ static char get_selected_char(TextInputModel* model) {
|
||||
}
|
||||
|
||||
static bool char_is_lowercase(char letter) {
|
||||
return (letter >= 0x61 && letter <= 0x7A);
|
||||
return letter >= 0x61 && letter <= 0x7A;
|
||||
}
|
||||
|
||||
static char char_to_uppercase(const char letter) {
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
|
||||
#define TAG "Loader"
|
||||
#define TAG "Loader"
|
||||
|
||||
#define LOADER_MAGIC_THREAD_VALUE 0xDEADBEEF
|
||||
|
||||
// helpers
|
||||
|
@ -31,7 +31,7 @@ float locale_fahrenheit_to_celsius(float temp_f) {
|
||||
}
|
||||
|
||||
float locale_celsius_to_fahrenheit(float temp_c) {
|
||||
return (temp_c * 1.8f + 32.f);
|
||||
return temp_c * 1.8f + 32.f;
|
||||
}
|
||||
|
||||
void locale_format_time(
|
||||
|
@ -143,17 +143,16 @@ static void notification_apply_notification_leds(NotificationApp* app, const uin
|
||||
|
||||
// settings
|
||||
uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.display_brightness);
|
||||
return value * app->settings.display_brightness;
|
||||
}
|
||||
|
||||
static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value) {
|
||||
return (value * app->settings.led_brightness);
|
||||
return value * app->settings.led_brightness;
|
||||
}
|
||||
|
||||
static uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) {
|
||||
return (
|
||||
(float)(app->settings.display_off_delay_ms) /
|
||||
(1000.0f / furi_kernel_get_tick_frequency()));
|
||||
return (float)(app->settings.display_off_delay_ms) /
|
||||
(1000.0f / furi_kernel_get_tick_frequency());
|
||||
}
|
||||
|
||||
// generics
|
||||
|
@ -232,7 +232,7 @@ bool rpc_pb_stream_read(pb_istream_t* istream, pb_byte_t* buf, size_t count) {
|
||||
rpc_debug_print_data("INPUT", buf, bytes_received);
|
||||
#endif
|
||||
|
||||
return (count == bytes_received);
|
||||
return count == bytes_received;
|
||||
}
|
||||
|
||||
static bool rpc_pb_content_callback(pb_istream_t* stream, const pb_field_t* field, void** arg) {
|
||||
|
@ -40,5 +40,5 @@ const char* filesystem_api_error_get_desc(FS_Error error_id) {
|
||||
|
||||
bool file_info_is_dir(const FileInfo* file_info) {
|
||||
furi_check(file_info);
|
||||
return (file_info->flags & FSF_DIRECTORY);
|
||||
return file_info->flags & FSF_DIRECTORY;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ static void storage_cli_write(Cli* cli, FuriString* path, FuriString* args) {
|
||||
fflush(stdout);
|
||||
read_index++;
|
||||
|
||||
if(((read_index % buffer_size) == 0)) {
|
||||
if((read_index % buffer_size) == 0) {
|
||||
size_t written_size = storage_file_write(file, buffer, buffer_size);
|
||||
|
||||
if(written_size != buffer_size) {
|
||||
|
@ -929,12 +929,12 @@ File* storage_file_alloc(Storage* storage) {
|
||||
|
||||
bool storage_file_is_open(File* file) {
|
||||
furi_check(file);
|
||||
return (file->type != FileTypeClosed);
|
||||
return file->type != FileTypeClosed;
|
||||
}
|
||||
|
||||
bool storage_file_is_dir(File* file) {
|
||||
furi_check(file);
|
||||
return (file->type == FileTypeOpenDir);
|
||||
return file->type == FileTypeOpenDir;
|
||||
}
|
||||
|
||||
void storage_file_free(File* file) {
|
||||
|
@ -337,7 +337,7 @@ static bool storage_ext_file_open(
|
||||
|
||||
file->internal_error_id = f_open(file_data, path, _mode);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_file_close(void* ctx, File* file) {
|
||||
@ -347,7 +347,7 @@ static bool storage_ext_file_close(void* ctx, File* file) {
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
free(file_data);
|
||||
storage_set_storage_file_data(file, NULL, storage);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
@ -392,7 +392,7 @@ static bool
|
||||
}
|
||||
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_ext_file_tell(void* ctx, File* file) {
|
||||
@ -416,7 +416,7 @@ static bool storage_ext_file_truncate(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_truncate(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ static bool storage_ext_file_sync(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_sync(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -464,7 +464,7 @@ static bool storage_ext_dir_open(void* ctx, File* file, const char* path) {
|
||||
storage_set_storage_file_data(file, file_data, storage);
|
||||
file->internal_error_id = f_opendir(file_data, path);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_close(void* ctx, File* file) {
|
||||
@ -474,7 +474,7 @@ static bool storage_ext_dir_close(void* ctx, File* file) {
|
||||
file->internal_error_id = f_closedir(file_data);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
free(file_data);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_read(
|
||||
@ -505,7 +505,7 @@ static bool storage_ext_dir_read(
|
||||
file->error_id = FSE_NOT_EXIST;
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_ext_dir_rewind(void* ctx, File* file) {
|
||||
@ -514,7 +514,7 @@ static bool storage_ext_dir_rewind(void* ctx, File* file) {
|
||||
|
||||
file->internal_error_id = f_readdir(file_data, NULL);
|
||||
file->error_id = storage_ext_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
/******************* Common FS Functions *******************/
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <furi_hal.h>
|
||||
#include <toolbox/path.h>
|
||||
|
||||
#define TAG "StorageInt"
|
||||
#define TAG "StorageInt"
|
||||
|
||||
#define STORAGE_PATH STORAGE_INT_PATH_PREFIX
|
||||
#define LFS_CLEAN_FINGERPRINT 0
|
||||
|
||||
@ -287,7 +288,7 @@ static bool storage_int_check_for_free_space(StorageData* storage) {
|
||||
lfs_size_t free_space =
|
||||
(lfs_data->config.block_count - result) * lfs_data->config.block_size;
|
||||
|
||||
return (free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size());
|
||||
return free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size();
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -344,7 +345,7 @@ static bool storage_int_file_open(
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_file_close(void* ctx, File* file) {
|
||||
@ -360,7 +361,7 @@ static bool storage_int_file_close(void* ctx, File* file) {
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
lfs_handle_free(handle);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
@ -430,7 +431,7 @@ static bool
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_int_file_tell(void* ctx, File* file) {
|
||||
@ -475,7 +476,7 @@ static bool storage_int_file_truncate(void* ctx, File* file) {
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_file_sync(void* ctx, File* file) {
|
||||
@ -490,7 +491,7 @@ static bool storage_int_file_sync(void* ctx, File* file) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static uint64_t storage_int_file_size(void* ctx, File* file) {
|
||||
@ -557,7 +558,7 @@ static bool storage_int_dir_open(void* ctx, File* file, const char* path) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_close(void* ctx, File* file) {
|
||||
@ -573,7 +574,7 @@ static bool storage_int_dir_close(void* ctx, File* file) {
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
lfs_handle_free(handle);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_read(
|
||||
@ -614,7 +615,7 @@ static bool storage_int_dir_read(
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
}
|
||||
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
static bool storage_int_dir_rewind(void* ctx, File* file) {
|
||||
@ -629,7 +630,7 @@ static bool storage_int_dir_rewind(void* ctx, File* file) {
|
||||
}
|
||||
|
||||
file->error_id = storage_int_parse_error(file->internal_error_id);
|
||||
return (file->error_id == FSE_OK);
|
||||
return file->error_id == FSE_OK;
|
||||
}
|
||||
|
||||
/******************* Common FS Functions *******************/
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
#include "hid_icons.h"
|
||||
|
||||
#define TAG "HidMouseClicker"
|
||||
#define TAG "HidMouseClicker"
|
||||
|
||||
#define DEFAULT_CLICK_RATE 1
|
||||
#define MAXIMUM_CLICK_RATE 60
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include "../js_modules.h"
|
||||
#include <m-array.h>
|
||||
|
||||
#define TAG "js_serial"
|
||||
#define TAG "JsSerial"
|
||||
|
||||
#define RX_BUF_LEN 2048
|
||||
|
||||
typedef struct {
|
||||
@ -529,14 +530,14 @@ static int32_t js_serial_expect_check_pattern_start(
|
||||
int32_t pattern_last) {
|
||||
size_t array_len = PatternArray_size(patterns);
|
||||
if((pattern_last + 1) >= (int32_t)array_len) {
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
for(size_t i = pattern_last + 1; i < array_len; i++) {
|
||||
if(PatternArray_get(patterns, i)->data[0] == value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return (-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void js_serial_expect(struct mjs* mjs) {
|
||||
|
@ -18,7 +18,7 @@ static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo,
|
||||
return true;
|
||||
}
|
||||
|
||||
return (name && (*name != '.'));
|
||||
return name && (*name != '.');
|
||||
}
|
||||
|
||||
static void storage_move_to_sd_remove_region() {
|
||||
|
@ -36,7 +36,7 @@ static bool page_task_compare_flash(
|
||||
const uint8_t* update_block,
|
||||
uint16_t update_block_len) {
|
||||
const size_t page_addr = furi_hal_flash_get_base() + furi_hal_flash_get_page_size() * i_page;
|
||||
return (memcmp(update_block, (void*)page_addr, update_block_len) == 0);
|
||||
return memcmp(update_block, (void*)page_addr, update_block_len) == 0;
|
||||
}
|
||||
|
||||
/* Verifies a flash operation address for fitting into writable memory
|
||||
@ -44,7 +44,7 @@ static bool page_task_compare_flash(
|
||||
static bool check_address_boundaries(const size_t address) {
|
||||
const size_t min_allowed_address = furi_hal_flash_get_base();
|
||||
const size_t max_allowed_address = (size_t)furi_hal_flash_get_free_end_address();
|
||||
return ((address >= min_allowed_address) && (address < max_allowed_address));
|
||||
return (address >= min_allowed_address) && (address < max_allowed_address);
|
||||
}
|
||||
|
||||
static bool update_task_flash_program_page(
|
||||
|
@ -29,7 +29,7 @@ bool furi_kernel_is_irq_or_masked(void) {
|
||||
}
|
||||
|
||||
/* Return context, 0: thread context, 1: IRQ context */
|
||||
return (irq);
|
||||
return irq;
|
||||
}
|
||||
|
||||
bool furi_kernel_is_running(void) {
|
||||
@ -58,7 +58,7 @@ int32_t furi_kernel_lock(void) {
|
||||
}
|
||||
|
||||
/* Return previous lock state */
|
||||
return (lock);
|
||||
return lock;
|
||||
}
|
||||
|
||||
int32_t furi_kernel_unlock(void) {
|
||||
@ -88,7 +88,7 @@ int32_t furi_kernel_unlock(void) {
|
||||
}
|
||||
|
||||
/* Return previous lock state */
|
||||
return (lock);
|
||||
return lock;
|
||||
}
|
||||
|
||||
int32_t furi_kernel_restore_lock(int32_t lock) {
|
||||
@ -119,12 +119,12 @@ int32_t furi_kernel_restore_lock(int32_t lock) {
|
||||
}
|
||||
|
||||
/* Return new lock state */
|
||||
return (lock);
|
||||
return lock;
|
||||
}
|
||||
|
||||
uint32_t furi_kernel_get_tick_frequency(void) {
|
||||
/* Return frequency in hertz */
|
||||
return (configTICK_RATE_HZ_RAW);
|
||||
return configTICK_RATE_HZ_RAW;
|
||||
}
|
||||
|
||||
void furi_delay_tick(uint32_t ticks) {
|
||||
@ -160,7 +160,7 @@ FuriStatus furi_delay_until_tick(uint32_t tick) {
|
||||
}
|
||||
|
||||
/* Return execution status */
|
||||
return (stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
uint32_t furi_get_tick(void) {
|
||||
|
@ -528,7 +528,7 @@ void vPortFree(void* pv) {
|
||||
xFreeBytesRemaining += pxLink->xBlockSize;
|
||||
traceFREE(pv, pxLink->xBlockSize);
|
||||
memset(pv, 0, pxLink->xBlockSize - xHeapStructSize);
|
||||
prvInsertBlockIntoFreeList(((BlockLink_t*)pxLink));
|
||||
prvInsertBlockIntoFreeList((BlockLink_t*)pxLink);
|
||||
}
|
||||
(void)xTaskResumeAll();
|
||||
} else {
|
||||
|
@ -106,7 +106,7 @@ bool furi_stream_buffer_is_full(FuriStreamBuffer* stream_buffer) {
|
||||
bool furi_stream_buffer_is_empty(FuriStreamBuffer* stream_buffer) {
|
||||
furi_check(stream_buffer);
|
||||
|
||||
return (xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE);
|
||||
return xStreamBufferIsEmpty((StreamBufferHandle_t)stream_buffer) == pdTRUE;
|
||||
}
|
||||
|
||||
FuriStatus furi_stream_buffer_reset(FuriStreamBuffer* stream_buffer) {
|
||||
|
@ -253,5 +253,5 @@ bool st25r3916_check_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t mask,
|
||||
|
||||
uint8_t reg_val = 0;
|
||||
st25r3916_read_reg(handle, reg, ®_val);
|
||||
return ((reg_val & mask) == val);
|
||||
return (reg_val & mask) == val;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ bool lfrfid_raw_file_write_header(
|
||||
.max_buffer_size = max_buffer_size};
|
||||
|
||||
size_t size = stream_write(file->stream, (uint8_t*)&header, sizeof(LFRFIDRawFileHeader));
|
||||
return (size == sizeof(LFRFIDRawFileHeader));
|
||||
return size == sizeof(LFRFIDRawFileHeader);
|
||||
}
|
||||
|
||||
bool lfrfid_raw_file_write_buffer(LFRFIDRawFile* file, uint8_t* buffer_data, size_t buffer_size) {
|
||||
|
@ -155,7 +155,7 @@ void lfrfid_worker_stop_thread(LFRFIDWorker* worker) {
|
||||
bool lfrfid_worker_check_for_stop(LFRFIDWorker* worker) {
|
||||
UNUSED(worker);
|
||||
uint32_t flags = furi_thread_flags_get();
|
||||
return (flags & LFRFIDEventStopMode);
|
||||
return flags & LFRFIDEventStopMode;
|
||||
}
|
||||
|
||||
size_t lfrfid_worker_dict_get_data_size(LFRFIDWorker* worker, LFRFIDProtocol protocol) {
|
||||
|
@ -198,7 +198,7 @@ static bool electra_can_be_decoded(
|
||||
parity_sum += (*base_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ static bool electra_can_be_decoded(
|
||||
parity_sum += (*base_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"Unexpected column parity found. EM4100 data: %016llX",
|
||||
|
@ -173,7 +173,7 @@ static bool em4100_can_be_decoded(
|
||||
parity_sum += (*card_data >> (EM_FIRST_ROW_POS - i * EM_BITS_PER_ROW_COUNT + j)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ static bool em4100_can_be_decoded(
|
||||
parity_sum += (*card_data >> (EM_COLUMN_POS - i + j * EM_BITS_PER_ROW_COUNT)) & 1;
|
||||
}
|
||||
|
||||
if((parity_sum % 2)) {
|
||||
if(parity_sum % 2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static bool protocol_fdx_a_can_be_decoded(const uint8_t* data) {
|
||||
decoded_data[i] &= 0x7F;
|
||||
}
|
||||
|
||||
return (parity_sum == 0);
|
||||
return parity_sum == 0;
|
||||
}
|
||||
|
||||
bool protocol_fdx_a_decoder_feed(ProtocolFDXA* protocol, bool level, uint32_t duration) {
|
||||
|
@ -71,7 +71,7 @@ static bool protocol_nexwatch_check_preamble(uint8_t* data, size_t bit_index) {
|
||||
}
|
||||
|
||||
static uint8_t protocol_nexwatch_parity_swap(uint8_t parity) {
|
||||
uint8_t a = (((parity >> 3) & 1));
|
||||
uint8_t a = ((parity >> 3) & 1);
|
||||
a |= (((parity >> 1) & 1) << 1);
|
||||
a |= (((parity >> 2) & 1) << 2);
|
||||
a |= ((parity & 1) << 3);
|
||||
|
@ -10,7 +10,8 @@
|
||||
#include "lfrfid_protocols.h"
|
||||
#include <toolbox/manchester_decoder.h>
|
||||
|
||||
#define TAG "SECURAKEY"
|
||||
#define TAG "SECURAKEY"
|
||||
|
||||
#define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BITS (96)
|
||||
#define SECURAKEY_RKKT_ENCODED_FULL_SIZE_BYTE (12)
|
||||
|
||||
|
@ -45,7 +45,7 @@ bool felica_crc_check(const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = felica_crc_calculate(data, data_size - FELICA_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void felica_crc_trim(BitBuffer* buf) {
|
||||
|
@ -55,7 +55,7 @@ bool iso13239_crc_check(Iso13239CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso13239_crc_calculate(type, data, data_size - ISO13239_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso13239_crc_trim(BitBuffer* buf) {
|
||||
|
@ -50,7 +50,7 @@ bool iso14443_crc_check(Iso14443CrcType type, const BitBuffer* buf) {
|
||||
const uint8_t* data = bit_buffer_get_data(buf);
|
||||
const uint16_t crc_calc = iso14443_crc_calculate(type, data, data_size - ISO14443_CRC_SIZE);
|
||||
|
||||
return (crc_calc == crc_received);
|
||||
return crc_calc == crc_received;
|
||||
}
|
||||
|
||||
void iso14443_crc_trim(BitBuffer* buf) {
|
||||
|
@ -17,7 +17,7 @@ uint8_t nfc_util_even_parity32(uint32_t data) {
|
||||
// data ^= data >> 16;
|
||||
// data ^= data >> 8;
|
||||
// return !nfc_util_odd_byte_parity[data];
|
||||
return (__builtin_parity(data) & 0xFF);
|
||||
return __builtin_parity(data) & 0xFF;
|
||||
}
|
||||
|
||||
uint8_t nfc_util_odd_parity8(uint8_t data) {
|
||||
|
@ -39,10 +39,9 @@ static uint32_t felica_wcnt_get_max_value(const FelicaData* data) {
|
||||
|
||||
static bool felica_wcnt_check_warning_boundary(const FelicaData* data) {
|
||||
const uint32_t* wcnt_ptr = (uint32_t*)data->data.fs.wcnt.data;
|
||||
return (
|
||||
FELICA_SYSTEM_BLOCK_RO_ACCESS(data) &&
|
||||
((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) &&
|
||||
(*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE)));
|
||||
return FELICA_SYSTEM_BLOCK_RO_ACCESS(data) &&
|
||||
((*wcnt_ptr > FELICA_WCNT_MC2_00_WARNING_BEGIN_VALUE) &&
|
||||
(*wcnt_ptr < FELICA_WCNT_MC2_00_WARNING_END_VALUE));
|
||||
}
|
||||
|
||||
static bool felica_wcnt_check_error_boundary(const FelicaData* data) {
|
||||
@ -138,7 +137,7 @@ static bool felica_listener_check_write_request_data_size(
|
||||
uint8_t possible_data_size = fact_item_cnt * FELICA_DATA_BLOCK_SIZE;
|
||||
uint8_t fact_data_size =
|
||||
request->base.length - sizeof(FelicaListenerGenericRequest) - instance->block_list_size;
|
||||
return (possible_data_size <= fact_data_size);
|
||||
return possible_data_size <= fact_data_size;
|
||||
}
|
||||
|
||||
static bool felica_listener_test_block_list_size_bounds(const FelicaListenerGenericRequest* req) {
|
||||
|
@ -546,7 +546,7 @@ void mf_classic_set_key_not_found(
|
||||
bool mf_classic_is_block_read(const MfClassicData* data, uint8_t block_num) {
|
||||
furi_check(data);
|
||||
|
||||
return (FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1);
|
||||
return FURI_BIT(data->block_read_mask[block_num / 32], block_num % 32) == 1;
|
||||
}
|
||||
|
||||
void mf_classic_set_block_read(MfClassicData* data, uint8_t block_num, MfClassicBlock* block_data) {
|
||||
@ -661,22 +661,20 @@ static bool mf_classic_is_allowed_access_sector_trailer(
|
||||
}
|
||||
case MfClassicActionKeyAWrite:
|
||||
case MfClassicActionKeyBWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x03 || AC == 0x01));
|
||||
}
|
||||
case MfClassicActionKeyBRead: {
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x02 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x02 || AC == 0x01));
|
||||
}
|
||||
case MfClassicActionACRead: {
|
||||
return ((key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB));
|
||||
return (key_type == MfClassicKeyTypeA) || (key_type == MfClassicKeyTypeB);
|
||||
}
|
||||
case MfClassicActionACWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x01 || AC == 0x03 || AC == 0x05));
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
@ -727,25 +725,21 @@ bool mf_classic_is_allowed_access_data_block(
|
||||
|
||||
switch(action) {
|
||||
case MfClassicActionDataRead: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) ||
|
||||
(key_type == MfClassicKeyTypeB && !(AC == 0x07)));
|
||||
return (key_type == MfClassicKeyTypeA && !(AC == 0x03 || AC == 0x05 || AC == 0x07)) ||
|
||||
(key_type == MfClassicKeyTypeB && !(AC == 0x07));
|
||||
}
|
||||
case MfClassicActionDataWrite: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB &&
|
||||
(AC == 0x00 || AC == 0x04 || AC == 0x06 || AC == 0x03));
|
||||
}
|
||||
case MfClassicActionDataInc: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06));
|
||||
}
|
||||
case MfClassicActionDataDec: {
|
||||
return (
|
||||
(key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01)));
|
||||
return (key_type == MfClassicKeyTypeA && (AC == 0x00 || AC == 0x06 || AC == 0x01)) ||
|
||||
(key_type == MfClassicKeyTypeB && (AC == 0x00 || AC == 0x06 || AC == 0x01));
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
|
@ -197,7 +197,7 @@ static bool mf_plus_poller_detect(NfcGenericEvent event, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
return (error == MfPlusErrorNone);
|
||||
return error == MfPlusErrorNone;
|
||||
}
|
||||
|
||||
const NfcPollerBase mf_plus_poller = {
|
||||
|
@ -598,7 +598,7 @@ uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) {
|
||||
bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page) {
|
||||
uint8_t pwd_page = mf_ultralight_get_pwd_page_num(type);
|
||||
uint8_t pack_page = pwd_page + 1;
|
||||
return ((pwd_page != 0) && (page == pwd_page || page == pack_page));
|
||||
return (pwd_page != 0) && (page == pwd_page || page == pack_page);
|
||||
}
|
||||
|
||||
bool mf_ultralight_support_feature(const uint32_t feature_set, const uint32_t features_to_check) {
|
||||
|
@ -125,7 +125,7 @@ static uint8_t mf_ultralight_get_mirror_data_size(MfUltralightMirrorConf mode) {
|
||||
|
||||
static uint8_t mf_ultralight_get_mirror_last_page(MfUltralightListener* instance) {
|
||||
uint8_t strSize = mf_ultralight_get_mirror_data_size(instance->mirror.actual_mode);
|
||||
return (instance->config->mirror_page + 1U + strSize / 4);
|
||||
return instance->config->mirror_page + 1U + strSize / 4;
|
||||
}
|
||||
|
||||
static uint8_t mf_ultralight_get_ascii_offset(uint8_t start_page, MfUltralightListener* instance) {
|
||||
@ -207,7 +207,7 @@ void mf_ultraligt_mirror_format_counter(MfUltralightListener* instance) {
|
||||
}
|
||||
|
||||
bool mf_ultralight_composite_command_in_progress(MfUltralightListener* instance) {
|
||||
return (instance->composite_cmd.callback != NULL);
|
||||
return instance->composite_cmd.callback != NULL;
|
||||
}
|
||||
|
||||
MfUltralightCommand
|
||||
@ -550,7 +550,7 @@ static bool mf_ultralight_auth_check_attempts(const MfUltralightListener* instan
|
||||
(1U << instance->config->access.authlim) :
|
||||
instance->config->access.authlim;
|
||||
|
||||
return (instance->data->auth_attempts >= authlim);
|
||||
return instance->data->auth_attempts >= authlim;
|
||||
}
|
||||
|
||||
bool mf_ultralight_auth_limit_check_and_update(MfUltralightListener* instance, bool auth_success) {
|
||||
|
@ -150,7 +150,7 @@ static inline bool onewire_slave_receive_and_process_command(OneWireSlave* bus)
|
||||
}
|
||||
}
|
||||
|
||||
return (bus->error == OneWireSlaveErrorResetInProgress);
|
||||
return bus->error == OneWireSlaveErrorResetInProgress;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -131,7 +131,7 @@ static uint16_t subghz_protocol_bin_raw_get_full_byte(uint16_t bit_count) {
|
||||
if(bit_count & 0x7) {
|
||||
return (bit_count >> 3) + 1;
|
||||
} else {
|
||||
return (bit_count >> 3);
|
||||
return bit_count >> 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define TAG "SubGhzProtocolCame"
|
||||
#define TAG "SubGhzProtocolCame"
|
||||
|
||||
#define CAME_12_COUNT_BIT 12
|
||||
#define CAME_24_COUNT_BIT 24
|
||||
#define PRASTEL_COUNT_BIT 25
|
||||
@ -173,7 +174,7 @@ SubGhzProtocolStatus
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
|
||||
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
ret = SubGhzProtocolStatusErrorValueBitCount;
|
||||
break;
|
||||
@ -336,7 +337,7 @@ SubGhzProtocolStatus
|
||||
if(ret != SubGhzProtocolStatusOk) {
|
||||
break;
|
||||
}
|
||||
if((instance->generic.data_count_bit > PRASTEL_COUNT_BIT)) {
|
||||
if(instance->generic.data_count_bit > PRASTEL_COUNT_BIT) {
|
||||
FURI_LOG_E(TAG, "Wrong number of bits in key");
|
||||
ret = SubGhzProtocolStatusErrorValueBitCount;
|
||||
break;
|
||||
|
@ -267,13 +267,12 @@ void subghz_protocol_decoder_clemsa_feed(void* context, bool level, uint32_t dur
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_clemsa_const.te_short * 51) <
|
||||
subghz_protocol_clemsa_const.te_delta * 25) {
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
|
||||
subghz_protocol_clemsa_const.te_delta)) {
|
||||
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_short) <
|
||||
subghz_protocol_clemsa_const.te_delta) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
|
||||
} else if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
|
||||
subghz_protocol_clemsa_const.te_delta * 3)) {
|
||||
} else if(
|
||||
DURATION_DIFF(instance->decoder.te_last, subghz_protocol_clemsa_const.te_long) <
|
||||
subghz_protocol_clemsa_const.te_delta * 3) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
} else {
|
||||
instance->decoder.parser_step = ClemsaDecoderStepReset;
|
||||
|
@ -219,8 +219,8 @@ void subghz_protocol_decoder_doitrand_feed(void* context, bool level, uint32_t d
|
||||
}
|
||||
break;
|
||||
case DoitrandDecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
|
||||
subghz_protocol_doitrand_const.te_delta * 3))) {
|
||||
if(level && (DURATION_DIFF(duration, (subghz_protocol_doitrand_const.te_short * 2)) <
|
||||
subghz_protocol_doitrand_const.te_delta * 3)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = DoitrandDecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
@ -212,8 +212,8 @@ void subghz_protocol_decoder_gate_tx_feed(void* context, bool level, uint32_t du
|
||||
}
|
||||
break;
|
||||
case GateTXDecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
|
||||
subghz_protocol_gate_tx_const.te_delta * 3))) {
|
||||
if(level && (DURATION_DIFF(duration, subghz_protocol_gate_tx_const.te_long) <
|
||||
subghz_protocol_gate_tx_const.te_delta * 3)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = GateTXDecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
@ -358,7 +358,7 @@ void subghz_protocol_decoder_holtek_get_string(void* context, FuriString* output
|
||||
|
||||
if((instance->generic.btn & 0xF) == 0xE) {
|
||||
furi_string_cat_printf(output, "ON\r\n");
|
||||
} else if(((instance->generic.btn & 0xF) == 0xB)) {
|
||||
} else if((instance->generic.btn & 0xF) == 0xB) {
|
||||
furi_string_cat_printf(output, "OFF\r\n");
|
||||
}
|
||||
}
|
||||
|
@ -758,7 +758,7 @@ static inline bool subghz_protocol_keeloq_check_decrypt_centurion(
|
||||
uint8_t btn) {
|
||||
furi_assert(instance);
|
||||
|
||||
if((decrypt >> 28 == btn) && (((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE))) {
|
||||
if((decrypt >> 28 == btn) && ((((uint16_t)(decrypt >> 16)) & 0x3FF) == 0x1CE)) {
|
||||
instance->cnt = decrypt & 0x0000FFFF;
|
||||
/*FURI_LOG_I(
|
||||
"KL",
|
||||
|
@ -243,8 +243,8 @@ void subghz_protocol_decoder_linear_feed(void* context, bool level, uint32_t dur
|
||||
if(duration >= (subghz_protocol_linear_const.te_short * 5)) {
|
||||
instance->decoder.parser_step = LinearDecoderStepReset;
|
||||
//checking that the duration matches the guardtime
|
||||
if((DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
|
||||
subghz_protocol_linear_const.te_delta * 20)) {
|
||||
if(DURATION_DIFF(duration, subghz_protocol_linear_const.te_short * 42) >
|
||||
subghz_protocol_linear_const.te_delta * 20) {
|
||||
break;
|
||||
}
|
||||
if(DURATION_DIFF(instance->decoder.te_last, subghz_protocol_linear_const.te_short) <
|
||||
|
@ -269,14 +269,14 @@ void subghz_protocol_decoder_mastercode_feed(void* context, bool level, uint32_t
|
||||
} else if(
|
||||
DURATION_DIFF(duration, subghz_protocol_mastercode_const.te_short * 15) <
|
||||
subghz_protocol_mastercode_const.te_delta * 15) {
|
||||
if((DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
|
||||
subghz_protocol_mastercode_const.te_delta)) {
|
||||
if(DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_short) <
|
||||
subghz_protocol_mastercode_const.te_delta) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 0);
|
||||
} else if((DURATION_DIFF(
|
||||
instance->decoder.te_last,
|
||||
subghz_protocol_mastercode_const.te_long) <
|
||||
subghz_protocol_mastercode_const.te_delta * 8)) {
|
||||
} else if(
|
||||
DURATION_DIFF(
|
||||
instance->decoder.te_last, subghz_protocol_mastercode_const.te_long) <
|
||||
subghz_protocol_mastercode_const.te_delta * 8) {
|
||||
subghz_protocol_blocks_add_bit(&instance->decoder, 1);
|
||||
} else {
|
||||
instance->decoder.parser_step = MastercodeDecoderStepReset;
|
||||
|
@ -215,8 +215,8 @@ void subghz_protocol_decoder_phoenix_v2_feed(void* context, bool level, uint32_t
|
||||
}
|
||||
break;
|
||||
case Phoenix_V2DecoderStepFoundStartBit:
|
||||
if(level && ((DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
|
||||
subghz_protocol_phoenix_v2_const.te_delta * 4))) {
|
||||
if(level && (DURATION_DIFF(duration, (subghz_protocol_phoenix_v2_const.te_short * 6)) <
|
||||
subghz_protocol_phoenix_v2_const.te_delta * 4)) {
|
||||
//Found start bit
|
||||
instance->decoder.parser_step = Phoenix_V2DecoderStepSaveDuration;
|
||||
instance->decoder.decode_data = 0;
|
||||
|
@ -7,7 +7,8 @@
|
||||
#include "../blocks/generic.h"
|
||||
#include "../blocks/math.h"
|
||||
|
||||
#define TAG "SubGhzProtocolPowerSmart"
|
||||
#define TAG "SubGhzProtocolPowerSmart"
|
||||
|
||||
#define POWER_SMART_PACKET_HEADER 0xFD000000AA000000
|
||||
#define POWER_SMART_PACKET_HEADER_MASK 0xFF000000FF000000
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define TAG "SubGhzProtocolPrinceton"
|
||||
#define TAG "SubGhzProtocolPrinceton"
|
||||
|
||||
#define PRINCETON_GUARD_TIME_DEFALUT 30 //GUARD_TIME = PRINCETON_GUARD_TIME_DEFALUT * TE
|
||||
// Guard Time value should be between 15 -> 72 otherwise default value will be used
|
||||
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <flipper_format/flipper_format_i.h>
|
||||
#include <lib/toolbox/stream/stream.h>
|
||||
|
||||
#define TAG "SubGhzProtocolRaw"
|
||||
#define TAG "SubGhzProtocolRaw"
|
||||
|
||||
#define SUBGHZ_DOWNLOAD_MAX_SIZE 512
|
||||
|
||||
static const SubGhzBlockConst subghz_protocol_raw_const = {
|
||||
|
@ -4,10 +4,10 @@
|
||||
bool hex_char_to_hex_nibble(char c, uint8_t* nibble) {
|
||||
furi_check(nibble);
|
||||
|
||||
if((c >= '0' && c <= '9')) {
|
||||
if(c >= '0' && c <= '9') {
|
||||
*nibble = c - '0';
|
||||
return true;
|
||||
} else if((c >= 'A' && c <= 'F')) {
|
||||
} else if(c >= 'A' && c <= 'F') {
|
||||
*nibble = c - 'A' + 10;
|
||||
return true;
|
||||
} else if(c >= 'a' && c <= 'f') {
|
||||
|
@ -68,11 +68,11 @@ static inline LevelDuration level_duration_reset() {
|
||||
}
|
||||
|
||||
static inline bool level_duration_is_reset(LevelDuration level_duration) {
|
||||
return (level_duration == LEVEL_DURATION_RESET);
|
||||
return level_duration == LEVEL_DURATION_RESET;
|
||||
}
|
||||
|
||||
static inline bool level_duration_get_level(LevelDuration level_duration) {
|
||||
return (level_duration > 0);
|
||||
return level_duration > 0;
|
||||
}
|
||||
|
||||
static inline uint32_t level_duration_get_duration(LevelDuration level_duration) {
|
||||
|
@ -144,7 +144,7 @@ static bool stream_write_struct(Stream* stream, const void* context) {
|
||||
furi_check(stream);
|
||||
furi_check(context);
|
||||
const StreamWriteData* write_data = context;
|
||||
return (stream_write(stream, write_data->data, write_data->size) == write_data->size);
|
||||
return stream_write(stream, write_data->data, write_data->size) == write_data->size;
|
||||
}
|
||||
|
||||
bool stream_read_line(Stream* stream, FuriString* str_result) {
|
||||
|
@ -51,7 +51,7 @@ static void string_stream_free(StringStream* stream) {
|
||||
}
|
||||
|
||||
static bool string_stream_eof(StringStream* stream) {
|
||||
return (string_stream_tell(stream) >= string_stream_size(stream));
|
||||
return string_stream_tell(stream) >= string_stream_size(stream);
|
||||
}
|
||||
|
||||
static void string_stream_clean(StringStream* stream) {
|
||||
|
@ -6,7 +6,8 @@
|
||||
#include <toolbox/path.h>
|
||||
#include <toolbox/compress.h>
|
||||
|
||||
#define TAG "TarArch"
|
||||
#define TAG "TarArch"
|
||||
|
||||
#define MAX_NAME_LEN 255
|
||||
#define FILE_BLOCK_SIZE 512
|
||||
|
||||
@ -245,12 +246,12 @@ bool tar_archive_get_read_progress(TarArchive* archive, int32_t* processed, int3
|
||||
|
||||
bool tar_archive_dir_add_element(TarArchive* archive, const char* dirpath) {
|
||||
furi_check(archive);
|
||||
return (mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS);
|
||||
return mtar_write_dir_header(&archive->tar, dirpath) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_finalize(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_finalize(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_store_data(
|
||||
@ -260,16 +261,15 @@ bool tar_archive_store_data(
|
||||
const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (
|
||||
tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive));
|
||||
return tar_archive_file_add_header(archive, path, data_len) &&
|
||||
tar_archive_file_add_data_block(archive, data, data_len) &&
|
||||
tar_archive_file_finalize(archive);
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_header(TarArchive* archive, const char* path, const int32_t data_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS);
|
||||
return mtar_write_file_header(&archive->tar, path, data_len) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_file_add_data_block(
|
||||
@ -278,12 +278,12 @@ bool tar_archive_file_add_data_block(
|
||||
const int32_t block_len) {
|
||||
furi_check(archive);
|
||||
|
||||
return (mtar_write_data(&archive->tar, data_block, block_len) == block_len);
|
||||
return mtar_write_data(&archive->tar, data_block, block_len) == block_len;
|
||||
}
|
||||
|
||||
bool tar_archive_file_finalize(TarArchive* archive) {
|
||||
furi_check(archive);
|
||||
return (mtar_end_data(&archive->tar) == MTAR_ESUCCESS);
|
||||
return mtar_end_data(&archive->tar) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -396,7 +396,7 @@ bool tar_archive_unpack_to(
|
||||
|
||||
FURI_LOG_I(TAG, "Restoring '%s'", destination);
|
||||
|
||||
return (mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS);
|
||||
return mtar_foreach(&archive->tar, archive_extract_foreach_cb, ¶m) == MTAR_ESUCCESS;
|
||||
}
|
||||
|
||||
bool tar_archive_add_file(
|
||||
|
@ -142,7 +142,7 @@ uint8_t u8x8_d_st756x_common(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* a
|
||||
x *= 8;
|
||||
x += u8x8->x_offset;
|
||||
u8x8_cad_SendCmd(u8x8, 0x010 | (x >> 4));
|
||||
u8x8_cad_SendCmd(u8x8, 0x000 | ((x & 15)));
|
||||
u8x8_cad_SendCmd(u8x8, 0x000 | (x & 15));
|
||||
u8x8_cad_SendCmd(u8x8, 0x0b0 | (((u8x8_tile_t*)arg_ptr)->y_pos));
|
||||
|
||||
c = ((u8x8_tile_t*)arg_ptr)->cnt;
|
||||
|
@ -370,7 +370,7 @@ static void ble_glue_clear_shared_memory(void) {
|
||||
}
|
||||
|
||||
bool ble_glue_reinit_c2(void) {
|
||||
return (SHCI_C2_Reinit() == SHCI_Success);
|
||||
return SHCI_C2_Reinit() == SHCI_Success;
|
||||
}
|
||||
|
||||
BleGlueCommandResult ble_glue_fus_stack_delete(void) {
|
||||
|
@ -192,7 +192,7 @@ bool furi_hal_crypto_enclave_store_key(FuriHalCryptoKey* key, uint8_t* slot) {
|
||||
|
||||
SHCI_CmdStatus_t shci_state = SHCI_C2_FUS_StoreUsrKey(&pParam, slot);
|
||||
furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk);
|
||||
return (shci_state == SHCI_Success);
|
||||
return shci_state == SHCI_Success;
|
||||
}
|
||||
|
||||
static void crypto_key_init(uint32_t* key, uint32_t* iv) {
|
||||
@ -291,7 +291,7 @@ bool furi_hal_crypto_enclave_unload_key(uint8_t slot) {
|
||||
|
||||
furi_check(furi_mutex_release(furi_hal_crypto_mutex) == FuriStatusOk);
|
||||
|
||||
return (shci_state == SHCI_Success);
|
||||
return shci_state == SHCI_Success;
|
||||
}
|
||||
|
||||
bool furi_hal_crypto_load_key(const uint8_t* key, const uint8_t* iv) {
|
||||
@ -631,7 +631,7 @@ static bool furi_hal_crypto_gcm_compare_tag(const uint8_t* tag1, const uint8_t*
|
||||
diff |= tag1[i] ^ tag2[i];
|
||||
}
|
||||
|
||||
return (diff == 0);
|
||||
return diff == 0;
|
||||
}
|
||||
|
||||
bool furi_hal_crypto_gcm(
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#define TAG "FuriHalIbutton"
|
||||
#define TAG "FuriHalIbutton"
|
||||
|
||||
#define FURI_HAL_IBUTTON_TIMER TIM1
|
||||
#define FURI_HAL_IBUTTON_TIMER_BUS FuriHalBusTIM1
|
||||
#define FURI_HAL_IBUTTON_TIMER_IRQ FuriHalInterruptIdTim1UpTim16
|
||||
|
@ -65,11 +65,11 @@ void furi_hal_memory_init(void) {
|
||||
TAG, "SRAM2B: 0x%p, %lu", memory->region[SRAM_B].start, memory->region[SRAM_B].size);
|
||||
|
||||
if((memory->region[SRAM_A].size > 0) || (memory->region[SRAM_B].size > 0)) {
|
||||
if((memory->region[SRAM_A].size > 0)) {
|
||||
if(memory->region[SRAM_A].size > 0) {
|
||||
FURI_LOG_I(TAG, "SRAM2A clear");
|
||||
memset(memory->region[SRAM_A].start, 0, memory->region[SRAM_A].size);
|
||||
}
|
||||
if((memory->region[SRAM_B].size > 0)) {
|
||||
if(memory->region[SRAM_B].size > 0) {
|
||||
FURI_LOG_I(TAG, "SRAM2B clear");
|
||||
memset(memory->region[SRAM_B].start, 0, memory->region[SRAM_B].size);
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ FuriHalNfcError furi_hal_nfc_init(void) {
|
||||
}
|
||||
|
||||
static bool furi_hal_nfc_is_mine(void) {
|
||||
return (furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id());
|
||||
return furi_mutex_get_owner(furi_hal_nfc.mutex) == furi_thread_get_current_id();
|
||||
}
|
||||
|
||||
FuriHalNfcError furi_hal_nfc_acquire(void) {
|
||||
|
@ -75,9 +75,9 @@ void srand(unsigned seed) {
|
||||
}
|
||||
|
||||
int rand(void) {
|
||||
return (furi_hal_random_get() & RAND_MAX);
|
||||
return furi_hal_random_get() & RAND_MAX;
|
||||
}
|
||||
|
||||
long random(void) {
|
||||
return (furi_hal_random_get() & RAND_MAX);
|
||||
return furi_hal_random_get() & RAND_MAX;
|
||||
}
|
||||
|
@ -585,7 +585,6 @@ bool furi_hal_rfid_field_is_present(uint32_t* frequency) {
|
||||
furi_check(frequency);
|
||||
|
||||
*frequency = furi_hal_rfid->field.counter * 10;
|
||||
return (
|
||||
(*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) &&
|
||||
(*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX));
|
||||
return (*frequency >= FURI_HAL_RFID_FIELD_FREQUENCY_MIN) &&
|
||||
(*frequency <= FURI_HAL_RFID_FIELD_FREQUENCY_MAX);
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ static FuriStatus sd_spi_wait_for_data(uint8_t data, uint32_t timeout_ms) {
|
||||
if(furi_hal_cortex_timer_is_expired(timer)) {
|
||||
return FuriStatusErrorTimeout;
|
||||
}
|
||||
} while((byte != data));
|
||||
} while(byte != data);
|
||||
|
||||
return FuriStatusOk;
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ bool furi_hal_subghz_is_rx_data_crc_valid(void) {
|
||||
uint8_t data[1];
|
||||
cc1101_read_reg(&furi_hal_spi_bus_handle_subghz, CC1101_STATUS_LQI | CC1101_BURST, data);
|
||||
furi_hal_spi_release(&furi_hal_spi_bus_handle_subghz);
|
||||
if(((data[0] >> 7) & 0x01)) {
|
||||
if((data[0] >> 7) & 0x01) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -518,7 +518,7 @@ int32_t furi_hal_cdc_receive(uint8_t if_num, uint8_t* buf, uint16_t max_len) {
|
||||
} else {
|
||||
len = usbd_ep_read(usb_dev, CDC1_RXD_EP, buf, max_len);
|
||||
}
|
||||
return ((len < 0) ? 0 : len);
|
||||
return (len < 0) ? 0 : len;
|
||||
}
|
||||
|
||||
static void cdc_on_wakeup(usbd_device* dev) {
|
||||
|
@ -237,7 +237,7 @@ void furi_hal_hid_u2f_send_response(uint8_t* data, uint8_t len) {
|
||||
|
||||
uint32_t furi_hal_hid_u2f_get_request(uint8_t* data) {
|
||||
int32_t len = usbd_ep_read(usb_dev, HID_EP_IN, data, HID_U2F_PACKET_LEN);
|
||||
return ((len < 0) ? 0 : len);
|
||||
return (len < 0) ? 0 : len;
|
||||
}
|
||||
|
||||
static void hid_u2f_rx_ep_callback(usbd_device* dev, uint8_t event, uint8_t ep) {
|
||||
|
Loading…
Reference in New Issue
Block a user