#!/bin/sh
#

XSERVER=Xipaq
if [ -f /usr/bin/Xfbdev ]; then
  XSERVER=Xfbdev
fi

. /etc/profile

module_id() {
    ## used to read from assets, but sometimes assets is corrupted
    # grep "Module ID" /proc/hal/assets | sed "s/.*://"
    echo ' iPAQ' `cat /proc/hal/model`
}

export USER=root
export HOME=/root

ARGS="-dpi 100 -br"

# start off server in conventional location.
case `module_id` in
	" iPAQ 3100" | " iPAQ 3800")
		ARGS="$ARGS -screen 240x320@90 -rgba vrgb" ;;
	" iPAQ 3600" | " iPAQ 3700" | " iPAQ 3900")
		ARGS="$ARGS -screen 240x320@270 -rgba vbgr" ;;
	" iPAQ 5400")
		ARGS="$ARGS -rgba rgb" ;;
esac

exec $XSERVER $ARGS $*
