레이블이 key인 게시물을 표시합니다. 모든 게시물 표시
레이블이 key인 게시물을 표시합니다. 모든 게시물 표시

2017년 1월 4일 수요일

How to use GPIO key in ODROID-C2(android).

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.html

F76541 c165[18~ 1b 5b 31 38 7e[31~ 1b 5b 33 31 7e[18~ 1b 5b 31 38 7e
F86642 c266[19~ 1b 5b 31 39 7e[32~ 1b 5b 33 32 7e[19~ 1b 5b 31 39 7e
F96743 c367[20~ 1b 5b 32 30 7e[33~ 1b 5b 33 33 7e[20~ 1b 5b 32 30 7e
F106844 c468[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_connectors


https://github.com/hardkernel/linux/commit/6c5f6929b5f351d54929b6ba3921db7d48115a4f

edit 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.