# rfkill gui and alternatives

## s0be

Well, I've been searching for an rfkill gui, but haven't found one.  In the mean time, I've created an init script to set my rfkill the way I want it on boot.  

First I added a kernel command line option to default radios to off:

```

rfkill.default_state=0

```

Next, I added this init script:

```

start() {

        ebegin "Starting rfkill"

        for IFACE in ${RFKILL_UNBLOCK} ; do

                IFACENO=$(rfkill list | sed -rne "s/([0-9])*:\ ${IFACE}:.*/\1/p")

                if [ $(cat /sys/class/rfkill/rfkill${IFACENO}/soft) == 1 ]; then

                        ebegin " Unblocking ${IFACENO} - ${IFACE}"

                        rfkill unblock $IFACENO

                        eend $?

                else

                        einfo " Skipping ${IFACENO} - ${IFACE} already unblocked"

                fi

        done

        for IFACE in ${RFKILL_BLOCK}; do

                IFACENO=$(rfkill list | sed -rne "s/([0-9])*:\ ${IFACE}:.*/\1/p")

                if [ $(cat /sys/class/rfkill/rfkill${IFACENO}/soft) == 0 ]; then

                        ebegin " Blocking ${IFACENO} - ${IFACE}"

                        rfkill block $IFACENO

                        eend $?

                else

                        einfo " Skipping ${IFACENO} - ${IFACE} already blocked"

                fi

        done

        eend

}

stop() {

        ebegin "Stopping rfkill"

        eend $?

}

```

Which uses this config:

```

RFKILL_BLOCK="tpacpi_bluetooth_sw tpacpi_wwan_sw i2400m-usb"

RFKILL_UNBLOCK="phy0"

```

my rfkill list:

```

0: tpacpi_bluetooth_sw: Bluetooth

   Soft blocked: yes

   Hard blocked: no

1: tpacpi_wwan_sw: Wireless WAN

   Soft blocked: yes

   Hard blocked: no

2: phy0: Wireless LAN

   Soft blocked: no

   Hard blocked: no

4: i2400m-usb:3-1.3:1.0: WiMAX

   Soft blocked: yes

   Hard blocked: no

```

Any suggestions on changes I should make, or additional features that would be useful?  I'm thinking about submitting for inclusion in the rfkill package.

----------

## dmpogo

If anybody explained to me what in practice rfkill is for ?

----------

## s0be

 *dmpogo wrote:*   

> If anybody explained to me what in practice rfkill is for ?

 

Allows you to power down radios in a system.  In most systems, you'd only use one of wifi, gsm, or wimax at any given time.  My laptop has all 3.  A nice gui to turn some of the radios off, and others on would be nice.

----------

## dmpogo

 *s0be wrote:*   

>  *dmpogo wrote:*   If anybody explained to me what in practice rfkill is for ? 
> 
> Allows you to power down radios in a system.  In most systems, you'd only use one of wifi, gsm, or wimax at any given time.  My laptop has all 3.  A nice gui to turn some of the radios off, and others on would be nice.

 

Perhaps a better phrased question is how it should be used properly ?   I have bluetooth/wifi,   and they are switched on/off by Fn-F5 and Fn-F6 with some simple acpi scripts.   I did it when rfkill was just appearing and was pretty broken, but since can't get a feeling whether I should reporgram my setup.

----------

## s0be

 *dmpogo wrote:*   

>  *s0be wrote:*    *dmpogo wrote:*   If anybody explained to me what in practice rfkill is for ? 
> 
> Allows you to power down radios in a system.  In most systems, you'd only use one of wifi, gsm, or wimax at any given time.  My laptop has all 3.  A nice gui to turn some of the radios off, and others on would be nice. 
> 
> Perhaps a better phrased question is how it should be used properly ?   I have bluetooth/wifi,   and they are switched on/off by Fn-F5 and Fn-F6 with some simple acpi scripts.   I did it when rfkill was just appearing and was pretty broken, but since can't get a feeling whether I should reporgram my setup.

 

I haven't dealt with reconfiguring with fn-f5, but probably not worth it for you.  My problem is I didn't want all the drivers active all the time (drains a but extra battery) so it just defaults them to be my 'normal use'.  If I go somewhere to use wimax or other, I manually rfkill to what i want on and off.  This is just to set it up the way I want at boot.

----------

## charles17

 *s0be wrote:*   

> ... In the mean time, I've created an init script to set my rfkill the way I want it on boot.  ...

 How would your script interact with sys-apps/netplug? I am using netplug for bringing down wlan0 as soon as the lan cable is plugged in.

----------

## s0be

 *charles17 wrote:*   

>  *s0be wrote:*   ... In the mean time, I've created an init script to set my rfkill the way I want it on boot.  ... How would your script interact with sys-apps/netplug? I am using netplug for bringing down wlan0 as soon as the lan cable is plugged in.

 

I use it with wicd just fine.  I have wicd set up to automatically load certain services depending on if it detects itself being connected to my lan vs other APs.  This script is really only used during computer bootup, so it should not conflict with anything that changes after you've started up.

----------

