File: build_x3_cfg

package info (click to toggle)
lessdisks 0.5.3cvs.20040906-16
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,480 kB
  • ctags: 271
  • sloc: sh: 3,058; makefile: 92
file content (273 lines) | stat: -rwxr-xr-x 9,271 bytes parent folder | download
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#!/bin/ash

#
# build_x3_cfg
#
# This script will generate the XF86Config file for a diskless workstation, as
# part of the Linux Terminal Server Project (http://www.LTSP.org)
#
# Copyright: James A. McQuillan <jam@Ltsp.org>  December 23, 2003
#
# Option XkbVariant added - wolfgang   May 5th, 2004
# FontPath lines "unscaled" added  - wolfgang May 11th, 2004 

# TODO move functions into common functions place...

X_DRIVER_SERVER=${1:-"SVGA"}
function_file=${2:-"/usr/share/lessdisks/ltsp_functions"}

. $function_file

test -e "$3" && . $3

# ash/dash use "echo", bash requires "echo -e"
echo="echo"

################################################################################

################################################################################
#
# Get the IP address of the default server.  This is used for XDM_SERVER,
# TELNET_HOST and SYSLOG_HOST if any of them are not set explicitly.
# Default to '192.168.0.254' if it is NOT set in the config file.
#

DEFAULT_SERVER=${SERVER:-"xapp"}

################################################################################
#
# Build the XF86Config file
#
echo "Building the XF86Config file" >/dev/tty

X_MOUSE_EMULATE3BTN=${X_MOUSE_EMULATE3BTN:-"N"}

if [ "${X_MOUSE_EMULATE3BTN}" = "Y" ]; then
    EMULATE3BUTTONS="Emulate3Buttons"
else
    EMULATE3BUTTONS=""
fi

#-----------------------------------------------------------------------
#
# Setup the FontPath info
#

USE_XFS=${USE_XFS:-"N"}

if [ "${USE_XFS}" = "Y" ]; then
    XFS_SERVER=${XFS_SERVER:-${DEFAULT_SERVER}}
    font_paths="tcp/${XFS_SERVER}:7100 $font_paths"
fi

get_files

if [ -n "$x3_modules" ]; then
  x_modules="$x3_modules"
fi
echo hey $x_modules
#-----------------------------------------------------------------------
#
# Setup Touch Screen info
#

USE_TOUCH=${USE_TOUCH:-"N"}
if [ "${USE_TOUCH}" = "Y" ]; then
  x_modules="$x_modules xf86Elo.so"
fi

get_module

#-----------------------------------------------------------------------
#
# Setup Keyboard and Mouse info
#

XkbTypes=${XKBTYPES:-"default"}
XkbCompat=${XKBCOMPAT:-"default"}
XkbSymbols=${XKBSYMBOLS:-"us(pc101)"}
XkbModel=${XKBMODEL:-"pc101"}
XkbLayout=${XKBLAYOUT:-"us"}

cat <<-EOF
    Section "ServerFlags"
    EndSection

    Section "Keyboard"
        Protocol        "Standard"
        AutoRepeat      500 5
        LeftAlt         Meta
        RightAlt        Meta
        ScrollLock      Compose
        RightCtl        Control
        XkbKeycodes     "xfree86"
        XkbTypes        "${XkbTypes}"
        XkbCompat       "${XkbCompat}"
        XkbSymbols      "${XkbSymbols}"
        XkbGeometry     "pc"
        XkbRules        "xfree86"
        XkbModel        "${XkbModel}"
        XkbLayout       "${XkbLayout}"
        XkbVariant      "${XkbVariant}"
    EndSection

    Section "Pointer"
        Protocol        "${X_MOUSE_PROTOCOL:-"PS/2"}"
        Device          "${X_MOUSE_DEVICE:-"/dev/psaux"}"
        Resolution      ${X_MOUSE_RESOLUTION:-400}
        Buttons         ${X_MOUSE_BUTTONS:-3}
        BaudRate        ${X_MOUSE_BAUD:-1200}
        AlwaysCore
        ZAxisMapping    4 5
        ${EMULATE3BUTTONS}
    EndSection
EOF

#-----------------------------------------------------------------------
#
# Setup the Touch Screen operating parameters
#
if [ "${USE_TOUCH}" = "Y" ]; then
    cat <<-EOF
        Section "Xinput"
            SubSection "Elographics"
                Port              "${X_TOUCH_DEVICE:-/dev/ttyS0}"
                DeviceName        "Elo"
                MinimumXPosition  ${X_TOUCH_MINX:-433}
                MaximumXPosition  ${X_TOUCH_MAXX:-3588}
                MinimumYPosition  ${X_TOUCH_MINY:-569}
                MaximumYPosition  ${X_TOUCH_MAXY:-3526}
                UntouchDelay      ${X_TOUCH_UNDELAY:-10}
                ReportDelay       ${X_TOUCH_RPTDELAY:-10}
                AlwaysCore
            EndSubSection
        EndSection
EOF
fi

#-----------------------------------------------------------------------
#
# Setup the Monitor info
#

X_HORZSYNC=${X_HORZSYNC:-"31-62"}
X_VERTREFRESH=${X_VERTREFRESH:-"55-90"}

# TODO use get_monitor function
cat <<-EOF
    Section "Monitor"
        Identifier      "My Monitor"
        VendorName      "Unknown"
        ModelName       "Unknown"
        HorizSync       ${X_HORZSYNC}
        VertRefresh     ${X_VERTREFRESH}
EOF

