4 # fbset: Sets up fbcon video modes.
7 # chkconfig: 2345 69 31
8 # description: fbset is a utility with which fbcons video modes can be read \
11 # config: /etc/sysconfig/fbset
13 # Source function library
14 . /etc/rc.d/init.d/functions
17 if [ -f /etc/sysconfig/fbset ]; then
18 . /etc/sysconfig/fbset
23 if [ -n "${FBMODULE}" ]; then
24 _modprobe single $FBMODULE
30 # Setting default depth
31 if [ -n "${DEPTH}" ]; then
32 DEPTH_options="-depth ${DEPTH}"
35 if [ -z "${FBDEV_NUM}" ]; then
39 # See how we were called.
42 # Check if service is already running?
43 if [ ! -f /var/lock/subsys/fbset ]; then
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.
48 cat /proc/fb | grep -q "." || try_load
50 # if not, then try to load specified kernel module
54 if [ -n "${FBMODE_default}" ]; then
55 show "Setting default video mode"
58 # check if devfs (workaround: -a option don't work at all)
59 if [ -d /dev/vc ]; then
60 if [ -z "$FBTERMINALS" ]; then
61 FBTERMINALS="`ls /dev/vc/* | sed 's|/dev/vc/||g'`"
63 FBDEV=`echo /dev/fb/${FBDEV_NUM}`
64 pattern="s/\/dev\/vc\///g"
66 if [ -z "$FBTERMINALS" ]; then
67 FBTERMINALS="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d:`"
69 FBDEV=`echo /dev/fb${FBDEV_NUM}`
70 pattern="s/\/dev\/tty//g"
74 tty=`/usr/bin/tty | sed $pattern`
76 for cons in $FBTERMINALS; do
77 /usr/bin/con2fb $FBDEV $cons
78 /usr/bin/switchto $cons
80 $FBDEV ${DEPTH_options} $FBMODE_default \
81 0<>/dev/tty$cons >&0 2>&0
83 [ $tty = "/dev/console" ] && tty=1
84 /usr/bin/switchto $tty
87 touch /var/lock/subsys/fbset
89 msg_already_running fbset
93 if [ -f /var/lock/subsys/fbset ]; then
94 rm -f /var/lock/subsys/fbset
100 # Check if we have framebuffer in kernel.
101 if [ -f /proc/fb ]; then
102 # /proc files show as files with size=0, this is a workaround.
103 cat /proc/fb | grep -q "." && nls "Frame buffer present." && exit 0
104 nls "Frame buffer not present."
107 nls "Frame buffer not present."
111 restart|force-reload)
117 msg_usage "$0 {start|stop|restart|force-reload|status}"