Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You will gain money by a fattening action.


comp / comp.unix.programmer / Re: Beeping in Linux

SubjectAuthor
* Beeping in LinuxMuttley
+- Re: Beeping in LinuxMarcel Mueller
`* Re: Beeping in Linuxwij
 `- Re: Beeping in LinuxMuttley

1
Subject: Beeping in Linux
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Sun, 27 Oct 2024 08:21 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Beeping in Linux
Date: Sun, 27 Oct 2024 08:21:39 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <vfkt6j$74bf$1@dont-email.me>
Injection-Date: Sun, 27 Oct 2024 09:21:39 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2e684d9d9c22690a3287963f4bb6f54d";
logging-data="233839"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xKGqUo0jxL3k3shI0QkMO"
Cancel-Lock: sha1:e9KikHJ51/J0LnN+hUCPc2zbKa4=
View all headers

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.

I've found something online that mentioned ioctl() + the KDMTONE option but I
can't find any example code. Does anyone know how its done?

Thanks for any help

Subject: Re: Beeping in Linux
From: Marcel Mueller
Newsgroups: comp.unix.programmer
Organization: MB-NET.NET for Open-News-Network e.V.
Date: Sun, 27 Oct 2024 11:46 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder2.eternal-september.org!news.mb-net.net!open-news-network.org!.POSTED!not-for-mail
From: news.5.maazl@spamgourmet.org (Marcel Mueller)
Newsgroups: comp.unix.programmer
Subject: Re: Beeping in Linux
Date: Sun, 27 Oct 2024 12:46:50 +0100
Organization: MB-NET.NET for Open-News-Network e.V.
Message-ID: <vfl97a$2uhu2$2@gwaiyur.mb-net.net>
References: <vfkt6j$74bf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 27 Oct 2024 11:46:50 -0000 (UTC)
Injection-Info: gwaiyur.mb-net.net;
logging-data="3098562"; mail-complaints-to="abuse@open-news-network.org"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:g7+JAslFRWNW1ihJzHGXwvEtsBo= sha256:dyua+SucCb6JrCzMYz+C1+pHIfTWneuYem4SDqv2gtw=
sha1:tV07xXqHJgNyDmAY4SyEkFnpaVo= sha256:NkEGmT7luyo90U2bJsjF9W/t1046jW2BkxdeWjFj5e4=
Content-Language: de-DE, en-US
In-Reply-To: <vfkt6j$74bf$1@dont-email.me>
View all headers

Am 27.10.24 um 09:21 schrieb Muttley@dastardlyhq.com:
> 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.

Many PC hardware has no embedded speaker anymore.

Marcel

Subject: Re: Beeping in Linux
From: wij
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Sun, 27 Oct 2024 12:00 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wyniijj5@gmail.com (wij)
Newsgroups: comp.unix.programmer
Subject: Re: Beeping in Linux
Date: Sun, 27 Oct 2024 20:00:34 +0800
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <185a06463a1c6a2af69508bd1ec2d2a64587ce7f.camel@gmail.com>
References: <vfkt6j$74bf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Sun, 27 Oct 2024 13:00:35 +0100 (CET)
Injection-Info: dont-email.me; posting-host="cb573552714cb9d77c9de13a369341c7";
logging-data="466568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QDDQ7IAmqYFDHWA8IIIJE"
User-Agent: Evolution 3.50.2 (3.50.2-1.fc39)
Cancel-Lock: sha1:dFaEZNvXlh1AjaDZV1F7bL5sBOM=
In-Reply-To: <vfkt6j$74bf$1@dont-email.me>
View all headers

On Sun, 2024-10-27 at 08:21 +0000, Muttley@dastardlyhq.com wrote:
> 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.
>
> I've found something online that mentioned ioctl() + the KDMTONE option but I
> can't find any example code. Does anyone know how its done?
>
> Thanks for any help
>

This is the beep(..) implement in libwy https://sourceforge.net/projects/cscall/files/latest/download
Root privilege is required.

/* Copyright is licensed by GNU LGPL, see file COPYING. by I.J.Wang 2018
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)!=msec)||(freq<=0)||(CLOCK_TICK_RATE/freq>0xffff)) {
WY_RETURN( EINVAL );
}
if((::ioctl(fh.fd(),KDMKTONE,( (msec<<16)|(CLOCK_TICK_RATE/freq) )))==-1) {
WY_RETURN(errno);
}
return Wy::Ok;
};

}; // end namespce Wy

#endif // end WY_IOCTL_H__

Subject: Re: Beeping in Linux
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Organization: A noiseless patient Spider
Date: Sun, 27 Oct 2024 16:32 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.programmer
Subject: Re: Beeping in Linux
Date: Sun, 27 Oct 2024 16:32:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <vflpv1$gqv6$1@dont-email.me>
References: <vfkt6j$74bf$1@dont-email.me> <185a06463a1c6a2af69508bd1ec2d2a64587ce7f.camel@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Sun, 27 Oct 2024 17:32:34 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5b0c30c76bdc34b692c7cbe47d9cd4a6";
logging-data="551910"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nfMjNMd5mCLRnztbslpBe"
Cancel-Lock: sha1:Hsd+WPZk2JcwU1j39UGnHyWkHqA=
View all headers

On Sun, 27 Oct 2024 20:00:34 +0800
wij <wyniijj5@gmail.com> wrote:
>On Sun, 2024-10-27 at 08:21 +0000, Muttley@dastardlyhq.com 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__

Thanks

1

rocksolid light 0.9.8
clearnet tor