From 301c52b6031f97370af76b009c434696111d567d Mon Sep 17 00:00:00 2001 From: Andy Rich Date: Tue, 20 Mar 2018 18:04:40 -0700 Subject: [PATCH] Add support for CTRL+S to send hardware "shake" to device w/readme --- README.md | 1 + app/src/inputmanager.c | 7 +++++++ app/src/main.c | 3 +++ 3 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 5be9a8a7..8ca43de9 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,7 @@ To run without installing: | click on `HOME` | `Ctrl`+`h` \| _Middle-click_ | | click on `BACK` | `Ctrl`+`b` \| _Right-click²_ | | click on `APP_SWITCH` | `Ctrl`+`m` | + | click on `MENU` | `Ctrl`+`s` | | click on `VOLUME_UP` | `Ctrl`+`+` | | click on `VOLUME_DOWN` | `Ctrl`+`-` | | click on `POWER` | `Ctrl`+`p` | diff --git a/app/src/inputmanager.c b/app/src/inputmanager.c index 19830685..93c519fc 100644 --- a/app/src/inputmanager.c +++ b/app/src/inputmanager.c @@ -78,6 +78,10 @@ static inline void action_volume_down(struct controller *controller) { send_keycode(controller, AKEYCODE_VOLUME_DOWN, "VOLUME_DOWN"); } +static inline void action_shake(struct controller *controller) { + send_keycode(controller, AKEYCODE_MENU, "SHAKE"); +} + // turn the screen on if it was off, press BACK otherwise static void press_back_or_turn_screen_on(struct controller *controller) { struct control_event control_event; @@ -179,6 +183,9 @@ void input_manager_process_key(struct input_manager *input_manager, case SDLK_m: action_app_switch(input_manager->controller); return; + case SDLK_s: + action_shake(input_manager->controller); + return; case SDLK_p: action_power(input_manager->controller); return; diff --git a/app/src/main.c b/app/src/main.c index 60ce023e..2b1f2c92 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -73,6 +73,9 @@ static void usage(const char *arg0) { " Ctrl+m\n" " click on APP_SWITCH\n" "\n" + " Ctrl+s\n" + " click on MENU\n" + "\n" " Ctrl+'+'\n" " click on VOLUME_UP\n" "\n"