updated on Sun Jan 22 12:09:12 UTC 2012
[aur-mirror.git] / ossp-git / osspd.rc.d
blob78d7602ae0015b32e9a05955909a4973a7f79b26
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/osspd
8 if [[ -z "$DSP_SLAVE" ]]; then
9 # Autodetect
10 if [[ -x /usr/bin/pulseaudio ]]; then
11 DSP_SLAVE="/usr/sbin/ossp-padsp"
12 else
13 DSP_SLAVE="/usr/sbin/ossp-alsap"
17 preclaim_oss=/sys/module/soundcore/parameters/preclaim_oss
19 PID=`pidof -o %PPID /usr/sbin/osspd`
20 case "$1" in
21 start)
22 stat_busy "Starting OSS userspace bridge"
23 if [ -z "$PID" ]; then
24 if [[ -r $preclaim_oss && "$(cat $preclaim_oss)" -eq 1 ]]; then
25 echo "Must boot with soundcore.preclaim_oss=0"
26 stat_die
28 modprobe cuse &>/dev/null
29 modprobe -r snd-pcm-oss snd-mixer-oss &>/dev/null
30 sleep 0.1
31 /usr/sbin/osspd --dsp-slave="$DSP_SLAVE"
33 if [ -n "$PID" -o $? -gt 0 ]; then
34 stat_fail
35 else
36 add_daemon osspd
37 stat_done
40 stop)
41 stat_busy "Stopping OSS userspace bridge"
42 [ -n "$PID" ] && kill $PID &>/dev/null
43 if [ $? -gt 0 ]; then
44 stat_fail
45 else
46 rm_daemon osspd
47 stat_done
50 restart)
51 $0 stop
52 sleep 1
53 $0 start
56 echo "usage: $0 {start|stop|restart}"
57 esac
59 # vim:set ft=sh: