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
14 if [ -f /etc/sysconfig/fbset ]; then
15 . /etc/sysconfig/fbset
18 if [ -z "${FBMODULE}" ]; then
20 start|stop|restart|force-reload)
26 # Source function library
27 . /etc/rc.d/init.d/functions
29 # Setting default depth
30 if [ -n "${DEPTH}" ]; then
31 DEPTH_options="-depth ${DEPTH}"
34 if [ -z "${FBDEV_NUM}" ]; then
39 # Check if service is already running?
40 if [ ! -f /var/lock/subsys/fbset ]; then
42 # Check if we have framebuffer in kernel.
43 if [ -f /proc/fb ]; then
44 # /proc files show as files with size=0, this is a workaround.
45 cat /proc/fb | grep -q "." || modprobe single $FBMODULE
47 # if not, then try to load specified kernel module
48 modprobe single $FBMODULE
51 if [ -n "${FBMODE_default}" ]; then
52 show "Setting default video mode"
55 # check if devfs (workaround: -a option don't work at all)
56 if [ -d /dev/vc ]; then
57 if [ -z "$FBTERMINALS" ]; then
58 FBTERMINALS=$(ls /dev/vc/)
60 FBDEV=/dev/fb/${FBDEV_NUM}
63 if [ -z "$FBTERMINALS" ]; then
64 FBTERMINALS=$(awk -F: '/^[0-9]*:/{print $1}' /etc/inittab)
66 FBDEV=/dev/fb${FBDEV_NUM}
74 for cons in $FBTERMINALS; do
75 /usr/bin/con2fb $FBDEV $cons
76 /usr/bin/switchto $cons
78 $FBDEV ${DEPTH_options} $FBMODE_default \
79 0<>/dev/tty$cons >&0 2>&0
81 [ $tty = "/dev/console" ] && tty=1
82 /usr/bin/switchto $tty
85 touch /var/lock/subsys/fbset
87 msg_already_running fbset
92 if [ -f /var/lock/subsys/fbset ]; then
93 rm -f /var/lock/subsys/fbset
99 # See how we were called.
108 # Check if we have framebuffer in kernel.
109 if [ -f /proc/fb ]; then
110 # /proc files show as files with size=0, this is a workaround.
111 cat /proc/fb | grep -q "." && nls "Frame buffer present." && exit 0
114 nls "Frame buffer not present."
117 restart|force-reload)
122 msg_usage "$0 {start|stop|restart|force-reload|status}"