Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10 | kardasa | 1 | #!/bin/sh |
2 | #Function to check status originaly created by Paul Sladen for Ubuntu acpi-support package |
||
3 | isAnyWirelessPoweredOn() |
||
4 | { |
||
5 | for DEVICE in /sys/class/net/* ; do |
||
6 | if [ -d $DEVICE/wireless ]; then |
||
7 | # Hurray for stable interfaces... now the rfkill is scarcely |
||
8 | # associated with the network device at all (!) |
||
9 | for RFKILL in $DEVICE/device/rfkill/rfkill*/state; do |
||
10 | if [ -r "$RFKILL" ] && [ "$(cat "$RFKILL")" -eq 1 ] |
||
11 | then |
||
12 | return 0 |
||
13 | fi |
||
14 | done |
||
15 | # if any of the wireless devices are turned on then return success |
||
16 | if [ -r $DEVICE/device/power/state ] && [ "`cat $DEVICE/device/power/state`" -eq 0 ] |
||
17 | then |
||
18 | return 0 |
||
19 | fi |
||
20 | if [ -r $DEVICE/device/rf_kill ] && [ "`cat $DEVICE/device/rf_kill`" -eq 0 ] |
||
21 | then |
||
22 | return 0 |
||
23 | fi |
||
24 | fi |
||
25 | done |
||
26 | |||
27 | # otherwise return failure |
||
28 | return 1 |
||
29 | } |
||
30 | |||
31 | if (isAnyWirelessPoweredOn); then |
||
32 | kdialog --passivepopup "Wyłączam Interfejsy bezprzewodowe" --title "Wciśnięty przycisk Wifi" |
||
33 | else |
||
34 | kdialog --passivepopup "Włączam Interfejsy bezprzewodowe" --title "Wciśnięty przycisk Wifi" |
||
35 | fi |
||
36 | |||
37 | sudo /usr/local/bin/wireless-toggle.sh |
||
38 | |||
39 | if (isAnyWirelessPoweredOn); then |
||
40 | sudo /usr/local/bin/wireless-led.sh 1 |
||
41 | else |
||
42 | sudo /usr/local/bin/wireless-led.sh 0 |
||
43 | fi |