aboutsummaryrefslogtreecommitdiff
path: root/src/ossp/osspd.rc.d
blob: edb7a1b2788bcf86b4e19c38ca95081f4f750bd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/osspd


if [[ -z "$DSP_SLAVE" ]]; then
  # Autodetect
  if [[ -x /usr/bin/pulseaudio ]]; then
    DSP_SLAVE="/usr/sbin/ossp-padsp"
  else
    DSP_SLAVE="/usr/sbin/ossp-alsap"
  fi
fi

PID=`pidof -o %PPID /usr/sbin/osspd`
case "$1" in
  start)
    stat_busy "Starting OSS userspace bridge"
    if [ -z "$PID" ]; then 
      modprobe -a cuse snd-seq-oss &>/dev/null
      udevadm settle --quiet
      /usr/sbin/osspd --dsp-slave="$DSP_SLAVE"
    fi
    if [ -n "$PID" -o $? -gt 0 ]; then
      stat_fail
    else
      add_daemon osspd
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping OSS userspace bridge"
    [ -n "$PID" ] && kill $PID &>/dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm_daemon osspd
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac

# vim:set ft=sh: