diff --git a/applications/main/nfc/scenes/nfc_scene_mf_classic_dict_attack.c b/applications/main/nfc/scenes/nfc_scene_mf_classic_dict_attack.c index 6fb818bab..120093eda 100644 --- a/applications/main/nfc/scenes/nfc_scene_mf_classic_dict_attack.c +++ b/applications/main/nfc/scenes/nfc_scene_mf_classic_dict_attack.c @@ -141,14 +141,14 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(NfcApp* instance) { uint32_t state = scene_manager_get_scene_state(instance->scene_manager, NfcSceneMfClassicDictAttack); if(state == DictAttackStateCUIDDictInProgress) { - do { - size_t cuid_len = 0; - const uint8_t* cuid = nfc_device_get_uid(instance->nfc_device, &cuid_len); - FuriString* cuid_dict_path = furi_string_alloc_printf( - "%s/mf_classic_dict_%08lx.nfc", - EXT_PATH("nfc/assets"), - (uint32_t)bit_lib_bytes_to_num_be(cuid + (cuid_len - 4), 4)); + size_t cuid_len = 0; + const uint8_t* cuid = nfc_device_get_uid(instance->nfc_device, &cuid_len); + FuriString* cuid_dict_path = furi_string_alloc_printf( + "%s/mf_classic_dict_%08lx.nfc", + EXT_PATH("nfc/assets"), + (uint32_t)bit_lib_bytes_to_num_be(cuid + (cuid_len - 4), 4)); + do { if(!keys_dict_check_presence(furi_string_get_cstr(cuid_dict_path))) { state = DictAttackStateUserDictInProgress; break; @@ -159,8 +159,6 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(NfcApp* instance) { KeysDictModeOpenExisting, sizeof(MfClassicKey)); - furi_string_free(cuid_dict_path); - if(keys_dict_get_total_keys(instance->nfc_dict_context.dict) == 0) { keys_dict_free(instance->nfc_dict_context.dict); state = DictAttackStateUserDictInProgress; @@ -169,6 +167,8 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(NfcApp* instance) { dict_attack_set_header(instance->dict_attack, "MF Classic CUID Dictionary"); } while(false); + + furi_string_free(cuid_dict_path); } if(state == DictAttackStateUserDictInProgress) { do { diff --git a/documentation/AppManifests.md b/documentation/AppManifests.md index b2a62e98a..f0f9d6379 100644 --- a/documentation/AppManifests.md +++ b/documentation/AppManifests.md @@ -16,18 +16,18 @@ Only two parameters are mandatory: **appid** and **apptype**. Others are optiona - **apptype**: member of FlipperAppType.\* enumeration. Valid values are: -| Enum member | Firmware component type | -|:----------------|--------------------------------------------------------------------------------------------------| -| SERVICE | System service, created at early startup | -| SYSTEM | App is not being shown in any menus. It can be started by other apps or from CLI | -| APP | Regular app for the main menu | -| PLUGIN | App to be built as a part of the firmware and to be placed in the Plugins menu | -| DEBUG | App only visible in Debug menu with debug mode enabled | -| ARCHIVE | One and only Archive app | -| SETTINGS | App to be placed in the system settings menu | -| STARTUP | Callback function to run at system startup. Does not define a separate app | -| EXTERNAL | App to be built as `.fap` plugin | -| METAPACKAGE | Does not define any code to be run, used for declaring dependencies and app bundles | +| Enum member | Firmware component type | +| ----------- | ------------------------------------------------------------------------------------------- | +| SERVICE | System service, created at early startup | +| SYSTEM | App is not being shown in any menus. It can be started by other apps or from CLI | +| APP | Regular app for the main menu | +| PLUGIN | App to be built as a part of the firmware and to be placed in the Plugins menu | +| DEBUG | App only visible in Debug menu with debug mode enabled | +| ARCHIVE | One and only Archive app | +| SETTINGS | App to be placed in the system settings menu | +| STARTUP | Callback function to run at system startup. Does not define a separate app | +| EXTERNAL | App to be built as `.fap` plugin | +| METAPACKAGE | Does not define any code to be run, used for declaring dependencies and app bundles | - **name**: name displayed in menus. - **entry_point**: C function to be used as the app's entry point. Note that C++ function names are mangled, so you need to wrap them in `extern "C"` to use them as entry points. @@ -43,7 +43,7 @@ Only two parameters are mandatory: **appid** and **apptype**. Others are optiona - **targets**: list of strings and target names with which this app is compatible. If not specified, the app is built for all targets. The default value is `["all"]`. - **resources**: name of a folder within the app's source folder to be used for packacking SD card resources for this app. They will only be used if app is included in build configuration. The default value is `""`, meaning no resources are packaged. -### Parameters for external apps +#### Parameters for external apps The following parameters are used only for [FAPs](./AppsOnSDCard.md): @@ -59,10 +59,7 @@ The following parameters are used only for [FAPs](./AppsOnSDCard.md): - **fap_extbuild**: provides support for parts of app sources to be built by external tools. Contains a list of `ExtFile(path="file name", command="shell command")` definitions. `fbt` will run the specified command for each file in the list. - **fal_embedded**: boolean, default `False`. Applies only to PLUGIN type. If `True`, the plugin will be embedded into host app's .fap file as a resource and extracted to `apps_assets/APPID` folder on its start. This allows plugins to be distributed as a part of the host app. -> [!NOTE] -> These commands are executed at the firmware root folder, and all intermediate files must be placed in an app's temporary build folder. -> For that, you can use pattern expansion by `fbt`: `${FAP_WORK_DIR}` will be replaced with the path to the app's temporary build folder, -> and `${FAP_SRC_DIR}` will be replaced with the path to the app's source folder. You can also use other variables defined internally by `fbt`. +Note that commands are executed at the firmware root folder, and all intermediate files must be placed in an app's temporary build folder. For that, you can use pattern expansion by `fbt`: `${FAP_WORK_DIR}` will be replaced with the path to the app's temporary build folder, and `${FAP_SRC_DIR}` will be replaced with the path to the app's source folder. You can also use other variables defined internally by `fbt`. Example for building an app from Rust sources: diff --git a/documentation/FuriHalBus.md b/documentation/FuriHalBus.md index f95f39388..f534e5bd1 100644 --- a/documentation/FuriHalBus.md +++ b/documentation/FuriHalBus.md @@ -6,10 +6,7 @@ On system startup, most of the peripheral devices are under reset and not clocke Some crucial peripherals are enabled right away by the system, others must be explicitly enabled by the user code. -> [!NOTE] -> -> Here and afterwards, the word `system` refers to any code belonging to the operating system, -> hardware drivers or built-in apps. +**NOTE:** Here and afterwards, the word *"system"* refers to any code belonging to the operating system, hardware drivers or built-in apps. To **ENABLE** a peripheral, call `furi_hal_bus_enable()`. At the time of the call, the peripheral in question **MUST** be disabled; otherwise a crash will occur to indicate improper use. This means that any given peripheral cannot be enabled twice or more without disabling it first. @@ -30,8 +27,6 @@ Built-in peripherals are divided into three categories: Below is the list of peripherals that are enabled by the system. The user code must **NEVER** attempt to disable them. -If a corresponding API is provided, the user code must employ it in order to access the peripheral. - *Table 1* — Peripherals enabled by the system | Peripheral | Enabled at | diff --git a/documentation/devboard/Reading logs via the Dev Board.md b/documentation/devboard/Reading logs via the Dev Board.md index d0828ad53..bed665d40 100644 --- a/documentation/devboard/Reading logs via the Dev Board.md +++ b/documentation/devboard/Reading logs via the Dev Board.md @@ -9,7 +9,7 @@ The Developer Board allows you to read Flipper Zero logs via UART. Unlike readin ## Setting the log level -Depending on your needs, you can set the log level by going to `Main Menu → Settings → Log Level`. To learn more about logging levels, visit [Settings](https://docs.flipperzero.one/basics/settings#d5TAt). +Depending on your needs, you can set the log level by going to **Main Menu → Settings → Log Level**. To learn more about logging levels, visit [Settings](https://docs.flipperzero.one/basics/settings#d5TAt). ![You can manually set the preferred log level](https://github.com/user-attachments/assets/b1317d01-8b9b-4544-8720-303c87b85324) diff --git a/documentation/fbt.md b/documentation/fbt.md index ab0db36a9..9a17e4180 100644 --- a/documentation/fbt.md +++ b/documentation/fbt.md @@ -55,7 +55,7 @@ However, for ease of integration with IDEs, the latest built variant's directory Additionally, `compile_commands.json` is generated in that folder (it is used for code completion support in IDEs). -`build/latest` symlink & compilation database are only updated upon *firmware build targets* — that is, when you're re-building the firmware itself. +`build/latest` symlink & compilation database are only updated upon *firmware build targets* — that is, when you're re-building the firmware itself. Running other tasks, like firmware flashing or building update bundles *for a different debug/release configuration or hardware target*, does not update `built/latest` dir to point to that configuration. Running other tasks, like firmware flashing or building update bundles *for a different debug/release configuration or hardware target*, does not update `built/latest` dir to point to that configuration. @@ -149,12 +149,7 @@ You can find out available options with `./fbt -h`. ### Firmware application set -You can create customized firmware builds by modifying the list of apps to be included in the build. - -App presets are configured with the `FIRMWARE_APPS` option, which is a `map(configuration_name:str → application_list:tuple(str))`. - -To specify an app set to use in the build, set `FIRMWARE_APP_SET` to its name. - +You can create customized firmware builds by modifying the list of apps to be included in the build. App presets are configured with the `FIRMWARE_APPS` option, which is a `map(configuration_name:str → application_list:tuple(str))`. To specify an app set to use in the build, set `FIRMWARE_APP_SET` to its name. For example, to build a firmware image with unit tests, run `./fbt FIRMWARE_APP_SET=unit_tests`. Check out `fbt_options.py` for details. diff --git a/lib/nfc/protocols/mf_classic/mf_classic_poller.c b/lib/nfc/protocols/mf_classic/mf_classic_poller.c index e8f660b16..7417322e9 100644 --- a/lib/nfc/protocols/mf_classic/mf_classic_poller.c +++ b/lib/nfc/protocols/mf_classic/mf_classic_poller.c @@ -20,8 +20,7 @@ const MfClassicBackdoorKeyPair mf_classic_backdoor_keys[] = { {{{0xa3, 0x16, 0x67, 0xa8, 0xce, 0xc1}}, MfClassicBackdoorAuth1}, // Fudan, Infineon, NXP {{{0x51, 0x8b, 0x33, 0x54, 0xe7, 0x60}}, MfClassicBackdoorAuth2}, // Fudan }; -const size_t mf_classic_backdoor_keys_count = - sizeof(mf_classic_backdoor_keys) / sizeof(mf_classic_backdoor_keys[0]); +const size_t mf_classic_backdoor_keys_count = COUNT_OF(mf_classic_backdoor_keys); const uint16_t valid_sums[] = {0, 32, 56, 64, 80, 96, 104, 112, 120, 128, 136, 144, 152, 160, 176, 192, 200, 224, 256};