Thanks!  I was wanting to do that just the other day, for tuning up
my radio... wanted to write a script to beep whenever an incoming 
packet was decoded, with a different tone for different senders...
I was pinging two stations at once, and watching the "quality" signal
from my TNC, so my eyes were busy and I would've liked to hear the
beeps when I had it tuned right and it actually got a packet (hiss - 
voltage goes up - "beep!").  Was tweaking the discriminator can in a 
Mitrek, and it's really touchy.  So now I know how to write a beep 
utility to call from a shell script.

On Thu, Apr 20, 2000 at 07:46:36AM -0400, Dave Mielke wrote:
> [quoted lines by r00t the LiNuXeRRR on April 20, 2000, at 10:59]
> 
> >     Does exist a sound(); function like the one from Borland C from
> >dos that turns on the speaker at a given frequance... The sound();
> >function doesn't work in linux...
> 
> Yes. You do it through ioctl. Open a file descriptor to the console:
> 
>     int fd = open("/dev/tty0", O_WRONLY);
> 
> Start the tone by:
> 
>     ioctl(fd, KIOCSOUND, (1190000 / herz));
> 
> Stop the tone by:
> 
>     ioctl(fd, KIOCSOUND, 0);
> 
> For O_WRONLY, you'll need:
> 
>     #include <fcntl.h>
> 
> For KIOCSOUND, you'll need:
> 
>     #include <linux/kd.h>

-- 
  _______                   Shawn T. Rutledge / KB7PWD  [EMAIL PROTECTED]
 (_  | |_)          http://www.bigfoot.com/~ecloud  [EMAIL PROTECTED]
 __) | | \________________________________________________________________
Get money for spare CPU cycles at http://www.ProcessTree.com/?sponsor=5903

Reply via email to