Skip to content

Commit 4073a1b

Browse files
Merge branch 'dev' into portasynthinca3/3348-softspi
2 parents 65bc290 + 5f4f4fc commit 4073a1b

File tree

58 files changed

+664
-215
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+664
-215
lines changed

applications/debug/rpc_debug_app/rpc_debug_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static void rpc_debug_app_tick_event_callback(void* context) {
2424
static void
2525
rpc_debug_app_format_hex(const uint8_t* data, size_t data_size, char* buf, size_t buf_size) {
2626
if(data == NULL || data_size == 0) {
27-
strncpy(buf, "<Data empty>", buf_size);
27+
strlcpy(buf, "<Data empty>", buf_size);
2828
return;
2929
}
3030

applications/debug/rpc_debug_app/scenes/rpc_debug_app_scene_input_error_code.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static void rpc_debug_app_scene_input_error_code_result_callback(void* context)
2626

2727
void rpc_debug_app_scene_input_error_code_on_enter(void* context) {
2828
RpcDebugApp* app = context;
29-
strncpy(app->text_store, "666", TEXT_STORE_SIZE);
29+
strlcpy(app->text_store, "666", TEXT_STORE_SIZE);
3030
text_input_set_header_text(app->text_input, "Enter error code");
3131
text_input_set_validator(
3232
app->text_input, rpc_debug_app_scene_input_error_code_validator_callback, NULL);

applications/debug/rpc_debug_app/scenes/rpc_debug_app_scene_input_error_text.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ static void rpc_debug_app_scene_input_error_text_result_callback(void* context)
77

88
void rpc_debug_app_scene_input_error_text_on_enter(void* context) {
99
RpcDebugApp* app = context;
10-
strncpy(app->text_store, "I'm a scary error message!", TEXT_STORE_SIZE);
10+
strlcpy(app->text_store, "I'm a scary error message!", TEXT_STORE_SIZE);
1111
text_input_set_header_text(app->text_input, "Enter error text");
1212
text_input_set_result_callback(
1313
app->text_input,

applications/debug/rpc_debug_app/scenes/rpc_debug_app_scene_receive_data_exchange.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
void rpc_debug_app_scene_receive_data_exchange_on_enter(void* context) {
44
RpcDebugApp* app = context;
5-
strncpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);
5+
strlcpy(app->text_store, "Received data will appear here...", TEXT_STORE_SIZE);
66

77
text_box_set_text(app->text_box, app->text_store);
88
text_box_set_font(app->text_box, TextBoxFontHex);

applications/examples/example_thermo/example_thermo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static void example_thermo_draw_callback(Canvas* canvas, void* ctx) {
257257
snprintf(text_store, TEXT_STORE_SIZE, "Temperature: %+.1f%c", (double)temp, temp_units);
258258
} else {
259259
/* Or show a message that no data is available */
260-
strncpy(text_store, "-- No data --", TEXT_STORE_SIZE);
260+
strlcpy(text_store, "-- No data --", TEXT_STORE_SIZE);
261261
}
262262

263263
canvas_draw_str_aligned(canvas, middle_x, 58, AlignCenter, AlignBottom, text_store);
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
ID 1234:abcd Generic:USB Keyboard
2+
REM Declare ourselves as a generic usb keyboard
3+
4+
REM This will install qFlipper on Linux/Gnome, using the latest AppImage package
5+
6+
REM Open a terminal
7+
ALT F2
8+
DELAY 1000
9+
STRINGLN gnome-terminal --maximize
10+
DELAY 1000
11+
12+
REM Ensure we have a folder to run executables from
13+
STRINGLN mkdir -p $HOME/.local/bin
14+
15+
REM Download the latest AppImage
16+
STRINGLN curl -fsSL "https://update.flipperzero.one/qFlipper/release/linux-amd64/AppImage" -o "$HOME/.local/bin/qFlipper"
17+
DELAY 1000
18+
19+
REM Make it executable
20+
STRINGLN chmod +x $HOME/.local/bin/qFlipper
21+
22+
REM Extract the appimage in /tmp to install icon and .desktop file
23+
STRINGLN cd /tmp
24+
STRINGLN $HOME/.local/bin/qFlipper --appimage-extract > /dev/null
25+
STRINGLN sed "s@Exec=qFlipper@Exec=$HOME/.local/bin/qFlipper@" squashfs-root/usr/share/applications/qFlipper.desktop > $HOME/.local/share/applications/qFlipper.desktop
26+
STRINGLN mkdir -p $HOME/.local/share/icons/hicolor/512x512/apps
27+
STRINGLN cp squashfs-root/usr/share/icons/hicolor/512x512/apps/qFlipper.png $HOME/.local/share/icons/hicolor/512x512/apps/qFlipper.png
28+
STRINGLN rm -rf squashfs-root
29+
STRINGLN cd
30+
31+
REM Depending on the Linux distribution and display manager
32+
REM there might be several ways to update desktop entries
33+
REM try all
34+
STRINGLN xdg-desktop-menu forceupdate || true
35+
STRINGLN update-desktop-database ~/.local/share/applications || true
36+
37+
STRINGLN echo "
38+
ENTER
39+
REPEAT 60
40+
STRINGLN ==========================================================================================
41+
STRINGLN qFlipper has been installed to $HOME/.local/bin/
42+
STRINGLN It should appear in your Applications menu.
43+
STRINGLN If it does not, you might want to log out and log in again.
44+
ENTER
45+
STRINGLN If you prefer to run qFlipper from your terminal, either use the absolute path
46+
STRINGLN or make sure $HOME/.local/bin/ is included in your PATH environment variable.
47+
ENTER
48+
STRINGLN Additional configurations might be required by your Linux distribution such as
49+
STRINGLN group membership, udev rules or else.
50+
STRINGLN ==========================================================================================
51+
STRINGLN "
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
ID 1234:abcd Generic:USB Keyboard
2+
REM Declare ourselves as a generic usb keyboard
3+
REM You can override this to use something else
4+
REM Check the `lsusb` command to know your own devices IDs
5+
6+
REM This is BadUSB demo script for Linux/Gnome
7+
8+
REM Open terminal window
9+
DELAY 1000
10+
ALT F2
11+
DELAY 500
12+
STRING gnome-terminal --maximize
13+
DELAY 500
14+
ENTER
15+
DELAY 750
16+
17+
REM Clear the screen in case some banner was displayed
18+
STRING clear
19+
ENTER
20+
21+
REM Bigger shell script example
22+
STRING cat > /dev/null << EOF
23+
ENTER
24+
25+
STRING Hello World!
26+
ENTER
27+
28+
DEFAULT_DELAY 50
29+
30+
STRING =
31+
REPEAT 59
32+
ENTER
33+
ENTER
34+
35+
STRING _.-------.._ -,
36+
ENTER
37+
HOME
38+
STRING .-"'''"--..,,_/ /'-, -, \
39+
ENTER
40+
HOME
41+
STRING .:" /:/ /'\ \ ,_..., '. | |
42+
ENTER
43+
HOME
44+
STRING / ,----/:/ /'\ _\~'_-"' _;
45+
ENTER
46+
HOME
47+
STRING ' / /'"""'\ \ \.~'_-' ,-"'/
48+
ENTER
49+
HOME
50+
STRING | | | 0 | | .-' ,/' /
51+
ENTER
52+
HOME
53+
STRING | ,..\ \ ,.-"' ,/' /
54+
ENTER
55+
HOME
56+
STRING ; : '/'""\' ,/--==,/-----,
57+
ENTER
58+
HOME
59+
STRING | '-...| -.___-Z:_______J...---;
60+
ENTER
61+
HOME
62+
STRING : ' _-'
63+
ENTER
64+
HOME
65+
STRING _L_ _ ___ ___ ___ ___ ____--"'
66+
ENTER
67+
HOME
68+
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
69+
ENTER
70+
HOME
71+
STRING | _| | |__ | | | _/| _/| _| | /
72+
ENTER
73+
HOME
74+
STRING |_| |____||___||_| |_| |___||_|_\
75+
ENTER
76+
HOME
77+
ENTER
78+
79+
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
80+
ENTER
81+
STRING More information about script syntax can be found here:
82+
ENTER
83+
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
84+
ENTER
85+
86+
STRING EOF
87+
ENTER

applications/main/ibutton/ibutton.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ bool ibutton_load_key(iButton* ibutton, bool show_error) {
183183
FuriString* tmp = furi_string_alloc();
184184

185185
path_extract_filename(ibutton->file_path, tmp, true);
186-
strncpy(ibutton->key_name, furi_string_get_cstr(tmp), IBUTTON_KEY_NAME_SIZE);
186+
strlcpy(ibutton->key_name, furi_string_get_cstr(tmp), IBUTTON_KEY_NAME_SIZE);
187187

188188
furi_string_free(tmp);
189189
} else if(show_error) {
@@ -243,7 +243,7 @@ bool ibutton_delete_key(iButton* ibutton) {
243243
}
244244

245245
void ibutton_reset_key(iButton* ibutton) {
246-
memset(ibutton->key_name, 0, IBUTTON_KEY_NAME_SIZE + 1);
246+
ibutton->key_name[0] = '\0';
247247
furi_string_reset(ibutton->file_path);
248248
ibutton_key_reset(ibutton->key);
249249
}

applications/main/ibutton/ibutton_i.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define IBUTTON_APP_FILENAME_PREFIX "iBtn"
3333
#define IBUTTON_APP_FILENAME_EXTENSION ".ibtn"
3434

35-
#define IBUTTON_KEY_NAME_SIZE 22
35+
#define IBUTTON_KEY_NAME_SIZE 23
3636

3737
typedef enum {
3838
iButtonWriteModeInvalid,
@@ -56,7 +56,7 @@ struct iButton {
5656
iButtonWriteMode write_mode;
5757

5858
FuriString* file_path;
59-
char key_name[IBUTTON_KEY_NAME_SIZE + 1];
59+
char key_name[IBUTTON_KEY_NAME_SIZE];
6060

6161
Submenu* submenu;
6262
ByteInput* byte_input;

applications/main/infrared/infrared_app_i.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
#define INFRARED_TEXT_STORE_NUM 2
4444
#define INFRARED_TEXT_STORE_SIZE 128
4545

46-
#define INFRARED_MAX_BUTTON_NAME_LENGTH 22
47-
#define INFRARED_MAX_REMOTE_NAME_LENGTH 22
46+
#define INFRARED_MAX_BUTTON_NAME_LENGTH 23
47+
#define INFRARED_MAX_REMOTE_NAME_LENGTH 23
4848

4949
#define INFRARED_APP_FOLDER EXT_PATH("infrared")
5050
#define INFRARED_APP_EXTENSION ".ir"

0 commit comments

Comments
 (0)