diff options
Diffstat (limited to 'ui.h')
-rw-r--r-- | ui.h | 27 |
1 files changed, 25 insertions, 2 deletions
@@ -77,11 +77,20 @@ class RecoveryUI { // Return value indicates whether an immediate operation should be // triggered (toggling the display, rebooting the device), or if // the key should be enqueued for use by the main thread. - enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE }; + enum KeyAction { ENQUEUE, TOGGLE, REBOOT, IGNORE, MOUNT_SYSTEM }; virtual KeyAction CheckKey(int key); + // Called immediately before each call to CheckKey(), tell you if + // the key was long-pressed. virtual void NextCheckKeyIsLong(bool is_long_press); + // Called when a key is held down long enough to have been a + // long-press (but before the key is released). This means that + // if the key is eventually registered (released without any other + // keys being pressed in the meantime), NextCheckKeyIsLong() will + // be called with "true". + virtual void KeyLongPress(int key); + // --- menu display --- // Display some header text followed by a menu of items, which appears @@ -108,15 +117,29 @@ private: int key_queue[256], key_queue_len; char key_pressed[KEY_MAX + 1]; // under key_queue_mutex int key_last_down; // under key_queue_mutex - clock_t key_down_time; // under key_queue_mutex + bool key_long_press; // under key_queue_mutex + int key_down_count; // under key_queue_mutex int rel_sum; + int consecutive_power_keys; + int consecutive_alternate_keys; + int last_key; + + typedef struct { + RecoveryUI* ui; + int key_code; + int count; + } key_timer_t; + pthread_t input_t; static void* input_thread(void* cookie); static int input_callback(int fd, short revents, void* data); void process_key(int key_code, int updown); bool usb_connected(); + + static void* time_key_helper(void* cookie); + void time_key(int key_code, int count); }; #endif // RECOVERY_UI_H |