Skip to content

Commit d5b197e

Browse files
authored
Merge branch 'dev' into dev
2 parents 625ef01 + 9bdf41d commit d5b197e

26 files changed

+373
-74
lines changed
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/services/dolphin/dolphin.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ void dolphin_deed(DolphinDeed deed) {
4747
furi_record_close(RECORD_DOLPHIN);
4848
}
4949

50+
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings) {
51+
furi_check(dolphin);
52+
furi_check(settings);
53+
54+
DolphinEvent event;
55+
event.type = DolphinEventTypeSettingsGet;
56+
event.settings = settings;
57+
dolphin_event_send_wait(dolphin, &event);
58+
}
59+
60+
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings) {
61+
furi_check(dolphin);
62+
furi_check(settings);
63+
64+
DolphinEvent event;
65+
event.type = DolphinEventTypeSettingsSet;
66+
event.settings = settings;
67+
dolphin_event_send_wait(dolphin, &event);
68+
}
69+
5070
DolphinStats dolphin_stats(Dolphin* dolphin) {
5171
furi_check(dolphin);
5272

@@ -211,7 +231,9 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
211231

212232
} else if(event.type == DolphinEventTypeStats) {
213233
event.stats->icounter = dolphin->state->data.icounter;
214-
event.stats->butthurt = dolphin->state->data.butthurt;
234+
event.stats->butthurt = (dolphin->state->data.flags & DolphinFlagHappyMode) ?
235+
0 :
236+
dolphin->state->data.butthurt;
215237
event.stats->timestamp = dolphin->state->data.timestamp;
216238
event.stats->level = dolphin_get_level(dolphin->state->data.icounter);
217239
event.stats->level_up_is_pending =
@@ -228,6 +250,15 @@ static bool dolphin_process_event(FuriEventLoopObject* object, void* context) {
228250
dolphin_state_load(dolphin->state);
229251
furi_event_loop_timer_start(dolphin->butthurt_timer, BUTTHURT_INCREASE_PERIOD_TICKS);
230252

253+
} else if(event.type == DolphinEventTypeSettingsGet) {
254+
event.settings->happy_mode = dolphin->state->data.flags & DolphinFlagHappyMode;
255+
256+
} else if(event.type == DolphinEventTypeSettingsSet) {
257+
dolphin->state->data.flags &= ~DolphinFlagHappyMode;
258+
if(event.settings->happy_mode) dolphin->state->data.flags |= DolphinFlagHappyMode;
259+
dolphin->state->dirty = true;
260+
dolphin_state_save(dolphin->state);
261+
231262
} else {
232263
furi_crash();
233264
}

applications/services/dolphin/dolphin.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ typedef struct {
2121
bool level_up_is_pending;
2222
} DolphinStats;
2323

24+
typedef struct {
25+
bool happy_mode;
26+
} DolphinSettings;
27+
2428
typedef enum {
2529
DolphinPubsubEventUpdate,
2630
} DolphinPubsubEvent;
@@ -31,6 +35,10 @@ typedef enum {
3135
*/
3236
void dolphin_deed(DolphinDeed deed);
3337

38+
void dolphin_get_settings(Dolphin* dolphin, DolphinSettings* settings);
39+
40+
void dolphin_set_settings(Dolphin* dolphin, DolphinSettings* settings);
41+
3442
/** Retrieve dolphin stats
3543
* Thread safe, blocking
3644
*/

applications/services/dolphin/dolphin_i.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ typedef enum {
1313
DolphinEventTypeFlush,
1414
DolphinEventTypeLevel,
1515
DolphinEventTypeReloadState,
16+
DolphinEventTypeSettingsGet,
17+
DolphinEventTypeSettingsSet,
1618
} DolphinEventType;
1719

1820
typedef struct {
@@ -21,6 +23,7 @@ typedef struct {
2123
union {
2224
DolphinDeed deed;
2325
DolphinStats* stats;
26+
DolphinSettings* settings;
2427
};
2528
} DolphinEvent;
2629

applications/services/dolphin/helpers/dolphin_state.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
#include "dolphin_deed.h"
77

8+
typedef enum {
9+
DolphinFlagHappyMode = 1,
10+
} DolphinFlags;
11+
812
typedef struct DolphinState DolphinState;
913
typedef struct {
1014
uint8_t icounter_daily_limit[DolphinAppMAX];

applications/settings/desktop_settings/desktop_settings_app.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <furi.h>
22
#include <gui/modules/popup.h>
3+
#include <gui/modules/dialog_ex.h>
34
#include <gui/scene_manager.h>
45

56
#include <desktop/desktop.h>
@@ -42,6 +43,7 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
4243
app->pin_input_view = desktop_view_pin_input_alloc();
4344
app->pin_setup_howto_view = desktop_settings_view_pin_setup_howto_alloc();
4445
app->pin_setup_howto2_view = desktop_settings_view_pin_setup_howto2_alloc();
46+
app->dialog_ex = dialog_ex_alloc();
4547

4648
view_dispatcher_add_view(
4749
app->view_dispatcher, DesktopSettingsAppViewMenu, submenu_get_view(app->submenu));
@@ -63,6 +65,8 @@ DesktopSettingsApp* desktop_settings_app_alloc(void) {
6365
app->view_dispatcher,
6466
DesktopSettingsAppViewIdPinSetupHowto2,
6567
desktop_settings_view_pin_setup_howto2_get_view(app->pin_setup_howto2_view));
68+
view_dispatcher_add_view(
69+
app->view_dispatcher, DesktopSettingsAppViewDialogEx, dialog_ex_get_view(app->dialog_ex));
6670
return app;
6771
}
6872

@@ -75,12 +79,14 @@ void desktop_settings_app_free(DesktopSettingsApp* app) {
7579
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinInput);
7680
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto);
7781
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewIdPinSetupHowto2);
82+
view_dispatcher_remove_view(app->view_dispatcher, DesktopSettingsAppViewDialogEx);
7883
variable_item_list_free(app->variable_item_list);
7984
submenu_free(app->submenu);
8085
popup_free(app->popup);
8186
desktop_view_pin_input_free(app->pin_input_view);
8287
desktop_settings_view_pin_setup_howto_free(app->pin_setup_howto_view);
8388
desktop_settings_view_pin_setup_howto2_free(app->pin_setup_howto2_view);
89+
dialog_ex_free(app->dialog_ex);
8490
// View dispatcher
8591
view_dispatcher_free(app->view_dispatcher);
8692
scene_manager_free(app->scene_manager);

applications/settings/desktop_settings/desktop_settings_app.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <gui/scene_manager.h>
77
#include <gui/modules/submenu.h>
88
#include <gui/modules/variable_item_list.h>
9+
#include <gui/modules/dialog_ex.h>
910
#include <dialogs/dialogs.h>
1011
#include <assets_icons.h>
1112

@@ -21,6 +22,7 @@ typedef enum {
2122
DesktopSettingsAppViewIdPinInput,
2223
DesktopSettingsAppViewIdPinSetupHowto,
2324
DesktopSettingsAppViewIdPinSetupHowto2,
25+
DesktopSettingsAppViewDialogEx,
2426
} DesktopSettingsAppView;
2527

2628
typedef struct {
@@ -36,6 +38,7 @@ typedef struct {
3638
DesktopViewPinInput* pin_input_view;
3739
DesktopSettingsViewPinSetupHowto* pin_setup_howto_view;
3840
DesktopSettingsViewPinSetupHowto2* pin_setup_howto2_view;
41+
DialogEx* dialog_ex;
3942

4043
DesktopPinCode pincode_buffer;
4144
bool pincode_buffer_filled;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
typedef enum {
8+
// reserve 100 for button presses, submenu selections, etc.
9+
DesktopSettingsCustomEventExit = 100,
10+
DesktopSettingsCustomEventDone,
11+
12+
DesktopSettingsCustomEvent1stPinEntered,
13+
DesktopSettingsCustomEventPinsEqual,
14+
DesktopSettingsCustomEventPinsDifferent,
15+
16+
DesktopSettingsCustomEventSetPin,
17+
DesktopSettingsCustomEventChangePin,
18+
DesktopSettingsCustomEventDisablePin,
19+
20+
DesktopSettingsCustomEventSetDefault,
21+
DesktopSettingsCustomEventSetDummy,
22+
} DesktopSettingsCustomEvent;
23+
24+
#ifdef __cplusplus
25+
}
26+
#endif

applications/settings/desktop_settings/scenes/desktop_settings_scene_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ ADD_SCENE(desktop_settings, pin_setup_done, PinSetupDone)
1212

1313
ADD_SCENE(desktop_settings, quick_apps_menu, QuickAppsMenu)
1414
ADD_SCENE(desktop_settings, quick_apps_direction_menu, QuickAppsDirectionMenu)
15+
16+
ADD_SCENE(desktop_settings, happy_mode, HappyMode)

0 commit comments

Comments
 (0)