WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline gwalther

  • Full Member
  • ***
  • Posts: 139
Play sound when wireless network found?
« on: November 18, 2009, 01:06:19 PM »
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

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: Play sound when wireless network found?
« Reply #1 on: November 18, 2009, 01:10:18 PM »
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, 01:12:25 PM by Jason W »

Offline gwalther

  • Full Member
  • ***
  • Posts: 139
Re: Play sound when wireless network found?
« Reply #2 on: November 18, 2009, 04: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.