From 002e5cd9de36ce44f09080413c6c860eda43271e Mon Sep 17 00:00:00 2001 From: Guacamolie <140027638+vanguacamolie@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:49:51 +0200 Subject: [PATCH 1/5] Bad USB: fix crash when selecting a keyboard layout (#3555) Commit 6de2934 (BadUSB: BLE, media keys, Fn/Globe key commands (#3403), 2024-03-25) changed the life-cycle of the bad_usb_script object, so that the bad_usb_script is allocated when entering the work scene, and freed when going to the config scene. It also made it so that the keyboard layout always gets reloaded when entering the work scene. The logic of the layout config scene, however, assumes that it still needs to reload the keyboard layout after selecting it. The keyboard layout data is stored within bad_usb_script however, which is NULL when within the layout config scene. The fix is simple. Since we are now reload the keyboard layout anyway when entering the work scene, we can just remove this extra call. Resolves: #3552 --- applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c | 1 - 1 file changed, 1 deletion(-) diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c index 2dbacbe12..a5d0df94c 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c @@ -31,7 +31,6 @@ void bad_usb_scene_config_layout_on_enter(void* context) { BadUsbApp* bad_usb = context; if(bad_usb_layout_select(bad_usb)) { - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_search_and_switch_to_previous_scene(bad_usb->scene_manager, BadUsbSceneWork); } else { scene_manager_previous_scene(bad_usb->scene_manager); From 9f71be6fef632d1e50576ab2bfff7023d508b450 Mon Sep 17 00:00:00 2001 From: WillyJL <49810075+Willy-JL@users.noreply.github.com> Date: Mon, 1 Apr 2024 14:42:47 +0100 Subject: [PATCH 2/5] IR: Remember OTG state (#3549) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- applications/main/infrared/infrared_app.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/applications/main/infrared/infrared_app.c b/applications/main/infrared/infrared_app.c index 5a83dfbd7..93311716a 100644 --- a/applications/main/infrared/infrared_app.c +++ b/applications/main/infrared/infrared_app.c @@ -13,11 +13,12 @@ #define INFRARED_TASK_STACK_SIZE (2048UL) #define INFRARED_SETTINGS_PATH INT_PATH(".infrared.settings") -#define INFRARED_SETTINGS_VERSION (0) +#define INFRARED_SETTINGS_VERSION (1) #define INFRARED_SETTINGS_MAGIC (0x1F) typedef struct { - uint8_t tx_pin; + FuriHalInfraredTxPin tx_pin; + bool otg_enabled; } InfraredSettings; static const NotificationSequence* @@ -488,11 +489,15 @@ static void infrared_load_settings(InfraredApp* infrared) { } infrared_set_tx_pin(infrared, settings.tx_pin); + if(settings.tx_pin < FuriHalInfraredTxPinMax) { + infrared_enable_otg(infrared, settings.otg_enabled); + } } void infrared_save_settings(InfraredApp* infrared) { InfraredSettings settings = { .tx_pin = infrared->app_state.tx_pin, + .otg_enabled = infrared->app_state.is_otg_enabled, }; if(!saved_struct_save( From f426c44811a7829970f87cd93d505c1c73015d05 Mon Sep 17 00:00:00 2001 From: RebornedBrain <138568282+RebornedBrain@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:02:11 +0300 Subject: [PATCH 3/5] [FL-3801] Mifare Ultralight naming fix (#3551) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed some UI mismatches in plugin and nfc app * Fixed nameing mismatches in mosgortrans_util * Fix ultralight naming display * Fix naming for Ultralight on read screen * fbt: fixed regression with pvs-reports autoopen * Revert st25tb_render.c Co-authored-by: gornekich Co-authored-by: あく Co-authored-by: hedger --- .../nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c | 2 ++ scripts/fbt_tools/pvsstudio.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c index 0fe5a7664..bd2015889 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c +++ b/applications/main/nfc/helpers/protocol_support/mf_ultralight/mf_ultralight.c @@ -247,6 +247,8 @@ static void nfc_scene_read_success_on_enter_mf_ultralight(NfcApp* instance) { furi_string_cat_printf( temp_str, "\e#%s\n", nfc_device_get_name(device, NfcDeviceNameTypeFull)); + furi_string_replace(temp_str, "Mifare", "MIFARE"); + nfc_render_mf_ultralight_info(data, NfcProtocolFormatTypeShort, temp_str); } diff --git a/scripts/fbt_tools/pvsstudio.py b/scripts/fbt_tools/pvsstudio.py index d74aae768..290531321 100644 --- a/scripts/fbt_tools/pvsstudio.py +++ b/scripts/fbt_tools/pvsstudio.py @@ -32,7 +32,7 @@ def atexist_handler(): for bf in GetBuildFailures(): for node in Flatten(bf.node): - if node.exists and "pvs" in node.name and node.name.endswith(".html"): + if node.exists and "pvs" in node.path and node.name.endswith(".html"): # macOS if sys.platform == "darwin": subprocess.run(["open", node.abspath]) From 096a26b07dfa223fb9bcd7995e3397a3984631aa Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 1 Apr 2024 21:02:45 +0400 Subject: [PATCH 4/5] fbt: added -Wstrict-prototypes for main firmware (#3557) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fbt: added -Wstrict-prototypes for main firmware (excludes extapps) * unit_tests: fixed declarations using strict prototypes * furi_hal: ble: changed gap stop log level to debug Co-authored-by: あく --- .../debug/unit_tests/furi/furi_test.c | 8 ++-- applications/debug/unit_tests/test_index.c | 48 +++++++++---------- .../services/notification/notification_app.c | 4 +- scripts/fbt_tools/fbt_apps.py | 2 +- site_scons/cc.scons | 1 + site_scons/extapps.scons | 3 ++ targets/f7/ble_glue/ble_glue.c | 2 +- targets/f7/ble_glue/gap.c | 4 +- targets/f7/ble_glue/hw_ipcc.c | 16 +++---- targets/f7/furi_hal/furi_hal_infrared.c | 4 +- targets/f7/furi_hal/furi_hal_interrupt.c | 4 +- targets/f7/furi_hal/furi_hal_os.c | 2 +- 12 files changed, 51 insertions(+), 47 deletions(-) diff --git a/applications/debug/unit_tests/furi/furi_test.c b/applications/debug/unit_tests/furi/furi_test.c index 2f271c305..e287f9927 100644 --- a/applications/debug/unit_tests/furi/furi_test.c +++ b/applications/debug/unit_tests/furi/furi_test.c @@ -4,11 +4,11 @@ #include "../minunit.h" // v2 tests -void test_furi_create_open(); -void test_furi_concurrent_access(); -void test_furi_pubsub(); +void test_furi_create_open(void); +void test_furi_concurrent_access(void); +void test_furi_pubsub(void); -void test_furi_memmgr(); +void test_furi_memmgr(void); static int foo = 0; diff --git a/applications/debug/unit_tests/test_index.c b/applications/debug/unit_tests/test_index.c index eb475fada..5d0282bd7 100644 --- a/applications/debug/unit_tests/test_index.c +++ b/applications/debug/unit_tests/test_index.c @@ -8,31 +8,31 @@ #define TAG "UnitTests" -int run_minunit_test_furi(); -int run_minunit_test_furi_hal(); -int run_minunit_test_furi_hal_crypto(); -int run_minunit_test_furi_string(); -int run_minunit_test_infrared(); -int run_minunit_test_rpc(); -int run_minunit_test_manifest(); -int run_minunit_test_flipper_format(); -int run_minunit_test_flipper_format_string(); -int run_minunit_test_stream(); -int run_minunit_test_storage(); -int run_minunit_test_subghz(); -int run_minunit_test_dirwalk(); -int run_minunit_test_power(); -int run_minunit_test_protocol_dict(); -int run_minunit_test_lfrfid_protocols(); -int run_minunit_test_nfc(); -int run_minunit_test_bit_lib(); -int run_minunit_test_datetime(); -int run_minunit_test_float_tools(); -int run_minunit_test_bt(); -int run_minunit_test_dialogs_file_browser_options(); -int run_minunit_test_expansion(); +int run_minunit_test_furi(void); +int run_minunit_test_furi_hal(void); +int run_minunit_test_furi_hal_crypto(void); +int run_minunit_test_furi_string(void); +int run_minunit_test_infrared(void); +int run_minunit_test_rpc(void); +int run_minunit_test_manifest(void); +int run_minunit_test_flipper_format(void); +int run_minunit_test_flipper_format_string(void); +int run_minunit_test_stream(void); +int run_minunit_test_storage(void); +int run_minunit_test_subghz(void); +int run_minunit_test_dirwalk(void); +int run_minunit_test_power(void); +int run_minunit_test_protocol_dict(void); +int run_minunit_test_lfrfid_protocols(void); +int run_minunit_test_nfc(void); +int run_minunit_test_bit_lib(void); +int run_minunit_test_datetime(void); +int run_minunit_test_float_tools(void); +int run_minunit_test_bt(void); +int run_minunit_test_dialogs_file_browser_options(void); +int run_minunit_test_expansion(void); -typedef int (*UnitTestEntry)(); +typedef int (*UnitTestEntry)(void); typedef struct { const char* name; diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 514a37f00..8e183f74e 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -24,9 +24,9 @@ static const uint8_t reset_display_mask = 1 << 5; static const uint8_t reset_blink_mask = 1 << 6; static void notification_vibro_on(bool force); -static void notification_vibro_off(); +static void notification_vibro_off(void); static void notification_sound_on(float freq, float volume, bool force); -static void notification_sound_off(); +static void notification_sound_off(void); static uint8_t notification_settings_get_display_brightness(NotificationApp* app, uint8_t value); static uint8_t notification_settings_get_rgb_led_brightness(NotificationApp* app, uint8_t value); diff --git a/scripts/fbt_tools/fbt_apps.py b/scripts/fbt_tools/fbt_apps.py index 7e0aec5ea..3a17a79a3 100644 --- a/scripts/fbt_tools/fbt_apps.py +++ b/scripts/fbt_tools/fbt_apps.py @@ -44,7 +44,7 @@ class ApplicationsCGenerator: def get_app_ep_forward(self, app: FlipperApplication): if app.apptype == FlipperAppType.STARTUP: - return f"extern void {app.entry_point}();" + return f"extern void {app.entry_point}(void);" return f"extern int32_t {app.entry_point}(void* p);" def get_app_descr(self, app: FlipperApplication): diff --git a/site_scons/cc.scons b/site_scons/cc.scons index 507cd2d12..603ec621c 100644 --- a/site_scons/cc.scons +++ b/site_scons/cc.scons @@ -4,6 +4,7 @@ Import("ENV") ENV.AppendUnique( CFLAGS=[ "-std=gnu2x", + "-Wstrict-prototypes", ], CXXFLAGS=[ "-std=c++20", diff --git a/site_scons/extapps.scons b/site_scons/extapps.scons index 22d0be867..b67ce9621 100644 --- a/site_scons/extapps.scons +++ b/site_scons/extapps.scons @@ -48,6 +48,9 @@ appenv.AppendUnique( "stdc++", "supc++", ], + CFLAGS=[ + "-Wno-strict-prototypes", + ], ) diff --git a/targets/f7/ble_glue/ble_glue.c b/targets/f7/ble_glue/ble_glue.c index ecc2f83c5..c50360361 100644 --- a/targets/f7/ble_glue/ble_glue.c +++ b/targets/f7/ble_glue/ble_glue.c @@ -49,7 +49,7 @@ static BleGlue* ble_glue = NULL; // static int32_t ble_glue_shci_thread(void* argument); static void ble_sys_status_not_callback(SHCI_TL_CmdStatus_t status); static void ble_sys_user_event_callback(void* pPayload); -static void ble_glue_clear_shared_memory(); +static void ble_glue_clear_shared_memory(void); void ble_glue_set_key_storage_changed_callback( BleGlueKeyStorageChangedCallback callback, diff --git a/targets/f7/ble_glue/gap.c b/targets/f7/ble_glue/gap.c index fded66a9b..8f4299c70 100644 --- a/targets/f7/ble_glue/gap.c +++ b/targets/f7/ble_glue/gap.c @@ -375,7 +375,7 @@ static void gap_advertise_start(GapState new_state) { uint16_t min_interval; uint16_t max_interval; - FURI_LOG_I(TAG, "Start: %d", new_state); + FURI_LOG_D(TAG, "Start: %d", new_state); if(new_state == GapStateAdvFast) { min_interval = 0x80; // 80 ms @@ -420,7 +420,7 @@ static void gap_advertise_start(GapState new_state) { } static void gap_advertise_stop(void) { - FURI_LOG_I(TAG, "Stop"); + FURI_LOG_D(TAG, "Stop"); tBleStatus ret; if(gap->state > GapStateIdle) { if(gap->state == GapStateConnected) { diff --git a/targets/f7/ble_glue/hw_ipcc.c b/targets/f7/ble_glue/hw_ipcc.c index 6a3aace5a..4daaa7e49 100644 --- a/targets/f7/ble_glue/hw_ipcc.c +++ b/targets/f7/ble_glue/hw_ipcc.c @@ -15,14 +15,14 @@ (LL_C2_IPCC_IsActiveFlag_CHx(IPCC, channel) && \ LL_C1_IPCC_IsEnabledReceiveChannel(IPCC, channel)) -static void (*FreeBufCb)(); +static void (*FreeBufCb)(void); -static void HW_IPCC_BLE_EvtHandler(); -static void HW_IPCC_BLE_AclDataEvtHandler(); -static void HW_IPCC_MM_FreeBufHandler(); -static void HW_IPCC_SYS_CmdEvtHandler(); -static void HW_IPCC_SYS_EvtHandler(); -static void HW_IPCC_TRACES_EvtHandler(); +static void HW_IPCC_BLE_EvtHandler(void); +static void HW_IPCC_BLE_AclDataEvtHandler(void); +static void HW_IPCC_MM_FreeBufHandler(void); +static void HW_IPCC_SYS_CmdEvtHandler(void); +static void HW_IPCC_SYS_EvtHandler(void); +static void HW_IPCC_TRACES_EvtHandler(void); void HW_IPCC_Rx_Handler(void) { if(HW_IPCC_RX_PENDING(HW_IPCC_SYSTEM_EVENT_CHANNEL)) { @@ -134,7 +134,7 @@ static void HW_IPCC_SYS_EvtHandler(void) { LL_C1_IPCC_ClearFlag_CHx(IPCC, HW_IPCC_SYSTEM_EVENT_CHANNEL); } -void HW_IPCC_MM_SendFreeBuf(void (*cb)()) { +void HW_IPCC_MM_SendFreeBuf(void (*cb)(void)) { if(LL_C1_IPCC_IsActiveFlag_CHx(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL)) { FreeBufCb = cb; LL_C1_IPCC_EnableTransmitChannel(IPCC, HW_IPCC_MM_RELEASE_BUFFER_CHANNEL); diff --git a/targets/f7/furi_hal/furi_hal_infrared.c b/targets/f7/furi_hal/furi_hal_infrared.c index bbb00198e..6f2210cc1 100644 --- a/targets/f7/furi_hal/furi_hal_infrared.c +++ b/targets/f7/furi_hal/furi_hal_infrared.c @@ -92,8 +92,8 @@ static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polar static void furi_hal_infrared_tx_dma_set_buffer(uint8_t buf_num); static void furi_hal_infrared_tx_fill_buffer_last(uint8_t buf_num); static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void); -static void furi_hal_infrared_tx_dma_polarity_isr(); -static void furi_hal_infrared_tx_dma_isr(); +static void furi_hal_infrared_tx_dma_polarity_isr(void*); +static void furi_hal_infrared_tx_dma_isr(void*); static void furi_hal_infrared_tim_rx_isr(void* context) { UNUSED(context); diff --git a/targets/f7/furi_hal/furi_hal_interrupt.c b/targets/f7/furi_hal/furi_hal_interrupt.c index a0ce2f665..5c2c315ef 100644 --- a/targets/f7/furi_hal/furi_hal_interrupt.c +++ b/targets/f7/furi_hal/furi_hal_interrupt.c @@ -305,8 +305,8 @@ void DebugMon_Handler(void) { extern usbd_device udev; -extern void HW_IPCC_Tx_Handler(); -extern void HW_IPCC_Rx_Handler(); +extern void HW_IPCC_Tx_Handler(void); +extern void HW_IPCC_Rx_Handler(void); void SysTick_Handler(void) { furi_hal_os_tick(); diff --git a/targets/f7/furi_hal/furi_hal_os.c b/targets/f7/furi_hal/furi_hal_os.c index 4738faa7c..ba28a141f 100644 --- a/targets/f7/furi_hal/furi_hal_os.c +++ b/targets/f7/furi_hal/furi_hal_os.c @@ -51,7 +51,7 @@ void furi_hal_os_timer_callback(void) { } #endif -extern void xPortSysTickHandler(); +extern void xPortSysTickHandler(void); static volatile uint32_t furi_hal_os_skew; From d32f1955578782efd2c9735476d8c6048c54043f Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 2 Apr 2024 15:30:42 +0400 Subject: [PATCH 5/5] fbt: fixed missing FBT_FAP_DEBUG_ELF_ROOT to dist env (#3563) --- SConstruct | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SConstruct b/SConstruct index a57714a3c..532c37b7f 100644 --- a/SConstruct +++ b/SConstruct @@ -230,6 +230,7 @@ firmware_debug = distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE}", GDBREMOTE="${OPENOCD_GDB_PIPE}", + FBT_FAP_DEBUG_ELF_ROOT=firmware_env["FBT_FAP_DEBUG_ELF_ROOT"], ) distenv.Depends(firmware_debug, firmware_flash) @@ -239,6 +240,7 @@ distenv.PhonyTarget( source=firmware_env["FW_ELF"], GDBOPTS="${GDBOPTS_BASE} ${GDBOPTS_BLACKMAGIC}", GDBREMOTE="${BLACKMAGIC_ADDR}", + FBT_FAP_DEBUG_ELF_ROOT=firmware_env["FBT_FAP_DEBUG_ELF_ROOT"], ) # Debug alien elf