Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
timrichardsonOffline
Post subject: help with udev rule for rfkill  PostPosted: 01.01.2011, 21:07



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
My laptop has a wifi kill switch. killing the wifi and re-enabling it does not reconnect the wifi. The hardware seems to work, but it doesn't get an ip address, in fact the interface does not appear at all.

I can fix it with a script which remove and adds back the kernel module.

I would like this to be executed whenever there is a kernel event for the state of the switch changing, so I think that's a job for udev.

I though this would work, but it doesn't do anything:

SUBSYSTEM=="rfkill",ATTRS{state}=="1",RUN+="date>/tmp/rfkill_test1"
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
muchan
Post subject: RE: help with udev rule for rfkill  PostPosted: 01.01.2011, 22:31
Moderator


Joined: 2010-09-11
Posts: 468

why not "ifdown wlan0" and "ifup wlan0"?
 
 View user's profile Send private message  
Reply with quote Back to top
micha_52Offline
Post subject: RE: help with udev rule for rfkill  PostPosted: 02.01.2011, 09:33



Joined: 2010-09-12
Posts: 18
Location: Nordstemmen
Status: Offline
I have the same problem like timrichardson. The only reliable solution for me eeepc is "ifdown wlan0" followed by "ifup wlan0" as muchan described before
 
 View user's profile Send private message  
Reply with quote Back to top
timrichardsonOffline
Post subject: RE: help with udev rule for rfkill  PostPosted: 02.01.2011, 11:42



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
ifdown and ifup only work for me if I first remove and reload the module. The interface is not visible via ifconfig until I do this, so ifdown and up fail with 'no such device'.

However, even if the solution was down/up, what I am trying to do is automate these actions via a udev rule triggered by the kill switch changing status
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
dptOffline
Post subject: RE: help with udev rule for rfkill  PostPosted: 03.01.2011, 18:24



Joined: 2010-09-11
Posts: 281
Location: New Delhi
Status: Offline
Interesting. After reading this I tried on my ACER 5542.

To save power, the wifi on/off switch is pretty useful if WLAN0 is not needed.

Thanks muchan.

dpt

_________________
In a lunatic asylum, everyone thinks that he is the doctor.
 
 View user's profile Send private message AIM Address  
Reply with quote Back to top
timrichardsonOffline
Post subject: RE: help with udev rule for rfkill  PostPosted: 04.01.2011, 23:53



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
anyway, this is the udev rule which invokes a script.
      Code:

SUBSYSTEM=="rfkill",ATTR{type}=="wlan",ACTION=="change",ATTR{state}=="1", RUN+="/home/tim/bin/fixwifi"
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
micha_52Offline
Post subject: RE: help with udev rule for rfkill  PostPosted: 05.01.2011, 10:38



Joined: 2010-09-12
Posts: 18
Location: Nordstemmen
Status: Offline
Hi timrichardson,

please provide also your fixwifi script

Thanks,
Michael
 
 View user's profile Send private message  
Reply with quote Back to top
timrichardsonOffline
Post subject: RE: help with udev rule for rfkill  PostPosted: 05.01.2011, 22:26



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
I've just updated to kernel 2.6.37 and tried the kill switch for the first time.
As usual, the interface was down after turning it on again (I turned off the udev rule to experiment manually). However, this time all I needed was a ifconfig wlan0 up to bring it back.
So I will try that as the script my udev rule runs.

_________________
There are some who call me Tim
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
timrichardsonOffline
Post subject: RE: help with udev rule for rfkill  PostPosted: 06.01.2011, 05:19



Joined: 2010-09-12
Posts: 66
Location: Melbourne
Status: Offline
Ok, I'm now convinced that ifconfig wlan0 up is all that is required with 2.6.37 after a few tests today with 100% success.
so my script is
      Code:

#!/bin/sh
/usr/bin/touch /tmp/rfkill4_test   #just a test that the script is being executed.
 
/bin/sleep 2   #I don't know if this is necessary.
/sbin/ifconfig wlan0 up


save this, make it executable and adjust the path in the udev rule.

(ps the new kernel may not be the reason for the improvement: I also updated bios)
 
 View user's profile Send private message Visit poster's website Yahoo Messenger  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio