]> git.pld-linux.org Git - packages/afbinit.git/blob - afbinit.init
- added actions: force-reload, status (obligatory), try-restart (optional)
[packages/afbinit.git] / afbinit.init
1 #!/bin/sh
2 #
3 # afbinit       firmware loader for Elite 3D cards
4 #
5 # chkconfig:    2345 90 10
6 #
7 # description:  Load microcode at boottime to all detected Elite3D
8 #               graphics cards.
9 #
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 UCODE=/lib/firmware/afb.ucode
15 LOADER=/usr/sbin/afbinit
16
17 ARCH=$(uname -m)
18 # If this is not sparc64, get out of here.
19 if [ "$ARCH" != "sparc64" ]; then
20         echo "$ARCH cannot have AFB"
21         return 1
22 fi
23         
24 # The microcode must exist.
25 if [ ! -f $UCODE ]; then
26         echo "Missing microcode"
27         return 1
28 fi
29         
30 # Make FB device list.
31 afb_devs=$(awk '/Elite/ {printf "fb%d\n",$1}' /proc/fb) 
32 if [ -z "$afb_devs" ]; then
33         echo "No AFB detected"
34         return 1
35 fi
36
37 start()
38 {
39         # Load microcode onto each card.
40         for afb in $afb_devs; do
41                 show "Starting afbinit for $afb device "
42                 busy
43                 $LOADER /dev/$afb $UCODE > /dev/null
44                 RETVAL=$?
45                 [ $RETVAL -eq 0 ] && ok || fail
46         done
47 }
48
49 RETVAL=0
50 case "$1" in
51         start|restart|try-restart|reload|force-reload)
52                 start
53                 ;;
54         stop)
55                 ;;
56         status)
57                 echo "AFB devices present: $afb_devs"
58                 ;;
59         *)
60                 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload}"
61                 exit 3
62                 ;;
63 esac
64 exit $RETVAL
This page took 0.119521 seconds and 4 git commands to generate.