beep development notes

This file contains a number of notes, links and remarks which can be useful if you need to change beep.

You can also run make html and have pandoc and doxygen generate HTML versions of the *.md files at html/ and HTML documentation from the code comments at html/dox/html/index.html.

Testing

If you want to run the tests only for the executables compiled with clang, run

[user@host beep]$ make check TOOLCHAINS=clang

APIs

evdev API

The Linux kernel implements the input device event API in drivers/input/misc/pcspkr.c with include/uapi/linux/input-event-codes.h defining EV_SND as 0x12 and SND_TONE as 0x02.

include/uapi/linux/input.h defines EVIOCGSND(len), and there is documentation about EV_SND to be found in Documentation/input/event-codes.rst and Documentation/input/input-programming.rst.

Console API

The Linux kernel implements the console API in drivers/tty/vt/vt_ioctl.c with include/uapi/linux/kd.h defining KIOCSOUND to be 0x4B2F.

Fallback TTY BEL API

If you print a '\a' (BEL) character to a TTY device stdout, that can sound some type of beep. Not with the desired frequency or duration or sequence, but at least there is a beep.

Raspberry Pi

The Raspberry Pi has no PC speaker hardware, but a few GPIO pins with PWM capability which root can access from userspace.

Non-PC systems

Non-PC systems like e.g. the Raspberry Pi and similar systems do not have PC beeper hardware, they have GPIO pins some of which are attached to PWM hardware which can be set to produce beeps.

So if one properly attaches a loudspeaker or piezo buzzer to such a PWM pin (with a bunch more electrical components like capacitors, resistors, transistors where required), one has the hardware to produce beeps.

This leaves one to sort out the software side of it, which gets us back to the issue that only root is allowed to touch the Raspberry Pi GPIO pins, but beep should also run as a non-root user without the potential for setuid or sudo facilitated security holes.

Options:

Architecture

TODO list

Post-1.4.0:

Release checklist