Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:c2_app_launch_via_gpio_on_android [2017/03/09 18:28] odroid |
en:c2_app_launch_via_gpio_on_android [2017/05/24 17:10] (current) codewalker |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== App launch via GPIO on Android ==== | + | ==== Application launching with GPIO trigger on Android ==== |
- | ** You must install the Android release V2.9 or higher to launch app via GPIO. ** \\ | + | <WRAP center round important> |
- | ** In that case you can skip step 1 ~ 6 ** \\ | + | ** You must install the Android release V2.9(C2)/V4.5(XU4) or higher to launch app via GPIO. ** \\ |
+ | ** In that case you can skip step 1 ~ 7 for your easier life LOL** \\ | ||
- | ** Please check the revision of PCB. This page is based on the board revision 0.2. ** | + | ** If you installed higher version of the Android Marshmallow version v2.9, Please do just step 3 and 4, and skip to 7 ** \\ |
- | + | ** Please check the revision of PCB. This page is based on the board revision 0.2.(C2) ** | |
- | This page explains how to launch app via GPIO input. All of software stuff was applied since the Android image Ver2.9 release. | + | </WRAP> |
- | + | ||
- | 1. Enable the GPIO key driver as a built-in. | + | |
+ | This page explains how to launch an app via GPIO input. \\ All of software stuff(Step 1 to 7) was included from Android image Ver2.9 to Ver3.4 and Marshmallow Ver2.4 released.\\ | ||
+ | \\ | ||
+ | **1. Enable the GPIO key driver as a built-in.**\\ | ||
<code> | <code> | ||
... | ... | ||
Line 16: | Line 18: | ||
</code> | </code> | ||
- | + | **2. Add gpio key mapping to device tree blob.** \\ | |
- | 2. Add gpio key mapping to device tree blob. (path: arch/arm64/boot/dts/meson64_odroidc2.dts) | + | \\ |
- | + | ** ODROID-C2 **\\ | |
- | [[en:c2_hardware&#expansion_connectors|GPIO Pin description]] | + | (path: arch/arm64/boot/dts/meson64_odroidc2.dts) \\ |
+ | [[en:c2_hardware&#expansion_connectors|GPIO Pin description]] \\ | ||
[[https://github.com/hardkernel/linux/commit/6c5f6929b5f351d54929b6ba3921db7d48115a4f|commit]] | [[https://github.com/hardkernel/linux/commit/6c5f6929b5f351d54929b6ba3921db7d48115a4f|commit]] | ||
<code> | <code> | ||
gpio_keys_polled { | gpio_keys_polled { | ||
+ | status = "disabled"; | ||
compatible = | compatible = | ||
"gpio-keys-polled"; | "gpio-keys-polled"; | ||
Line 53: | Line 56: | ||
}; | }; | ||
</code> | </code> | ||
+ | \\ | ||
+ | ** ODROID-XU3/XU4 **\\ | ||
+ | (path: arch/arm/boot/dts/exynos5422-odroidxu3.dts) \\ | ||
+ | [[en:xu3_hardware#expansion_connectors|GPIO Pin description]] \\ | ||
+ | [[en:xu4_shift_shield#gpio_map_for_wiringpi_library|Shift shield GPIO map]]\\ | ||
+ | [[https://github.com/hardkernel/linux/commit/d7bdd20604db04c462ba4ffe77168402da3afe90|commit1]]\\ | ||
+ | [[https://github.com/hardkernel/linux/commit/e8b0d4d2f9be82c711343ee391d576bf7b677c91|commit2]] | ||
+ | <code> | ||
+ | gpio_keys_polled { | ||
+ | status = "disabled"; | ||
+ | compatible = | ||
+ | "gpio-keys-polled"; | ||
+ | #address-cells = <1>; | ||
+ | #size-cells = <0>; | ||
+ | poll-interval = <100>; | ||
+ | autorepeat; | ||
+ | button@1 { | ||
+ | label = "GPIO Key F7"; | ||
+ | linux,code = <65>; | ||
+ | gpios = <&gpx1 2 0xf>; | ||
+ | }; | ||
+ | button@2 { | ||
+ | label = "GPIO Key F8"; | ||
+ | linux,code = <66>; | ||
+ | gpios = <&gpx1 5 0xf>; | ||
+ | }; | ||
+ | button@3 { | ||
+ | label = "GPIO Key F9"; | ||
+ | linux,code = <67>; | ||
+ | gpios = <&gpx1 6 0xf>; | ||
+ | }; | ||
+ | button@4 { | ||
+ | label = "GPIO Key F10"; | ||
+ | linux,code = <68>; | ||
+ | gpios = <&gpx1 3 0xf>; | ||
+ | }; | ||
+ | }; | ||
+ | </code> | ||
- | 3. Build the kernel source. and flash the kernel image to the board. | + | **3. Enable GPIO Key map.** \\ |
+ | <code> | ||
+ | gpio_keys_polled { | ||
+ | status = "okay"; | ||
+ | . | ||
+ | . | ||
+ | }; | ||
+ | </code> | ||
+ | **4. Build the kernel source. and flash the kernel image to the board.(C2)** \\ | ||
<code> | <code> | ||
$ cd kernel | $ cd kernel | ||
Line 69: | Line 118: | ||
</code> | </code> | ||
- | + | **5. Add key event keycode to system/usr/keylayout/Vendor_0001_Product_0001.kl file.** \\ You can find keycode table from [[http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlkeycodes.html|reference]] \\ | |
- | 4. Add key event keycode to system/usr/keylayout/Vendor_0001_Product_0001.kl file. You can find keycode table from [[http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlkeycodes.html|reference]] | + | ** ODROID-C2 **\\ |
- | + | [[https://github.com/codewalkerster/android_device_hardkernel_odroidc2/commit/7b49c29162c884491df262a3ec3d96f08942e231|commit]] \\ | |
- | [[https://github.com/codewalkerster/android_device_hardkernel_odroidc2/commit/7b49c29162c884491df262a3ec3d96f08942e231|commit]] | + | ** ODROID-XU3/XU4 **\\ |
+ | [[https://github.com/codewalkerster/android_device_hardkernel_odroidxu3/commit/58c5a25a219f3f4e770a52fefd50b2fd05cff510|commit]] \\ | ||
+ | \\ | ||
<code> | <code> | ||
... | ... | ||
Line 82: | Line 133: | ||
</code> | </code> | ||
- | 5. Apply the patch that intercept key event to frameworks/base & ODROID Utility App. | + | **6. Apply the patch that intercept key event to frameworks/base & ODROID Utility App.** \\ |
- | + | ** ODROID-C2 **\\ | |
- | [[https://github.com/codewalkerster/android_frameworks_base/commit/6fe6d88e6715e16d891b046a41f7d7fa2588d48c|frameworks/base commit]] | + | [[https://github.com/codewalkerster/android_frameworks_base/commit/6fe6d88e6715e16d891b046a41f7d7fa2588d48c|frameworks/base commit]] \\ |
- | + | [[https://github.com/codewalkerster/android_packages_apps_Utility/commit/87f87154c09eee8eb48106512346744da9b37c3b|ODROID Utility commit]]\\ | |
- | [[https://github.com/codewalkerster/android_packages_apps_Utility/commit/87f87154c09eee8eb48106512346744da9b37c3b|ODROID Utility commit]] | + | ** ODROID-XU3/XU4 **\\ |
- | + | [[https://github.com/codewalkerster/android_frameworks_base/commit/c8f8974e657f9cc4471a3825fed8bd15718f556d|frameworks/base commit]] \\ | |
- | 6. Build the Android image and flash it. | + | [[https://github.com/codewalkerster/android_packages_apps_Utility/commit/f33e6124571df1e201167589ecccb3b218bc3c0f|ODROID Utility commit]]\\ |
- | [[en:c2_building_android#build|build method]] | + | **7. Build the Android image and flash it.** \\ |
+ | [[en:c2_building_android#build|ODROID-C2 build method]] | ||
+ | [[en:xu3_building_android#installation|ODROID-XU3/4 install method]] | ||
<code> | <code> | ||
$ cd <PATH_TO_ANDROID_ROOT> | $ cd <PATH_TO_ANDROID_ROOT> | ||
Line 97: | Line 150: | ||
$ fastboot reboot | $ fastboot reboot | ||
</code> | </code> | ||
+ | \\ | ||
+ | \\ | ||
+ | **8. Connect a few buttons to the GPIOs with 10KOhm pull-up resistors. ** **Click images to enlarge it.** \\ | ||
+ | |||
+ | ** ODROID-C2 **\\ | ||
+ | {{:en:img_20170104_170948.jpg?direct&500|}} | ||
- | 7. Create GPIO input circuit. **Click images to enlarge it.** | + | {{:en:gpio_shortcut_bb.png?direct&300|}} |
- | {{:en:img_20170104_170948.jpg?direct&200|}} | + | {{:en:gpio_shortcut_schem.png?direct&300|}} |
- | {{:en:gpio_shortcut_bb.png?direct&200|}} | + | ** ODROID-XU3/XU4 **\\ |
- | {{:en:gpio_shortcut_schem.png?direct&200|}} | + | {{:en:gpio_shortcut_xu4_bb.png?direct&300|}} |
+ | {{:en:gpio_shortcut_xu4_schem.png?direct&300|}} | ||
- | 8. Set the launch app by using ODROID Utility app. | + | **9. Set the launch app by using ODROID Utility app.** |
- | {{:en:screen.png?direct&200|}} | + | {{:en:screen.png?direct&500|}} |
- | [[https://www.youtube.com/watch?v=tU6-Fz6twAM|How it works in video !]] | + | {{youtube>tU6-Fz6twAM}} |