]>
Commit | Line | Data |
---|---|---|
aff35f5c | 1 | #!/bin/sh |
3864f278 | 2 | # $Id$ |
aff35f5c | 3 | # |
3864f278 | 4 | # fbset: Sets up fbcon video modes. |
aff35f5c | 5 | # |
6 | # | |
7 | # chkconfig: 2345 5 95 | |
3864f278 | 8 | # description: fbset is a utility with which fbcons video modes can be read |
aff35f5c | 9 | # and changed |
3864f278 | 10 | # |
11 | # config: /etc/sysconfig/fbset | |
aff35f5c | 12 | |
13 | ||
14 | # Source function library | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Get service config | |
3864f278 | 18 | if [ -f /etc/sysconfig/fbset ]; then |
19 | . /etc/sysconfig/fbset | |
20 | fi | |
aff35f5c | 21 | |
22 | # See how we were called. | |
23 | case "$1" in | |
24 | start) | |
3864f278 | 25 | # Check if service is already running? |
26 | if [ ! -f /var/lock/subsys/fbset ]; then | |
27 | # Check if we have framebuffer in kernel. | |
28 | if [ -f /proc/fb ]; then | |
29 | # /proc files show as files with size=0, this is a workaround. | |
30 | cat /proc/fb | grep -q "." || exit 0 | |
31 | else | |
8e90effd | 32 | # if not, then try to load specified kernel module |
33 | if [ -n "${FBMODULE}" ]; then | |
34 | _modprobe single $FBMODULE | |
35 | else | |
36 | exit 0 | |
37 | fi | |
3864f278 | 38 | fi |
aff35f5c | 39 | |
3864f278 | 40 | if [ -n "${FBMODE_default}" ]; then |
41 | show "Setting default video mode" | |
aff35f5c | 42 | busy |
3864f278 | 43 | # check if devfs (workaround: -a option don't work at all) |
44 | if [ -d /dev/vc ]; then | |
45 | for a in `ls /dev/vc/*`; do | |
46 | b=`ls $a | sed 's/\/dev\/vc\///g'` | |
8e90effd | 47 | /usr/bin/open -c $b -- /usr/sbin/fbset -fb /dev/fb/0 $FBMODE_default |
3864f278 | 48 | done |
49 | else | |
50 | for a in `ls /dev/tty[0-9] && ls /dev/tty[0-9][0-9]`; do | |
51 | b=`ls $a | sed 's/\/dev\/tty//g'` | |
52 | /usr/bin/open -c $b -- /usr/sbin/fbset $FBMODE_default | |
53 | done | |
54 | fi | |
aff35f5c | 55 | deltext |
56 | ok | |
57 | fi | |
3864f278 | 58 | touch /var/lock/subsys/fbset |
59 | else | |
60 | msg_Already_Running "fbset" | |
61 | exit 1 | |
62 | fi | |
aff35f5c | 63 | ;; |
3864f278 | 64 | stop) |
aff35f5c | 65 | rm -f /var/lock/subsys/fbset |
66 | ;; | |
67 | status) | |
68 | # Check if we have framebuffer in kernel. | |
69 | if [ -f /proc/fb ]; then | |
70 | # /proc files show as files with size=0, this is a workaround. | |
71 | cat /proc/fb | grep -q "." || exit 0 | |
72 | echo "Frame buffer present." | |
73 | fi | |
74 | ;; | |
75 | restart|reload) | |
76 | $0 stop | |
77 | $0 start | |
78 | ;; | |
79 | *) | |
844022ac | 80 | msg_Usage "$0 {start|stop|status|restart|reload}" |
aff35f5c | 81 | exit 1 |
82 | esac | |
83 | ||
84 | exit 0 |