Reprogram hardware buttons

Which Khadas SBC do you use?

Khadas VIM3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?


Which version of system do you use? Khadas official images, self built images, or others?

Khadas officieal image

Please describe your issue below:

Hello! Is there any way to assign a custom handler (script) to Function button? E.g. enable/disable WiFi or any other script?

Post a console log of your issue below:

**Delete this line and post your log here.**

1 Like

Yes, the Func key device node is /dev/input/event4, you can get press/release event from it and do anything you want to do.

Execute evtest to get available devices, adc_keypad is the Func key.

Thank you very much for the quick answer!

That’s almost what we wanted to achieve. One small clarification please:

root@khaleesi-d0:/home/khadas# evtest --grab /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys-polled"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 116 (KEY_POWER)
Testing ... (interrupt to exit)
Event: time 1669708979.092482, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1669708979.092482, -------------- SYN_REPORT ------------
Event: time 1669708979.304480, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1669708979.304480, -------------- SYN_REPORT ------------

# tree /dev/input/
β”œβ”€β”€ by-path
β”‚   β”œβ”€β”€ -> ../event1
β”‚   └── platform-gpio-keys-polled-event -> ../event0
β”œβ”€β”€ event0
β”œβ”€β”€ event1
└── mice

1 directory, 5 files

As I see, there is no event4 and listening for event0 does not react somehow to function key (the middle one) but gives reaction to power key.

Is there some way to enable function key?

Thank you in advance!