]>
Commit | Line | Data |
---|---|---|
aff35f5c | 1 | #!/bin/sh |
3864f278 | 2 | # $Id$ |
aff35f5c | 3 | # |
3864f278 | 4 | # fbset: Sets up fbcon video modes. |
aff35f5c | 5 | # |
6 | # | |
efa5a496 | 7 | # chkconfig: 2345 69 31 |
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 | |
aff35f5c | 13 | # Source function library |
14 | . /etc/rc.d/init.d/functions | |
15 | ||
16 | # Get service config | |
3864f278 | 17 | if [ -f /etc/sysconfig/fbset ]; then |
18 | . /etc/sysconfig/fbset | |
19 | fi | |
aff35f5c | 20 | |
b3c5d50d | 21 | function try_load |
22 | { | |
23 | if [ -n "${FBMODULE}" ]; then | |
24 | _modprobe single $FBMODULE | |
25 | else | |
26 | exit 0 | |
27 | fi | |
28 | } | |
109b85b6 | 29 | |
4a590e27 PG |
30 | # Setting default depth |
31 | if [ -n "${DEPTH}" ]; then | |
32 | DEPTH_options="-depth ${DEPTH}" | |
33 | fi | |
b3c5d50d | 34 | |
109b85b6 | 35 | if [ -z "${FBDEV_NUM}" ]; then |
36 | FBDEV_NUM=0 | |
37 | fi | |
38 | ||
aff35f5c | 39 | # See how we were called. |
40 | case "$1" in | |
41 | start) | |
3864f278 | 42 | # Check if service is already running? |
43 | if [ ! -f /var/lock/subsys/fbset ]; then | |
109b85b6 | 44 | |
3864f278 | 45 | # Check if we have framebuffer in kernel. |
46 | if [ -f /proc/fb ]; then | |
47 | # /proc files show as files with size=0, this is a workaround. | |
b3c5d50d | 48 | cat /proc/fb | grep -q "." || try_load |
3864f278 | 49 | else |
8e90effd | 50 | # if not, then try to load specified kernel module |
b3c5d50d | 51 | try_load |
3864f278 | 52 | fi |
aff35f5c | 53 | |
3864f278 | 54 | if [ -n "${FBMODE_default}" ]; then |
55 | show "Setting default video mode" | |
aff35f5c | 56 | busy |
109b85b6 | 57 | |
3864f278 | 58 | # check if devfs (workaround: -a option don't work at all) |
59 | if [ -d /dev/vc ]; then | |
61e2d117 JB |
60 | if [ -z "$FBTERMINALS" ]; then |
61 | FBTERMINALS="`ls /dev/vc/* | sed 's|/dev/vc/||g'`" | |
62 | fi | |
109b85b6 | 63 | FBDEV=`echo /dev/fb/${FBDEV_NUM}` |
3864f278 | 64 | else |
61e2d117 JB |
65 | if [ -z "$FBTERMINALS" ]; then |
66 | FBTERMINALS="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d:`" | |
67 | fi | |
109b85b6 | 68 | FBDEV=`echo /dev/fb${FBDEV_NUM}` |
3864f278 | 69 | fi |
109b85b6 | 70 | |
61e2d117 | 71 | for cons in $FBTERMINALS; do |
03987246 | 72 | /usr/bin/open -c $cons -- /usr/bin/fbset -fb $FBDEV ${DEPTH_options} $FBMODE_default |
109b85b6 | 73 | done |
74 | ||
aff35f5c | 75 | deltext |
76 | ok | |
77 | fi | |
3864f278 | 78 | touch /var/lock/subsys/fbset |
79 | else | |
a7d21194 | 80 | msg_already_running "fbset" |
3864f278 | 81 | exit 1 |
82 | fi | |
aff35f5c | 83 | ;; |
109b85b6 | 84 | stop) |
4a590e27 PG |
85 | if [ -f /var/lock/subsys/fbset ]; then |
86 | rm -f /var/lock/subsys/fbset | |
87 | else | |
88 | msg_not_running fbset | |
89 | fi | |
aff35f5c | 90 | ;; |
91 | status) | |
92 | # Check if we have framebuffer in kernel. | |
93 | if [ -f /proc/fb ]; then | |
94 | # /proc files show as files with size=0, this is a workaround. | |
95 | cat /proc/fb | grep -q "." || exit 0 | |
96 | echo "Frame buffer present." | |
97 | fi | |
98 | ;; | |
99 | restart|reload) | |
100 | $0 stop | |
101 | $0 start | |
102 | ;; | |
103 | *) | |
109b85b6 | 104 | msg_usage "$0 {start|stop|status|restart|reload}" |
aff35f5c | 105 | exit 1 |
106 | esac | |
107 | ||
108 | exit 0 |