get_modelines() {
  cat <<-EOF
        Modeline "640x400"    25.175 640  664  760  800  400  409  411  450
        Modeline "640x400"    31.5   640  672 736   832  400  401  404  445  -HSync +VSync
        Modeline "640x480"    45.8   640  672  768  864  480  488  494  530  -HSync -VSync
        Modeline "640x480"    25.175 640  664  760  800  480  491  493  525
        Modeline "640x480"    31.5   640  680  720  864  480  488  491  521
        Modeline "640x480"    31.5   640  656  720  840  480  481  484  500  -HSync -VSync
        Modeline "640x480"    36     640  696  752  832  480  481  484  509  -HSync -VSync
        Modeline "800x600"    69.65  800  864  928 1088  600  604  610  640  -HSync -VSync
        Modeline "800x600"    36     800  824  896 1024  600  601  603  625
        Modeline "800x600"    40     800  840  968 1056  600  601  605  628  +hsync +vsync
        Modeline "800x600"    50     800  856  976 1040  600  637  643  666  +hsync +vsync
        Modeline "800x600"    60.75  800  864  928 1088  600  616  621  657  -HSync -VSync
        Modeline "1024x480"   65     1024 1032 1176 1344 480  491  493  525  -HSync -VSync
        Modeline "1024x768"   115.5  1024 1056 1248 1440 768  771  781  802  -HSync -VSync
        Modeline "1024x768"   65     1024 1032 1176 1344 768  771  777  806  -hsync -vsync
        Modeline "1024x768"   75     1024 1048 1184 1328 768  771  777  806  -hsync -vsync
        Modeline "1024x768"   85     1024 1032 1152 1360 768  784  787  823
        Modeline "1024x768"   98.9   1024 1056 1216 1408 768  782  788  822  -HSync -VSync
        Modeline "1152x864"   137.65 1152 1184 1312 1536 864  866  885  902  -HSync -VSync
        Modeline "1152x864"   89.9   1152 1216 1472 1680 864  868  876  892  -HSync -VSync
        Modeline "1152x864"   92     1152 1208 1368 1474 864  865  875  895
        Modeline "1152x864"   110    1152 1240 1324 1552 864  864  876  908
        Modeline "1152x864"   135    1152 1464 1592 1776 864  864  876  908
        Modeline "1280x960"   108    1280 1376 1488 1800 960  961  964  1000 +HSync +VSync
        Modeline "1280x960"   148.5  1280 1344 1504 1728 960  961  964  1011 +HSync +VSync
        Modeline "1280x1024"  181.75 1280 1312 1440 1696 1024 1031 1046 1072 -HSync -VSync
        Modeline "1280x1024"  110    1280 1328 1512 1712 1024 1025 1028 1054
        Modeline "1280x1024"  126.5  1280 1312 1472 1696 1024 1032 1040 1068 -HSync -VSync
        Modeline "1280x1024"  135    1280 1312 1456 1712 1024 1027 1030 1064
        Modeline "1280x1024"  135    1280 1312 1416 1664 1024 1027 1030 1064
        Modeline "1280x1024"  157.5  1280 1344 1504 1728 1024 1025 1028 1072 +HSync +VSync
        Modeline "1400x1050"  129    1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync
        Modeline "1400x1050"  151    1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync
        Modeline "1400x1050"  162    1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync
        Modeline "1400x1050"  184    1400 1464 1656 1960 1050 1051 1054 1100 +HSync +VSync
        Modeline "1600x1200"  162    1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
        Modeline "1600x1200"  189    1600 1664 1856 2160 1200 1201 1204 1250 -HSync -VSync
        Modeline "1600x1200"  202.5  1600 1664 1856 2160 1200 1201 1204 1250 +HSync +VSync
        Modeline "1600x1200"  220    1600 1616 1808 2080 1200 1204 1207 1244 +HSync +VSync
        Modeline "1800X1440"  230    1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
        Modeline "1800X1440"  250    1800 1896 2088 2392 1440 1441 1444 1490 +HSync +VSync
EOF
}

if [ -z "$modelines" ]; then
  get_modelines
fi

#
# CASE 1:
# If a mode is not specified then the default ones should be used.
#
if [ -z "$x_modes" ]; then
    x_modes="1024x768 800x600 640x480"
fi    

for mode in $x_modes; do
  all_modes="$all_modes \"$mode\""
done

cat <<-EOF
    EndSection

    Section "Device"
        Identifier        "My Video Card"
        VendorName        "Unknown"
        BoardName         "Unknown"
        ${XVIDRAM}
EOF
# TODO support driver types
#    for i in 01 02 03 04 05 06 07 08 09 10; do
#        X_DEV_VAR=X_DEVICE_OPTION_${i}
#        X_DEVICE_OPTION=${!X_DEV_VAR}
#        if [ "${X_DEVICE_OPTION}" ]; then
#            echo "        Option   \"${X_DEVICE_OPTION}\""
#        fi
#    done

echo EndSection


get_screen_section() {
cat <<-EOF

    Section "Screen"
        Driver            "$1"
        Device            "My Video Card"
        Monitor           "My Monitor"
        BlankTime         ${X_BLANKTIME:-5}
        SuspendTime       ${X_SUSPENDTIME:-10}
        OffTime           ${X_OFFTIME:-30}
        SubSection "Display"
            Depth         ${X_COLOR_DEPTH:-16}
EOF
if [ -n "$all_modes" ]; then
  $echo "\t\tModes\t$all_modes"
fi

$echo "\tEndSubSection"

echo EndSection
}

for driver in accel SVGA ; do
  get_screen_section $driver
done