Posts Tagged pc speaker not working in centos 5
PC speaker and CentOS 5
Ah, I just was lazy the other day and surfing around while I came across some pfSense stuff. I remembered the way it belled the beeps during startups and shutdowns being one of the good things that I liked about when I had it (yea, it pretty much sucked in my dual wan environment as a load balancer so I tried to switching to ClearOS, of course an RHEL5 based firewall; nevertheless I totally agree to what Linus once said ‘I claim that Mach people (and apparently FreeBSD) are incompetent idiots’) like you instantly click good features of a thing when you think about anything in first few thoughts. This is sometime really helpful for home-servers which don’t always have a monitor plugged into their consoles.
As I used ‘beep’ program already a few times in Ubuntu I knew it would be interesting to use it with new ‘-n’ feature instead of using issuing beep command for an each frequency beep. That is, the whole script here at http://redmine.pfsense.org/repositories/annotate/pfsense/usr/local/bin/beep.sh can be translated into a single beep command of:
beep -f 500 -l 155 -n -f 400 -l 155 -n -f 600 -l 155 -n -f 800 -l 155 -n -f 800 -l 155 -n -f 600 -l 155 -n -f 800 -l 155 -n -f 500 -l 155 -n -f 400 -l 155 -n -f 400 -l 155
But after installing beep and running didn’t make any sound. I witnessed that spkr kernel module as well as the motherboard speaker were well being detected but still no sound. After investigating, it turns out that its bug in kernel earlier than 2.6.18-164 interestingly using external speakers instead of PC’s internal one for producing system bells. Basically its a bug called as an ‘aggression’ for a feature that breaks of with any newer kernel release. I saw multiple bugs relating to the problem in Red Hat’s bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=532444, https://bugzilla.redhat.com/show_bug.cgi?id=525390 and https://bugzilla.redhat.com/show_bug.cgi?id=526751. So, I hit upon the CentOS 5′s lastest kernel, 2.6.18-194.8.1.el5 and that gave me back my system beeps
[root@Bassu ~]# dmesg | grep -i ‘speaker’
input: PC Speaker as /class/input/input2
[root@Bassu ~]# lsmod | grep -i spkr
pcspkr 7105 0
Almost I finished adding beeps in rc.local and shutdown, I stumbled upon a good init script which I modified a bit and added chkconfig parameters so it can be added into RHEL’s ntsysv services – exactly what I needed! Then I found another beep melody for Beethoven’s theme
beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460
Add below script to file, /etc/init.d/beep, make it executable and do a ‘chkconfig –add beep’ to add it as a system service.
#!/bin/sh
# chkconfig: 2345 95 20
# description: Beep PC speaker with analog melody on startup and stoppage
#
# processname: beep
NAME=beep
BEEP=/usr/bin/$NAME
MELODY_START="-f 65.4064 -l 100 -n -f 130.813 -l 100 -n -f 261.626 -l 100 -n -f 523.251 -l 100 -n -f 1046.50 -l 100 -n -f 2093.00 -l 100 -n -f 4186.01 -l 100"
MELODY_STOP="-f 523.251 -l 100 -D 100 -n -f 391.995 -l 100 -D 100 -n -f 329.628 -l 100 -D 100 -n -f 261.626 -l 200"
SCRIPTNAME=/etc/init.d/$NAME
#ARGS="-e /dev/input/event0"
# Exit if the package is not installed
[ -x "$BEEP" ] || exit 0
case "$1" in
start)
$BEEP $ARGS $MELODY_START
;;
stop)
$BEEP $ARGS $MELODY_STOP
;;
restart|force-reload)
# Do nothing
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
With that said, coming out of Mario world and now going back to my laziness
UPDATE:
Talking about the Mario, I just created its beep command from some random junk of frequencies I found. So, here it goes:
beep -f 330 -l 137 -n -f 330 -l 275 -n -f 330 -l 137 -d 137 -n -f 262 -l 137 -n -f 330 -l 275 -n -f 392 -l 550 -d 550 -n -f 262 -l 412 -n -f 196 -l 137 -d 275 -n -f 164 -l 137 -d 137 -n -f 220 -l 275 -n -f 247 -l 137 -d 137 -n -f 233 -l 137 -n -f 220 -l 275 -n -f 196 -l 205 -n -f 330 -l 205 -n -f 392 -l 275 -n -f 440 -l 275 -n -f 349 -l 137 -n -f 392 -l 137 -d 137 -n -f 330 -l 275 -n -f 262 -l 137 -n -f 294 -l 137 -n -f 247 -l 412 -n -f 262 -l 412 -n -f 196 -l 137 -d 275 -n -f 164 -l 275 -d 137 -n -f 220 -l 275 -n -f 247 -l 137 -d 137 -n -f 233 -l 137 -n -f 220 -l 275 -n -f 196 -l 205 -n -f 330 -l 205 -n -f 392 -l 275 -n -f 440 -l 275 -n -f 349 -l 137 -n -f 392 -l 137 -d 137 -n -f 330 -l 275 -n -f 262 -l 137 -n -f 294 -l 137 -n -f 247 -l 412 -d 275 -n -f 392 -l 137 -n -f 370 -l 137 -n -f 349 -l 137 -n -f 311 -l 275 -n -f 330 -l 137 -d 137 -n -f 207 -l 137 -n -f 220 -l 137 -n -f 262 -l 137 -d 137 -n -f 220 -l 137 -n -f 262 -l 137 -n -f 294 -l 137 -d 275 -n -f 392 -l 137 -n -f 370 -l 137 -n -f 349 -l 137 -n -f 311 -l 275 -n -f 330 -l 137 -d 137 -n -f 523 -l 275 -n -f 523 -l 137 -n -f 523 -l 550 -n -f 392 -l 137 -n -f 370 -l 137 -n -f 349 -l 137 -n -f 311 -l 275 -n -f 330 -l 137 -d 137 -n -f 207 -l 137 -n -f 220 -l 137 -n -f 262 -l 137 -d 137 -n -f 220 -l 137 -n -f 262 -l 137 -n -f 294 -l 137 -d 275 -n -f 311 -l 275 -d 137 -n -f 294 -l 275 -n -f 262 -l 550 -d 550



Recent Comments