#!/bin/sh
# Paul Sladen, 2006-03-28
# Library functions to check status of wireless

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

setLEDThinkpadSuspending()
{
    action=`test "$1" -ne 0 && echo blink || echo off`
    test -w /proc/acpi/ibm/led && echo -n 7 "$action" > /proc/acpi/ibm/led
}

setLEDAsusWireless()
{
    action=`test "$1" -ne 0 && echo 1 || echo 0`
    test -w /proc/acpi/asus/wled && echo -n "$action" > /proc/acpi/asus/wled
}
