aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/xserver-kdrive-common/xserver-kdrive-common/Xserver
blob: 347b005c33196017836e5b608ab5d79f223ca831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/sh
#

# note xinit needs full server path
if [ -f /usr/bin/Xfbdev ]; then
  XSERVER=/usr/bin/Xfbdev
fi
if [ -f /usr/bin/Xepson ]; then
  XSERVER=/usr/bin/Xepson
fi
if [ -f /usr/bin/Xorg ]; then
  XSERVER=/usr/bin/Xorg
fi

. /etc/profile

fallback_screen_arg() {
    geom=`fbset | grep geometry`
    w=`echo $geom | awk '{ print $2 }'`
    h=`echo $geom | awk '{ print $3 }'`
    b=`echo $geom | awk '{ print $6 }'`
    echo -n "${w}x${h}x${b}"
}

screen_width() {
    geom=`fbset | grep geometry`
    w=`echo $geom | awk '{ print $2 }'`
    echo -n "${w}"
}


module_id() {
    ## used to read from assets, but sometimes assets is corrupted
    # grep "Module ID" /proc/hal/assets | sed "s/.*://"
    ## used to read from /proc/hal/model, but that is removed in 2.6
    # echo ' iPAQ' `cat /proc/hal/model`
    awk 'BEGIN { FS=": " } /Hardware/ { print $2 } ' </proc/cpuinfo
}

export USER=root

SCREEN_SIZE=`fallback_screen_arg`

ARGS=" -pn"
PPM=" -br"

# use ucb 1x00 touchscreen if present
if [ -z "$TSLIB_TSDEVICE" ] && [ -e /dev/touchscreen/ucb1x00 ]; then
  ARGS="$ARGS -mouse /dev/touchscreen/ucb1x00"
fi

# Xorg doesn't support "-mouse" option, and uses /dev/input/mouse0 automatically
# On neo we have touchscreen as /dev/input/mice, usb connected mouse would be probably mouse0
if [ -z "$TSLIB_TSDEVICE" ] && [ -e /dev/input/mouse0 ]; then
  if [ "$XSERVER" != "/usr/bin/Xorg" ]; then
    ARGS="$ARGS -mouse /dev/input/mouse0"
  fi
  USB_MOUSE="1"
fi

