#!/bin/sh
### BEGIN INIT INFO
# Provides:          console-fb
# Required-Start:    udev boot-basics
# Required-Stop:     
# Default-Start:     S
# Default-Stop:
# Short-Description: Start console framebuffer
# Description:       Enable console framebuffer
### END INIT INFO

# ugly hacks follow

tablet_setup()
{
	BOOTTYPE=0
	if [ -e /tmp/.bootmode ]; then
		BOOTTYPE=`cat /tmp/.bootmode`
	fi
	if [ -e /boot/tmp/.bootmode ]; then
		BOOTTYPE=`cat /boot/tmp/.bootmode`
	fi
	if [ x$BOOTTYPE = x3 ]; then
		BOOTTYPE=2
	fi
	if [ x$BOOTTYPE = x4 ]; then
		BOOTTYPE=2
	fi
	
	if [ x$BOOTTYPE = x2 ]; then
	        for n in fbcon bitblit softcursor font ; do
	                modprobe $n
	        done
        	/sbin/fb_update_mode auto
        else
        	echo Not enabling framebuffer, wrong boot type.
        fi
}

case "$1" in
        start|restart|force-reload)
        tablet_setup
        ;;
        stop)
        ;;
        *)
        echo "Usage: /etc/init.d/console-fb {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac
