README.fedora
Content ======= 1. Load the pkspkr.ko Kernel Driver Module (required) 2. Add non-root users to the "beep" group 3. Avoid using `beep` 4. Example Usage 1. Load the pkspkr.ko Kernel Driver Module (required) ----------------------------------------------------- To have a working PC speaker beep on Fedora >= 12, you must load the kernel driver module `pcspkr.ko` first. You can do this manually as root as follows: [root@host ~]# modprobe pcspkr If you want the system to automatically load the pcspkr driver the next time it boots, uncomment the alias platform:pcspkr pcspkr line in the `/etc/modprobe.d/beep.conf` config file. You can check whether pcspkr.ko is loaded by running [root@host ~]# lsmod | grep pcspkr as root. When pcspkr is loaded, you can run [root@host ~]# beep as root and verify that you hear the beep coming from the PC speaker. 2. Add non-root users to the "beep" group ----------------------------------------- To add user `jane` to the `beep` group, have root run [root@host ~]# usermod jane -a -G beep You can check which users are members of the `beep` group by running [user@host ~]$ getent group beep beep:x:951:jane,bill [user@host ~]$ However, any user newly added to the `beep` group must re-login so their processes can pick up the group membership. A user can check their group membership as follows: [jane@host ~]$ id uid=1000(jane) gid=1000(jane) groups=1000(jane),10(wheel),951(beep) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 [jane@host ~]$ To check the permission of the PC speaker device file, run [user@host ~]$ ls -lH /dev/input/by-path/platform-pcspkr-event-spkr crw-rw----+ 1 root input 13, 85 29. Dez 02:52 /dev/input/by-path/platform-pcspkr-event-spkr [user@host ~]$ getfacl /dev/input/by-path/platform-pcspkr-event-spkr getfacl: Removing leading '/' from absolute path names # file: dev/input/by-path/platform-pcspkr-event-spkr # owner: root # group: input user::rw- group:beep:-w- group::rw- mask::rw- other::--- [user@host ~]$ 3. Avoid using `beep` --------------------- An alternative way to get sound output for non-root users without becoming root works if the system has a sound card set up with a speaker connected to it. The standard 440Hz square wave which `beep` emits can be played through the standard sound infrastructure with the command `play` from the `sox` package (more pleasant examples are in the `sox(1)` man page): [jane@host ~]$ play -q -n synth 0.3 square 440 4. Example Usage ---------------- An acoustic notification when a long running compile job finishes (whether the build was successful or not) could be done with [jane@host ~/src/foobar]$ ./configure --prefix=$HOME/.local && make && make check && make install; beep or [bill@host ~/rpms/foobar]$ fedpkg mockbuild; beep