I'm looking at a way of making the machine beep without relying on having a TTY available to send \7 to or going all heavyweight with ALSA.
On Sun, 2024-10-27 at 08:21 +0000, [email protected] wrote:
I'm looking at a way of making the machine beep without relying on having=a=20
TTY available to send \7 to or going all heavyweight with ALSA.=20
=20
I've found something online that mentioned ioctl() + the KDMTONE option b= >ut I=20
can't find any example code. Does anyone know how its done?
=20
Thanks for any help
=20
This is the beep(..) implement in libwy https://sourceforge.net/projects/cs= >call/files/latest/download
Root privilege is required.
/* Copyright is licensed by GNU LGPL, see file COPYING. by I.J.Wang 2= >018
=20
This file is header only
*/
#ifndef WY_IOCTL_H__
#define WY_IOCTL_H__
#define WY_IOCTL_VERSION 69
#include <sys/ioctl.h>
#include <linux/kd.h>
#ifndef CLOCK_TICK_RATE
#define CLOCK_TICK_RATE 1193180
#endif
namespace Wy {
inline
Wy::Errno beep(Wy::FileHandle fh, unsigned int freq, unsigned int msec)
{
Wy::Errno r; if(((msec&0xffff)!=3Dmsec)||(freq<=3D0)||(CLOCK_TICK_RATE/freq>0xffff)) {
WY_RETURN( EINVAL );
}
if((::ioctl(fh.fd(),KDMKTONE,( (msec<<16)|(CLOCK_TICK_RATE/freq) )))=3D=3D=
-1) {
WY_RETURN(errno);
}
return Wy::Ok;
};
}; // end namespce Wy
#endif // end WY_IOCTL_H__
On Sun, 2024-10-27 at 08:21 +0000, [email protected] wrote:
I'm looking at a way of making the machine beep without relying onThis is the beep(..) implement in libwy https://sourceforge.net/projects/cscall/files/latest/download
having a
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 24:09:13 |
| Calls: | 12,105 |
| Calls today: | 5 |
| Files: | 15,006 |
| Messages: | 6,518,155 |