Wednesday, May 1, 2013

Disabling the Wifi Button

I just HAD to document this as it's just so cute. Oh - before I start making funny faces at some code - geek speak alert.

So one of the things that soon became horribly annoying when I deployed the first Manaiakalani image was the wifi button. For whatever reason, the kids loved pressing "Fn-F2". It would have me running around frantically just to press a couple of buttons... So I decided that disabling it would be functionality that we could afford to lose.

So up till now it's just been a cron job that runs every minute. Yep - one of those diety awful uses of cron (don't do this....).

Anyway, while playing with rfkill I noticed an "event" option. Which will display events! Only on it's own it's kind of hopeless... I only really want to listen to the next event... tail to the rescue. This is what I came up with:

 #!/bin/bash  
 #put wifi devices in known state  
 rfkill unblock wifi  
 while true ; do  
   rfkill event wifi | head -n1  
   sleep 0.5  #I was getting a little bouncing...  
   rfkill unblock wifi  
 done  

I know... It's probably not all that brilliant. Still.... I think it's cute.

No comments:

Post a Comment