-
Notifications
You must be signed in to change notification settings - Fork 3.2k
BadUSB: Keyboard Layouts #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
BadUSB: Keyboard Layouts #2256
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1d45d47
BadUSB: Keyboard Layouts
xMasterX 718d258
Merge branch 'dev' into badusb_kblayouts
nminaylov aae39b9
Merge branch 'dev' into badusb_kblayouts
nminaylov fe6ec94
Apply requested changes pt1
xMasterX a84498d
Add layout file check when we loading config
xMasterX e1a653b
Merge branch 'dev' into badusb_kblayouts
skotopes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #pragma once | ||
|
|
||
| #define BAD_USB_SETTINGS_FILE_NAME ".badusb.settings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #include "../bad_usb_app_i.h" | ||
| #include "furi_hal_power.h" | ||
| #include "furi_hal_usb.h" | ||
|
|
||
| enum SubmenuIndex { | ||
| SubmenuIndexKeyboardLayout, | ||
| }; | ||
|
|
||
| void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) { | ||
| BadUsbApp* bad_usb = context; | ||
| view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); | ||
| } | ||
|
|
||
| void bad_usb_scene_config_on_enter(void* context) { | ||
| BadUsbApp* bad_usb = context; | ||
| Submenu* submenu = bad_usb->submenu; | ||
|
|
||
| submenu_add_item( | ||
| submenu, | ||
| "Keyboard layout", | ||
| SubmenuIndexKeyboardLayout, | ||
| bad_usb_scene_config_submenu_callback, | ||
| bad_usb); | ||
|
|
||
| submenu_set_selected_item( | ||
| submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); | ||
|
|
||
| view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfig); | ||
| } | ||
|
|
||
| bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) { | ||
| BadUsbApp* bad_usb = context; | ||
| bool consumed = false; | ||
|
|
||
| if(event.type == SceneManagerEventTypeCustom) { | ||
| scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event); | ||
| consumed = true; | ||
| if(event.event == SubmenuIndexKeyboardLayout) { | ||
| scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); | ||
| } else { | ||
| furi_crash("Unknown key type"); | ||
| } | ||
| } | ||
|
|
||
| return consumed; | ||
| } | ||
|
|
||
| void bad_usb_scene_config_on_exit(void* context) { | ||
| BadUsbApp* bad_usb = context; | ||
| Submenu* submenu = bad_usb->submenu; | ||
|
|
||
| submenu_reset(submenu); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| ADD_SCENE(bad_usb, file_select, FileSelect) | ||
| ADD_SCENE(bad_usb, work, Work) | ||
| ADD_SCENE(bad_usb, error, Error) | ||
| ADD_SCENE(bad_usb, config, Config) | ||
| ADD_SCENE(bad_usb, config_layout, ConfigLayout) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.