summaryrefslogtreecommitdiff
path: root/recovery
diff options
context:
space:
mode:
authorSam Protsenko <semen.protsenko@linaro.org>2019-08-21 21:51:09 +0300
committerSam Protsenko <semen.protsenko@linaro.org>2019-08-22 15:52:27 +0300
commit4a9fe6c080a01b82558140e02d7c21ab00b29c73 (patch)
tree1bfe4e5f56da744c02649b5e58306acdbde7adb9 /recovery
parent28bdf76226904db8c391d9246b95833b9bfaadd0 (diff)
downloadbeagle-x15-4a9fe6c080a01b82558140e02d7c21ab00b29c73.tar.gz
Add HW keys handling in recovery UI
Implement custom handling of hardware keys on AM57x EVM in recovery UI. Without this it's impossible to actually select some item in recovery menu. Insights about keys override and custom recovery_ui implementation were given from [1,2]. This is needed because power button is not handled as user button in input event subsystem, and long press not being handled in RecoveryUI class on AM57x EVM board as well. Touchscreen can't be used, as we don't copy touchscreen kernel module into recovery image (it shouldn't be in recovery, as stated in [3]). X15 board doesn't have hardware buttons, so this patch only affects AM57x EVM. On X15 one should use the keyboard or mouse connected to host USB ports. [1] https://source.android.com/devices/tech/ota/nonab/device_code [2] device/linaro/hikey/recovery/* [3] https://source.android.com/devices/architecture/kernel/loadable-kernel-modules Change-Id: Ie31c5c26f917278b565c8653f13bf1ba5db47841 Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
Diffstat (limited to 'recovery')
-rw-r--r--recovery/Android.bp32
-rw-r--r--recovery/recovery_ui.cpp47
2 files changed, 79 insertions, 0 deletions
diff --git a/recovery/Android.bp b/recovery/Android.bp
new file mode 100644
index 0000000..b2eab67
--- /dev/null
+++ b/recovery/Android.bp
@@ -0,0 +1,32 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_library_static {
+ name: "librecovery_ui_beagle_x15",
+ owner: "ti",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-pedantic",
+ ],
+ srcs: [
+ "recovery_ui.cpp",
+ ],
+ shared_libs: [
+ "librecovery_ui",
+ ],
+}
diff --git a/recovery/recovery_ui.cpp b/recovery/recovery_ui.cpp
new file mode 100644
index 0000000..6ea5b1e
--- /dev/null
+++ b/recovery/recovery_ui.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <recovery_ui/device.h>
+#include <recovery_ui/screen_ui.h>
+
+namespace android {
+namespace device {
+namespace ti {
+namespace beagle_x15 {
+
+class BeagleX15UI : public ::ScreenRecoveryUI
+{
+ RecoveryUI::KeyAction CheckKey(int key, bool is_long_press) {
+ // Use "Home" key (called USER5 on AM57x EVM) to select the item,
+ // because it's impossible to reproduce long press, and we can't use
+ // "Power" button as a chord for toggle
+ if (key == KEY_HOME) {
+ return RecoveryUI::TOGGLE;
+ }
+
+ return RecoveryUI::CheckKey(key, is_long_press);
+ }
+};
+
+} // namespace beagle_x15
+} // namespace ti
+} // namespace device
+} // namespace android
+
+Device *make_device()
+{
+ return new Device(new ::android::device::ti::beagle_x15::BeagleX15UI());
+}