Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:hardware:hardware.button [2020/04/10 16:49] – [procd buttons] danitool | docs:guide-user:hardware:hardware.button [2022/04/27 15:48] – [Attach functions to a push button] some1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| There several ways for controlling buttons in OpenWrt. | There several ways for controlling buttons in OpenWrt. | ||
| * [[# | * [[# | ||
| - | * [[# | + | * [[# |
| * [[# | * [[# | ||
| Line 22: | Line 22: | ||
| | Release | ACTION=" | | Release | ACTION=" | ||
| - | Note that " | + | :!: " |
| - | < | + | <WRAP round box 60%> |
| Please consider using these kernel codes when adding support for new devices, they' | Please consider using these kernel codes when adding support for new devices, they' | ||
| ^ Kernel code ^ event ^ | ^ Kernel code ^ event ^ | ||
| Line 143: | Line 143: | ||
| uci set system.@button[-1].action=" | uci set system.@button[-1].action=" | ||
| uci set system.@button[-1].handler=" | uci set system.@button[-1].handler=" | ||
| - | uci commit system | + | uci commit system |
| </ | </ | ||
| Line 207: | Line 207: | ||
| } | } | ||
| EOF | EOF | ||
| + | chmod u+x / | ||
| </ | </ | ||
| Line 217: | Line 218: | ||
| STATEFILE="/ | STATEFILE="/ | ||
| - | if [ " | + | if [ " |
| case " | case " | ||
| - | " | + | " |
| - | " | + | " |
| esac | esac | ||
| else | else | ||
| - | if [ ! -e " | + | if [ -e " |
| - | STATE=" | + | GOAL=" |
| else | else | ||
| - | | + | |
| + | GOAL="off" | ||
| fi | fi | ||
| fi | fi | ||
| - | if [ -z " | + | |
| - | STATE=" | + | if [ "${GOAL}" = "off" ]; then |
| - | fi | + | |
| - | + | ||
| - | if [ "${STATE}" = "on" ]; then | + | |
| /sbin/wifi down | /sbin/wifi down | ||
| - | | + | |
| else | else | ||
| /sbin/wifi up | /sbin/wifi up | ||
| - | | + | |
| + | rm "${STATEFILE}" | ||
| fi | fi | ||
| - | |||
| - | echo " | ||
| EOF | EOF | ||
| + | chmod u+x / | ||
| </ | </ | ||
| Line 251: | Line 250: | ||
| One way to find out your Wireless Network configuration name in LuCi is to navigate to the " | One way to find out your Wireless Network configuration name in LuCi is to navigate to the " | ||
| - | __/!\__ Warning ! Do not forget to allow the script execution with the command : **chmod u+x / | ||
| <code bash> | <code bash> | ||
| uci add system button | uci add system button | ||
| Line 271: | Line 269: | ||
| } | } | ||
| EOF | EOF | ||
| + | chmod u+x / | ||
| </ | </ | ||
| Line 299: | Line 298: | ||
| uci commit system | uci commit system | ||
| </ | </ | ||
| - | |||
| ==== WR1043ND ==== | ==== WR1043ND ==== | ||
| If you decide to use the '' | If you decide to use the '' | ||
| Line 354: | Line 352: | ||
| Notes: | Notes: | ||
| * triggerhappy repeats commands twice: see bug https:// | * triggerhappy repeats commands twice: see bug https:// | ||
| - | * kernel modules: **kmod-hid** and **kmod-hid-generic** both should be installed\\ The kmod-hid-generic kernel module must be installed for buttons on USB devices such as USB sound cards to work in OpenWrt trunk. Only then the / | + | * kernel modules: **kmod-hid** and **kmod-hid-generic** both should be installed\\ The **kmod-hid-generic** and supposedly also **kmod-usb-hid** |
| < | < | ||