How to use GPIO key in ODROID-C2(android).
Builtin GPIO polled driver.
CONFIG_KEYBOARD_GPIO_POLLED
linux keycode table
http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlkeycodes.htmlF7 | 65 | 41 c1 | 65 | [18~ 1b 5b 31 38 7e | [31~ 1b 5b 33 31 7e | [18~ 1b 5b 31 38 7e | |
F8 | 66 | 42 c2 | 66 | [19~ 1b 5b 31 39 7e | [32~ 1b 5b 33 32 7e | [19~ 1b 5b 31 39 7e | |
F9 | 67 | 43 c3 | 67 | [20~ 1b 5b 32 30 7e | [33~ 1b 5b 33 33 7e | [20~ 1b 5b 32 30 7e | |
F10 | 68 | 44 c4 | 68 | [21~ 1b 5b 32 31 7e | [34~ 1b 5b 33 34 7e | [21~ 1b 5b 32 32 7e |
Expansion Connectors
http://odroid.com/dokuwiki/doku.php?id=en:c2_hardware#expansion_connectorsedit arch/arm64/boot/dts/meson64_odroidc2.dts
gpio_keys_polled {
compatible =
"gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <100>;
autorepeat;
button@1 {
label = "GPIO Key F7";
linux,code = <65>;
gpios = <&gpio GPIOX_19 1>;
};
button@2 {
label = "GPIO Key F8";
linux,code = <66>;
gpios = <&gpio GPIOX_11 1>;
};
button@3 {
label = "GPIO Key F9";
linux,code = <67>;
gpios = <&gpio GPIOX_9 1>;
};
button@4 {
label = "GPIO Key F10";
linux,code = <68>;
gpios = <&gpio GPIOX_7 1>;
};
};
$ cd kernel
$ make odroidc2_defconfig
$ make -j8
$ adb reboot fastboot
$ fastboot flash dtb arch/arm64/boot/dts/meson64_odroidc2.dtb
You can receive key event(scancode) without keycode.
https://github.com/codewalkerster/android_device_hardkernel_odroidc2/commit/7b49c29162c884491df262a3ec3d96f08942e231
Add keycode in system/usr/keylayout/Vendor_0001_Product_0001.kl.
key 75 F3
key 76 F4
key 77 F5
key 64 F6
key 65 F7
key 66 F8
key 67 F9
key 68 F10
key 69 F11
Android will fill keycode matched scancode in key event.