longsleep / build-pine64-image

Pine64 Linux build scripts, tools and instructions
MIT License
235 stars 126 forks source link

gpio-keys problem #56

Closed embedclub closed 6 years ago

embedclub commented 7 years ago

Hi, I want to use gpio-keys modules, but I have some problem with device tree file. I do not know how to set the paramenter--gpios. Try the following example, 1457 keys:gpio_keys{ 1458 compatible = "gpio-keys"; 1459 #address-cells = <1>; 1460 #size-cells = <0>; 1461 autorepeat; 1465 key-1{ 1466 wakeup-source; 1467 label = "GPIO Power"; 1468 gpios=<&pio PG 6 6 1 2 0>; 1469 debounce-interval = <20>; 1470 linux,code = <116>; 1471 }; 1472 }; 1473 but insmod gpio_keys.ko failed, I hope you can provide an correct example. And the gpios parameter meaning

longsleep commented 7 years ago

The gpio-keys module does not exist in Kernel 3.10 (was added in 3.13) and thus will not work.

embedclub commented 7 years ago

I do not understand this. In kernel 3.10 has a file named gpio_keys.c(drivers/input/keyboard/). Your meaning is that the exist gpio_keys.c has some problems? If I want to used keys in kernel 3.10, what I should do?

longsleep commented 7 years ago

You are correct, though that module is currently not compiled with my Kernel binary releases.

embedclub commented 7 years ago

I had been compiled the kernel 3.10 with CONFIG_KEYBOARD_GPIO=m by myself, but insmod gpio_keys.ko failed, error is listed: [18985.552673] input: gpio_keys_polled.19 as /devices/soc.0/gpio_keys_polled.19/input/input3 [18985.554094] Bad mode in Synchronous Abort handler detected, code 0x86000005 [18985.560030] CPU: 3 PID: 2125 Comm: insmod Not tainted 3.10.65 #19 [18985.560030] task: ffffffc02d93c4c0 ti: ffffffc02d340000 task.ti: ffffffc02d340000 [18985.560030] PC is at 0x100000000 [18985.560030] LR is at 0x100000000 ……………………………………

I do not know why? I hope you can add gpio_keys modules device tree file and test this function!

longsleep commented 7 years ago

I do not know why? I hope you can add gpio_keys modules device tree file and test this function!

No. Feel free to submit a pull request with a fix and i will be willing to review, merge and eventually include it in my binary releases.

zador-blood-stained commented 7 years ago

Even though it "crashes" on load for some reason, it still works. You have to:

Testing:

root@pine64:~# evtest /dev/input/by-path/platform-gpio_keys_polled.1-event
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio_keys_polled.1"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 103 (KEY_UP)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Properties:
Testing ... (interrupt to exit)
Event: time 1495632664.652229, type 1 (EV_KEY), code 103 (KEY_UP), value 1
Event: time 1495632664.652229, -------------- SYN_REPORT ------------
Event: time 1495632664.852193, type 1 (EV_KEY), code 103 (KEY_UP), value 0
Event: time 1495632664.852193, -------------- SYN_REPORT ------------
^C
root@pine64:~#
longsleep commented 6 years ago

Closing, assuming working with the instructions posted.