#!/bin/sh # Copyright (C) 2006,2007 Krzysztof Kozlowski # License: GNU General Public License version 2 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2 as published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # # Ostatnia zmiana: 13.01.2007 # # Check radio, put it on/off. # # Auto-detecting device: # DEVICE="0000:06:05.0" get_device() { FOUND=`lspci | grep -i wireless | cut -d ' ' -f 1` echo "0000:${FOUND}" } DEVICE=`get_device` DEVICE_PATH="/sys/bus/pci/drivers/ipw2200" FILE="${DEVICE_PATH}/${DEVICE}/rf_kill" LED_FILE="${DEVICE_PATH}/${DEVICE}/led" # Check current radio-status: current_status() { STATUS=`cat $FILE` if [ "$STATUS" = "1" ]; then echo "off" else echo "on" fi } show_current_status() { echo "Current radio status: $(current_status)" } if [ $# -ne 1 ]; then echo "Usage: $(basename $0) " show_current_status exit 127 fi # Radio on/off: if [ -f "${FILE}" ]; then if [ "${1}" = "on" ]; then echo "0" > "${FILE}" fi if [ "${1}" = "off" ]; then echo "1" > "${FILE}" fi echo "1" > "${LED_FILE}" show_current_status else echo "File $FILE does not exist!" fi