# start off server in conventional location.
case `module_id` in
	"trout")
		ARGS="$ARGS -mouse tslib"
		XSERVER=/usr/bin/Xfbdev
		;;
        "AML M8050")
                ARGS="$ARGS -dpi 100 -screen 320x240@270" ;;
        "HP iPAQ H3100" | "HP iPAQ H3800")
                ARGS="$ARGS -dpi 100 -rgba vrgb -screen ${SCREEN_SIZE}@90" ;;
        "HP iPAQ H3600" | "HP iPAQ H3700" | "HP iPAQ H3900")
                ARGS="$ARGS -dpi 100 -rgba vbgr -screen ${SCREEN_SIZE}@270" ;;
        "HP iPAQ H5400" | "HP iPAQ H2200")
                ARGS="$ARGS -dpi 100 -rgba rgb" ;;
        "HP iPAQ HX4700")
                ARGS="$ARGS -dpi 200"
                IMAGEON="w3220"
                ;;
        "Ramses")
                # What is this "vt2" in aid of?
                ARGS="$ARGS -dpi 100 -rgba vrgb -screen ${SCREEN_SIZE}@90 vt2" ;;
        # both 'Sharp-Collie' and just 'Collie' have been reported
        *Poodle)
                ARGS="$ARGS -dpi 100 -rgba vrgb -screen ${SCREEN_SIZE}@270" ;;
        *Collie)
                ARGS="$ARGS -dpi 100 -rgba vrgb -screen ${SCREEN_SIZE}@270" ;;
        "SHARP Shepherd" | "SHARP Husky" | "SHARP Corgi")
                if [ `screen_width` -gt 330 ] ; then
                     DPI=200
                else
                     DPI=100
                fi 
                ARGS="$ARGS -dpi ${DPI} -rgba rgb"
                IMAGEON="w100"
                ;;
        "SHARP Spitz" | "SHARP Akita" | "SHARP Borzoi")
                ARGS="$ARGS -dpi 200 -rgba rgb -screen ${SCREEN_SIZE}@270" ;;
        "Simpad")
                ARGS="$ARGS -dpi 100 -rgba rgb" ;;
        "Generic OMAP1510/1610/1710")
                ARGS="$ARGS -dpi 220 -mouse /dev/input/event0" ;;
        "Cellon C8000 Board")
                ARGS="$ARGS -dpi 100 -screen ${SCREEN_SIZE},10,1" ;;
        "HTC Magician")
                ARGS="$ARGS -dpi 142" ;;
        "HTC Universal")
                ARGS="$ARGS -dpi 225 -screen ${SCREEN_SIZE}@270" ;;
        "ARM-IntegratorCP" | "ARM-Versatile PB")
                ARGS="$ARGS -rgba vrgb" ;;
        "Compulab CM-x270")
                modprobe mbxfb
                ARGS="$ARGS -fb /dev/fb1" ;;
        "GTA01" | "GTA02")
                if [ `screen_width` -gt 330 ] ; then
                     if [ -f "/usr/share/pixmaps/xsplash-vga.ppm" ]; then
                          PPM="-root-ppm /usr/share/pixmaps/xsplash-vga.ppm"
                     fi
                     DPI=280
                else
                     if [ -f "/usr/share/pixmaps/xsplash-qvga.ppm" ]; then
                          PPM="-root-ppm /usr/share/pixmaps/xsplash-qvga.ppm"
                     fi
                     DPI=142
                fi 
                if [ "$XSERVER" = "/usr/bin/Xorg" ]; then
                     if [ -z "${USB_MOUSE}" ]; then
                         # Fix for segfault while typing on illume keyboard
                         ARGS="$ARGS -nocursor"
                     fi
                     ARGS="$ARGS -dpi ${DPI} vt1"
                elif [ `module_id` == "GTA02" ] ; then
                     ARGS="$ARGS -dpi ${DPI} -screen ${SCREEN_SIZE} -mouse tslib -hide-cursor ${PPM} vt1" 
                     XSERVER=/usr/bin/Xglamo 
                fi
		;;
	"Nokia N770")
                ARGS="$ARGS -dpi 225 -screen ${SCREEN_SIZE} -mouse tslib" 
                XSERVER=/usr/bin/Xomap ;;
        "Nokia N800")
                ARGS="$ARGS -dpi 225 -screen ${SCREEN_SIZE} -mouse tslib" 
                XSERVER=/usr/bin/Xomap ;;
	"Palm Treo 650")
                if [ -f "/usr/share/pixmaps/xsplash-qvga-square.ppm" ]; then
                     PPM="-root-ppm /usr/share/pixmaps/xsplash-qvga-square.ppm"
                fi
                ARGS="$ARGS -dpi 181 -screen 320x320 -mouse tslib -hide-cursor ${PPM}" ;;
        "Motorola Ezx Platform" | \
        "Motorola EZX"*)
                if [ -f "/usr/share/pixmaps/xsplash-qvga.ppm" ]; then
                     PPM="-root-ppm /usr/share/pixmaps/xsplash-qvga.ppm ${PPM}"
                fi
                ARGS="$ARGS -dpi 170 -mouse tslib -hide-cursor -screen ${SCREEN_SIZE} ${PPM}" ;;
	"Glofiish M800")
                if [ -f "/usr/share/pixmaps/xsplash-vga.ppm" ]; then
                     PPM="-root-ppm /usr/share/pixmaps/xsplash-vga.ppm"
                fi
                ARGS="$ARGS -dpi 285 -screen ${SCREEN_SIZE} -mouse tslib -hide-cursor ${PPM} vt1" ;;
        "Freescale MX21ADS")
	# That's what /proc/cpuinfo shows as hardware on the chumby
                 ARGS="$ARGS -dpi 121 -screen 320x240 -hide-cursor -mouse tslib" ;;
        "Ronetix PM9261" | "Ronetix PM9261/BB9261" | "Ronetix PM9263" | \
        "Ronetix PM9263/BB9261"  | "Ronetix PM9263/BB9263")               
                ARGS="$ARGS -screen 240/54x320/81@90x16"                      
                ;;  
        "OMAP3 Beagle Board" | "Gumstix Overo")
                 ARGS="$ARGS ${PPM}"
# 32bpp - we'll enable it once newer kernels are.. working.                 
#                 ARGS="$ARGS -fbbpp32"
                 XSERVER=/usr/bin/Xorg ;;
         "Bug-Labs BUG")
                 if [ "$XSERVER" = "/usr/bin/Xorg" ];then
                      ARGS=""
                 fi;; #TODO: handle kdrive
        *)
                # It is a device we do not know about, in which case we force
                # kdrive to use the current framebuffer geometry -- otherwise
                # it will default to trying to achieve 1024x768
                S=${SCREEN_SIZE}
                ARGS="$ARGS -screen $S" ;;
esac

if [ ! -z "$IMAGEON" ]; then
  if [ -f /usr/bin/Xw100 ]; then
    XSERVER=/usr/bin/Xw100
  fi
  if [ -f /usr/bin/Ximageon ]; then
    XSERVER=/usr/bin/Ximageon
  fi
fi

DISPLAY=':0'

exec xinit /etc/X11/Xsession -- $XSERVER $DISPLAY $ARGS $* >/tmp/x.log 2>&1