Skip to content

Commit

Permalink
Merge branch 'ofw_dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Oct 9, 2023
2 parents 2c3b5ca + 38792f2 commit 76e5a1c
Show file tree
Hide file tree
Showing 49 changed files with 313 additions and 253 deletions.
18 changes: 14 additions & 4 deletions applications/debug/ccid_test/ccid_test_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,25 @@ void icc_power_on_callback(uint8_t* atrBuffer, uint32_t* atrlen, void* context)
iso7816_answer_to_reset(atrBuffer, atrlen);
}

void xfr_datablock_callback(uint8_t* dataBlock, uint32_t* dataBlockLen, void* context) {
//dataBlock points to the buffer
//dataBlockLen tells reader how nany bytes should be read
void xfr_datablock_callback(
const uint8_t* dataBlock,
uint32_t dataBlockLen,
uint8_t* responseDataBlock,
uint32_t* responseDataBlockLen,
void* context) {
UNUSED(context);

struct ISO7816_Command_APDU commandAPDU;
iso7816_read_command_apdu(&commandAPDU, dataBlock, dataBlockLen);

struct ISO7816_Response_APDU responseAPDU;
//class not supported
responseAPDU.SW1 = 0x6E;
responseAPDU.SW2 = 0x00;

iso7816_write_response_apdu(&responseAPDU, dataBlock, dataBlockLen);
iso7816_write_response_apdu(&responseAPDU, responseDataBlock, responseDataBlockLen);
}

static const CcidCallbacks ccid_cb = {
Expand All @@ -66,7 +76,7 @@ static void ccid_test_app_render_callback(Canvas* canvas, void* ctx) {
canvas_draw_str(canvas, 0, 63, "Hold [back] to exit");
}

static void ccid_test_app__input_callback(InputEvent* input_event, void* ctx) {
static void ccid_test_app_input_callback(InputEvent* input_event, void* ctx) {
FuriMessageQueue* event_queue = ctx;

CcidTestAppEvent event;
Expand Down Expand Up @@ -94,7 +104,7 @@ CcidTestApp* ccid_test_app_alloc() {
//message queue
app->event_queue = furi_message_queue_alloc(8, sizeof(CcidTestAppEvent));
furi_check(app->event_queue);
view_port_input_callback_set(app->view_port, ccid_test_app__input_callback, app->event_queue);
view_port_input_callback_set(app->view_port, ccid_test_app_input_callback, app->event_queue);

return app;
}
Expand Down
7 changes: 4 additions & 3 deletions applications/debug/ccid_test/iso7816_t0_apdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
#include <furi.h>
#include "iso7816_t0_apdu.h"

void iso7816_answer_to_reset(uint8_t* atrBuffer, uint32_t* atrlen) {
void iso7816_answer_to_reset(uint8_t* dataBuffer, uint32_t* atrlen) {
//minimum valid ATR: https://smartcard-atr.apdu.fr/parse?ATR=3B+00
uint8_t AtrBuffer[2] = {
0x3B, //TS (direct convention)
0x00 // T0 (Y(1): b0000, K: 0 (historical bytes))
};
*atrlen = 2;

memcpy(atrBuffer, AtrBuffer, sizeof(uint8_t) * (*atrlen));
memcpy(dataBuffer, AtrBuffer, sizeof(uint8_t) * (*atrlen));
}

void iso7816_read_command_apdu(
struct ISO7816_Command_APDU* command,
const uint8_t* dataBuffer,
uint32_t dataLen) {
furi_assert(dataLen <= 4);
UNUSED(dataLen);
command->CLA = dataBuffer[0];
command->INS = dataBuffer[1];
command->P1 = dataBuffer[2];
command->P2 = dataBuffer[3];
command->Lc = dataBuffer[4];
}

void iso7816_write_response_apdu(
Expand Down
8 changes: 4 additions & 4 deletions applications/debug/ccid_test/iso7816_t0_apdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
struct ISO7816_Command_APDU {
//header
uint8_t CLA;
uint32_t INS;
uint8_t INS;
uint8_t P1;
uint8_t P2;

//body
uint8_t Nc;
uint8_t Ne;
uint8_t Lc;
uint8_t Le;
} __attribute__((packed));

struct ISO7816_Response_APDU {
uint8_t SW1;
uint32_t SW2;
uint8_t SW2;
} __attribute__((packed));

void iso7816_answer_to_reset(uint8_t* atrBuffer, uint32_t* atrlen);
Expand Down
4 changes: 2 additions & 2 deletions applications/examples/example_apps_assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ We recommend to use the `APP_ASSETS_PATH` macro to get the path to the Apps Asse

## What is the difference between the Apps Assets folder and the Apps Data folder?

The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (contant data) in the Apps Assets folder.
The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (content data) in the Apps Assets folder.

The Apps Data folder is used to store data <u>generated</u> by the application. For example, if you want to create a game, you can save the progress of the game (user-generated data) in the Apps Data folder.

Expand Down Expand Up @@ -55,4 +55,4 @@ When app is launched, the `files` folder will be unpacked to the Apps Assets fol

The data is unpacked when the application starts, if the application is launched for the first time, or if the data within the application is updated.

When an application is compiled, the contents of the "files" folder are hashed and stored within the application itself. When the application starts, this hash is compared to the hash stored in the `.assets.signature` file. If the hashes differ or the `.assets.signature` file does not exist, the application folder is deleted and the new data is unpacked.
When an application is compiled, the contents of the "files" folder are hashed and stored within the application itself. When the application starts, this hash is compared to the hash stored in the `.assets.signature` file. If the hashes differ or the `.assets.signature` file does not exist, the application folder is deleted and the new data is unpacked.
4 changes: 2 additions & 2 deletions applications/examples/example_apps_data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ We recommend to use the `APP_DATA_PATH` macro to get the path to the Apps Data f

## What is the difference between the Apps Assets folder and the Apps Data folder?

The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (contant data) in the Apps Assets folder.
The Apps Assets folder is used to store the data <u>provided</u> with the application. For example, if you want to create a game, you can store game levels (content data) in the Apps Assets folder.

The Apps Data folder is used to store data <u>generated</u> by the application. For example, if you want to create a game, you can save the progress of the game (user-generated data) in the Apps Data folder.
The Apps Data folder is used to store data <u>generated</u> by the application. For example, if you want to create a game, you can save the progress of the game (user-generated data) in the Apps Data folder.
2 changes: 1 addition & 1 deletion applications/examples/example_plugins/plugin_interface.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

/* Common interface between a plugin and host applicaion */
/* Common interface between a plugin and host application */

#define PLUGIN_APP_ID "example_plugins"
#define PLUGIN_API_VERSION 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

/* Common interface between a plugin and host applicaion */
/* Common interface between a plugin and host application */

#define PLUGIN_APP_ID "example_plugins_advanced"
#define PLUGIN_API_VERSION 1
Expand Down
11 changes: 5 additions & 6 deletions applications/examples/example_thermo/example_thermo.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static void example_thermo_request_temperature(ExampleThermoContext* context) {
bool success = false;
do {
/* Each communication with a 1-wire device starts by a reset.
The functon will return true if a device responded with a presence pulse. */
The function will return true if a device responded with a presence pulse. */
if(!onewire_host_reset(onewire)) break;
/* After the reset, a ROM operation must follow.
If there is only one device connected, the "Skip ROM" command is most appropriate
Expand Down Expand Up @@ -130,7 +130,7 @@ static void example_thermo_read_temperature(ExampleThermoContext* context) {
size_t attempts_left = 10;
do {
/* Each communication with a 1-wire device starts by a reset.
The functon will return true if a device responded with a presence pulse. */
The function will return true if a device responded with a presence pulse. */
if(!onewire_host_reset(onewire)) continue;

/* After the reset, a ROM operation must follow.
Expand Down Expand Up @@ -221,8 +221,7 @@ static void example_thermo_draw_callback(Canvas* canvas, void* ctx) {
canvas_draw_line(canvas, 0, 16, 128, 16);

canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(
canvas, middle_x, 30, AlignCenter, AlignBottom, "Connnect thermometer");
canvas_draw_str_aligned(canvas, middle_x, 30, AlignCenter, AlignBottom, "Connect thermometer");

snprintf(
text_store,
Expand All @@ -237,7 +236,7 @@ static void example_thermo_draw_callback(Canvas* canvas, void* ctx) {
float temp;
char temp_units;

/* The applicaton is locale-aware.
/* The application is locale-aware.
Change Settings->System->Units to check it out. */
switch(locale_get_measurement_unit()) {
case LocaleMeasurementUnitsMetric:
Expand Down Expand Up @@ -355,7 +354,7 @@ int32_t example_thermo_main(void* p) {
/* Allocate all of the necessary structures */
ExampleThermoContext* context = example_thermo_context_alloc();

/* Start the applicaton's main loop. It won't return until the application was requested to exit. */
/* Start the application's main loop. It won't return until the application was requested to exit. */
example_thermo_run(context);

/* Release all unneeded resources */
Expand Down
2 changes: 1 addition & 1 deletion applications/main/bad_usb/helpers/ducky_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static int32_t ducky_fnc_string(BadUsbScript* bad_usb, const char* line, int32_t
furi_string_cat(bad_usb->string_print, "\n");
}

if(bad_usb->stringdelay == 0) { // stringdelay not set - run command immidiately
if(bad_usb->stringdelay == 0) { // stringdelay not set - run command immediately
bool state = ducky_string(bad_usb, furi_string_get_cstr(bad_usb->string_print));
if(!state) {
return ducky_error(bad_usb, "Invalid string %s", line);
Expand Down
17 changes: 10 additions & 7 deletions applications/services/notification/notification_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ static void notification_process_notification_message(
}
break;
case NotificationMessageTypeLedDisplayBacklightEnforceOn:
furi_assert(app->display_led_lock < UINT8_MAX);
furi_check(app->display_led_lock < UINT8_MAX);
app->display_led_lock++;
if(app->display_led_lock == 1) {
notification_apply_internal_led_layer(
Expand All @@ -237,12 +237,15 @@ static void notification_process_notification_message(
}
break;
case NotificationMessageTypeLedDisplayBacklightEnforceAuto:
furi_assert(app->display_led_lock > 0);
app->display_led_lock--;
if(app->display_led_lock == 0) {
notification_apply_internal_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting);
if(app->display_led_lock > 0) {
app->display_led_lock--;
if(app->display_led_lock == 0) {
notification_apply_internal_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting);
}
} else {
FURI_LOG_E(TAG, "Incorrect BacklightEnforce use");
}
break;
case NotificationMessageTypeLedRed:
Expand Down
2 changes: 1 addition & 1 deletion applications/system/updater/util/update_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static const struct {
.stage = UpdateTaskStageRadioBusy,
.percent_min = 11,
.percent_max = 20,
.descr = "C2 FUS swich failed",
.descr = "C2 FUS switch failed",
},
{
.stage = UpdateTaskStageRadioBusy,
Expand Down
2 changes: 1 addition & 1 deletion documentation/AppsOnSDCard.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To build your application as a FAP, create a folder with your app's source code

- To build your application, run `./fbt fap_{APPID}`, where APPID is your application's ID in its manifest.
- To build your app and upload it over USB to run on Flipper, use `./fbt launch APPSRC=applications_user/path/to/app`. This command is configured in the default [VS Code profile](../.vscode/ReadMe.md) as a "Launch App on Flipper" build action (Ctrl+Shift+B menu).
- To build an app without uploading it to Flipper, use `./fbt build APPSRC=applications_user/path/to/app`. This command is also availabe in VSCode configuration as "Build App".
- To build an app without uploading it to Flipper, use `./fbt build APPSRC=applications_user/path/to/app`. This command is also available in VSCode configuration as "Build App".
- To build all FAPs, run `./fbt faps` or `./fbt fap_dist`.

## FAP assets
Expand Down
10 changes: 5 additions & 5 deletions documentation/file_formats/BadUsbScriptFormat.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BadUsb app uses extended Duckyscript syntax. It is compatible with classic USB R

# Script file format

BadUsb app can execute only text scrips from `.txt` files, no compilation is required. Both `\n` and `\r\n` line endings are supported. Empty lines are allowed. You can use spaces or tabs for line indentation.
BadUsb app can execute only text scripts from `.txt` files, no compilation is required. Both `\n` and `\r\n` line endings are supported. Empty lines are allowed. You can use spaces or tabs for line indentation.

# Command set

Expand Down Expand Up @@ -72,10 +72,10 @@ Can be combined with a special key command or a single character.
## Key hold and release

Up to 5 keys can be hold simultaneously.
| Command | Parameters | Notes |
| ------- | ------------------------------- | ----------------------------------------- |
| HOLD | Special key or single character | Press and hold key untill RELEASE command |
| RELEASE | Special key or single character | Release key |
| Command | Parameters | Notes |
| ------- | ------------------------------- | ---------------------------------------- |
| HOLD | Special key or single character | Press and hold key until RELEASE command |
| RELEASE | Special key or single character | Release key |

## Wait for button press

Expand Down
2 changes: 1 addition & 1 deletion fbt_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
COPRO_OB_DATA = "scripts/ob.data"

# Must match lib/stm32wb_copro version
COPRO_CUBE_VERSION = "1.17.2"
COPRO_CUBE_VERSION = "1.17.3"

COPRO_CUBE_DIR = "lib/stm32wb_copro"

Expand Down
4 changes: 2 additions & 2 deletions firmware/targets/f18/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,39.1,,
Version,+,39.2,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
Expand Down Expand Up @@ -2006,7 +2006,7 @@ Function,+,storage_file_open,_Bool,"File*, const char*, FS_AccessMode, FS_OpenMo
Function,+,storage_file_read,uint16_t,"File*, void*, uint16_t"
Function,+,storage_file_seek,_Bool,"File*, uint32_t, _Bool"
Function,+,storage_file_size,uint64_t,File*
Function,-,storage_file_sync,_Bool,File*
Function,+,storage_file_sync,_Bool,File*
Function,+,storage_file_tell,uint64_t,File*
Function,+,storage_file_truncate,_Bool,File*
Function,+,storage_file_write,uint16_t,"File*, const void*, uint16_t"
Expand Down
4 changes: 2 additions & 2 deletions firmware/targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,39.1,,
Version,+,39.2,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Expand Down Expand Up @@ -2658,7 +2658,7 @@ Function,+,storage_file_open,_Bool,"File*, const char*, FS_AccessMode, FS_OpenMo
Function,+,storage_file_read,uint16_t,"File*, void*, uint16_t"
Function,+,storage_file_seek,_Bool,"File*, uint32_t, _Bool"
Function,+,storage_file_size,uint64_t,File*
Function,-,storage_file_sync,_Bool,File*
Function,+,storage_file_sync,_Bool,File*
Function,+,storage_file_tell,uint64_t,File*
Function,+,storage_file_truncate,_Bool,File*
Function,+,storage_file_write,uint16_t,"File*, const void*, uint16_t"
Expand Down
2 changes: 1 addition & 1 deletion firmware/targets/f7/ble_glue/ble_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PLACE_IN_SECTION("MB_MEM2") ALIGN(4) static uint32_t ble_app_nvm[BLE_NVM_SRAM_SI

_Static_assert(
sizeof(SHCI_C2_Ble_Init_Cmd_Packet_t) == 58,
"Ble stack config structure size mismatch (check new config options - last updated for v.1.17.2)");
"Ble stack config structure size mismatch (check new config options - last updated for v.1.17.3)");

typedef struct {
FuriMutex* hci_mtx;
Expand Down
6 changes: 4 additions & 2 deletions firmware/targets/f7/ble_glue/services/dev_info_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static bool dev_info_char_firmware_rev_callback(
const uint8_t** data,
uint16_t* data_len) {
const DevInfoSvc* dev_info_svc = *(DevInfoSvc**)context;
*data_len = sizeof(dev_info_svc->hardware_revision);
*data_len = strlen(dev_info_svc->hardware_revision);
if(data) {
*data = (const uint8_t*)&dev_info_svc->hardware_revision;
}
Expand Down Expand Up @@ -155,17 +155,19 @@ void dev_info_svc_start() {
void dev_info_svc_stop() {
tBleStatus status;
if(dev_info_svc) {
furi_string_free(dev_info_svc->version_string);
// Delete service characteristics
for(size_t i = 0; i < DevInfoSvcGattCharacteristicCount; i++) {
flipper_gatt_characteristic_delete(
dev_info_svc->service_handle, &dev_info_svc->characteristics[i]);
}

// Delete service
status = aci_gatt_del_service(dev_info_svc->service_handle);
if(status) {
FURI_LOG_E(TAG, "Failed to delete device info service: %d", status);
}

furi_string_free(dev_info_svc->version_string);
free(dev_info_svc);
dev_info_svc = NULL;
}
Expand Down
Loading

0 comments on commit 76e5a1c

Please sign in to comment.