WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Play sound when wireless network found?  (Read 2726 times)

Offline gwalther

  • Full Member
  • ***
  • Posts: 126
Play sound when wireless network found?
« on: November 18, 2009, 10:06:19 AM »
I try and connect to a wireless network...on boot...using commands in ../opt/bootlocal.sh
The last command is:

udhcpc -b -i wlan0

Is there a way to play  a wav file  (using aplay)... if a successful connection is made?


Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9603
Re: Play sound when wireless network found?
« Reply #1 on: November 18, 2009, 10:10:18 AM »
Not on TC to test it, but one of these may work.  Either

udhcpc -b -i wlan0 && aplay file.wav

or the below placed after the dhcp command:
 


if [ "$?" -eq "0" ];then
  aplay file.wav
fi

One of those would work in general use, but with detecting connectivity there may be more to it, like using iwconfig and grepping output.
« Last Edit: November 18, 2009, 10:12:25 AM by Jason W »

Offline gwalther

  • Full Member
  • ***
  • Posts: 126
Re: Play sound when wireless network found?
« Reply #2 on: November 18, 2009, 01:44:41 PM »
Thanks....tried the second solution and it seems to work.  I hear wav file about 12 secs after the desktop first appears....system had connected.  Need to test some more, when system is not available and/or fails to connect.