--- old/usr/share/acpi-support/state-funcs 2008-01-11 11:56:15.000000000 +0100 +++ new/usr/share/acpi-support/state-funcs 2008-01-11 11:56:23.000000000 +0100 @@ -6,19 +6,21 @@ isAnyWirelessPoweredOn() { for DEVICE in /sys/class/net/* ; do - if [ -d $DEVICE/wireless -a -r $DEVICE/device/power/state ] ; then - # If any of the wireless devices are turned on then return success - if [ "`cat $DEVICE/device/power/state`" -eq 0 ] ; then - # Check if 'rf_kill' disagrees - if [ -r $DEVICE/device/rf_kill ] ; then - if [ "`cat $DEVICE/device/rf_kill`" -eq 0 ] ; then - # And rf_kill has the radio on + if [ -d $DEVICE/wireless ] ; then + # the initial status is 0 which means that the interface is thought as enabled + # if it is found disabled, the status will be put to 1 + + STATUS="0" + if [ -r $DEVICE/device/power/state ] && [ "`cat $DEVICE/device/power/state`" -ne 0 ]; then + STATUS="1" + fi + if [ -r $DEVICE/device/rf_kill ] && [ "`cat $DEVICE/device/rf_kill`" -ne 0 ] ; then + STATUS="1" + fi + + if [ "$STATUS" -eq "0" ]; then + # found an enabled interface, returning success return 0 - fi - else - return 0 fi - fi fi done # otherwise return failure