Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an Dell Latitude XT2 using an Intel WLAN card (lspci lists it as "Intel Corporation Ultimate N WiFi Link 5300") running Lubuntu 12.04 with recent updates. The laptop has a hardware WLAN switch.

I have problems activating the WLAN when booting with the hardware switch set to "off". The situation is a bit confusing, unfortunately.

rfkill lists two WLAN devices (though lspci only shows the Intel one). This is the situation when booting with the hardware switch set to "Off":

0: dell-wifi: Wireless LAN
    Soft blocked: yes
    Hard blocked: yes
1: dell-bluetooth: Bluetooth
    Soft blocked: yes
    Hard blocked: yes
2: phy0: Wireless LAN
    Soft blocked: yes
    Hard blocked: yes

From some tests, I conclude WLAN is only activated when both, the dell-wifi and phy0, are unblocked by soft- and hardware. But I can only unblock dell-wifi after the hardware switch is set to "on".

Procedure right from boot with hardware switch set to "Off":

  • Soft-unblocking phy0 works as expected. Could be done by start-up script.
  • sudo rfkill unblock 0: nothing happens. Soft block of dell-wifi not removed.
  • Set the hardware switch to "on": phy0 gets its hard block removed. Still no WLAN.
  • sudo rfkill unblock 0: both the soft and hard lock of dell-wifi are removed. WLAN is now active and works.
  • sudo rfkill block 0: only adds the soft block as expected. WLAN goes off again.

So, in order to activate WLAN, I have to use the hardware switch and afterwards (manually) run a script - that's a bit inconvenient.

Does someone know a better solution? Maybe a daemon could help that listens to rfkill events to unblock dell-wifi after I have set the hardware switch to "on"? (sounds like another workaround)

When booting with the hardware switch set to "On", nothing is blocked neither hard nor soft.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

There's already a daemon you can use for this purpose: udevd

You can create a rules file for it to listen to rfkill events, see this unix.stackexchange.com answer. Just adapt the script to your purpose, see below. Be aware my bash is not the best - it works, but probably cannot be considered a good example.

#!/bin/bash
#/usr/local/bin/unblock-dell-wifi

DEV_CHANGED_BY_HW_SWITCH=phy0
DEV_TO_UNBLOCK=dell-wifi


if [ ${RFKILL_NAME} != ${DEV_CHANGED_BY_HW_SWITCH} ]
then
        exit
fi


# get $DEV_TO_UNBLOCK rfkill id
DEV_TO_UNBLOCK_ID=`rfkill list wlan | grep $DEV_TO_UNBLOCK | grep -o -e "^[0-9]*"`

# maybe add error handling if $DEV_TO_UNBLOCK couldn't be found
if [ -z $DEV_TO_UNBLOCK_ID ]
then
        echo "$DEV_TO_UNBLOCK not found in rfkill list" 1>2&
        exit
fi  


if [ ${RFKILL_STATE} = 0 ]
then
        sudo rfkill block $DEV_TO_UNBLOCK_ID
else
        sudo rfkill unblock $DEV_TO_UNBLOCK_ID
fi
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.