Differences
This shows you the differences between two versions of the page.
|
doc:howto:hardware.button [2012/11/02 17:26] squonk Added missing dash bang to Shell script |
doc:howto:hardware.button [2013/04/15 06:24] (current) xiloynaha fix script's url |
||
|---|---|---|---|
| Line 8: | Line 8: | ||
| ====== Configuring buttons ====== | ====== Configuring buttons ====== | ||
| + | |||
| + | ===== Kernel configuration ===== | ||
| + | If a target platform is known to support buttons, appropriate kernel modules are selected by default. | ||
| + | |||
| + | If a platform is not known to support buttons, various kernel modules might be required. These might be ''diag'', ''input-gpio-buttons'', ''gpio-button-hotplug'' and others. However, installing various modules will not necessarily yield a successful result. | ||
| + | |||
| ===== Preliminary steps ===== | ===== Preliminary steps ===== | ||
| The first step is to make Hotplug execute scripts in /etc/hotplug.d/button when a button is clicked. Modify /etc/hotplug2.rules --- remove '^' before 'button' as follow: | The first step is to make Hotplug execute scripts in /etc/hotplug.d/button when a button is clicked. Modify /etc/hotplug2.rules --- remove '^' before 'button' as follow: | ||
| Line 48: | Line 54: | ||
| ''BTN_1'' is the name of the button you want to use. If you want or need to use another button, replace every instance of ''BTN_1'' in the rest of this document with the correct text. From now on, there are several possible approaches: the first uses the ''00-button'' script from the ''atheros'' target, the other a simpler shell script. | ''BTN_1'' is the name of the button you want to use. If you want or need to use another button, replace every instance of ''BTN_1'' in the rest of this document with the correct text. From now on, there are several possible approaches: the first uses the ''00-button'' script from the ''atheros'' target, the other a simpler shell script. | ||
| + | |||
| + | **notice** | ||
| + | |||
| + | If you want to run programs from hotplug's scripts you need to be sure ''PATH'' and the like are initialized properly, scripts invoked by hotplug only have a default env. Especially if you install stuff into nonstandard locations like /opt/usr/bin. It's possible by adding ''. /etc/profile'' after ''#!/bin/sh'' | ||
| + | |||
| + | <code> | ||
| + | #!/bin/sh | ||
| + | . /etc/profile | ||
| + | </code> | ||
| ===== Using Atheros' 00-button + UCI ===== | ===== Using Atheros' 00-button + UCI ===== | ||
| Line 53: | Line 68: | ||
| <code> | <code> | ||
| - | # wget -O /etc/hotplug.d/button/00-button http://dev.openwrt.org/export/21216/trunk/target/linux/atheros/base-files/etc/hotplug.d/button/00-button | + | # wget -O /etc/hotplug.d/button/00-button https://dev.openwrt.org/export/36332/trunk/target/linux/atheros/base-files/etc/hotplug.d/button/00-button |
| </code> | </code> | ||
| Line 60: | Line 75: | ||
| <code> | <code> | ||
| #!/bin/sh | #!/bin/sh | ||
| - | . /etc/functions.sh | + | . /lib/functions.sh |
| do_button () { | do_button () { | ||
| local button | local button | ||
| Line 85: | Line 100: | ||
| config_foreach do_button button | config_foreach do_button button | ||
| </code> | </code> | ||
| + | |||
| + | Please note that after r34793 /etc/functions.sh -> /lib/functions.sh so if you are using an old version change it! | ||
| Save and exit, then issue these commands: | Save and exit, then issue these commands: | ||
doc/howto/hardware.button.1351873594.txt.bz2 · Last modified: 2012/11/02 17:26 by squonk
This text is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
