isAnyWirelessPoweredOn() logic is inverted.

Bug #66083 reported by Nicolò Chieffo
2
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Paul Sladen

Bug Description

the script (/usr/share/acpi-support/state-funcs) is intended to return true if any wireless is powered on and otherways false. I've intended that "any" as "at least one" (also because we cannot say that wireless is off if 2 devices are off and one is on)

so the script has to be modified to return true when it will encounter the first wireless device powered on and return false only if every device is off!

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
            test "`cat $DEVICE/device/power/state`" -eq 1 || return 0
        fi
    done
    # otherwise return failure
    return 1
}

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

Well and another reason to change it is this: if in the desktop/laptop pc there are no wireless devices the return must be false and not true!

Revision history for this message
Nicolò Chieffo (yelo3) wrote :

this method is deprecated. this function will be rewritten because power/state is no more supported in 2.6.20

Changed in acpi-support:
status: Unconfirmed → Rejected
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

reopening: dapper and edgy still need that this bug to be fixed!

Changed in acpi-support:
status: Rejected → Confirmed
Revision history for this message
Nicolò Chieffo (yelo3) wrote :

this is the patch.

Paul Sladen (sladen)
Changed in acpi-support:
assignee: nobody → sladen
status: Confirmed → In Progress
Paul Sladen (sladen)
Changed in acpi-support:
importance: Undecided → Medium
Revision history for this message
Paul Sladen (sladen) wrote :

acpi-support (0.93) feisty; urgency=low

  * Change 'wireless.sh' to use 'device/rf_kill' for wireless devices (if
    available) in preference to 'device/power/state' which was been
    removed by the upstream kernel developers.
    (Closes: LP #42820)
  * Teach 'lib/state-funcs:isAnyWirelessPoweredOn()' to also check
    'device/rf_kill' if it's available.
    (Closes: LP #42820)
  * Change 'ibm-wireless.sh' to rotate wireless and bluetooth states
    through the sequence: both, bluetooth only, wireless only, neither.
    (Closes: LP #24680)
  * Correct inverted logic in 'isAnyWirelessPoweredOn()'.
    (Closes: LP #66083)
  * Change script shebangs to use '/bin/sh' instead of '/bin/bash'.

 -- Paul Sladen <email address hidden> Wed, 21 Mar 2007 04:55:27 +0000

Changed in acpi-support:
status: In Progress → Fix Released
Revision history for this message
Nicolò Chieffo (yelo3) wrote : Re: [Bug 66083] Re: isAnyWirelessPoweredOn() logic is inverted.

Thank you very much!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.