2487
|
1 #!/bin/sh
|
7376
|
2 #
|
|
3 # Gabucino - no warranty, this script can BOOM your TV and/or monitor, or else.
|
10237
|
4 # v3.0
|
9486
|
5 # This script has been tested and configured on a Matrox G400DH, a PAL TV,
|
|
6 # a 14" analog and a 15" digital monitor.
|
7376
|
7 #
|
|
8 # INSTALLATION:
|
|
9 # 1. READ MPLAYER'S TVOUT DOCUMENTATION!
|
10237
|
10 # 2. Choose proper mode at 'defaultmode', 'TVdefaultmode',
|
|
11 # and 'SetTVstandard' functions to fit your needs.
|
|
12 # You normally shouldn't touch anything else.
|
7376
|
13 # 3. Remove 'exit 1' safety check.
|
|
14 #
|
|
15
|
|
16 function defaultmode {
|
|
17 # You can choose the mode to use in monitor-only mode
|
|
18 # 640x480 60Hz 32bpp (14" monitors)
|
9839
|
19 fbset -a -xres 640 -yres 480 -vxres 640 -vyres 480 -depth 32 -pixclock 39721 -left 48 -right 16 -upper 33 -lower 10 -hslen 96 -vslen 2 -hsync high -accel true -laced false
|
7376
|
20 # 768x576 60Hz 32bpp (14" monitors)
|
9839
|
21 # fbset -a -xres 768 -yres 576 -vxres 768 -vyres 5460 -depth 32 -pixclock 26101 -left 144 -right 16 -upper 28 -lower 6 -hslen 112 -vslen 4 -accel true -laced false
|
7376
|
22 # 800x600 76Hz 32bpp (15" monitors)
|
9839
|
23 # fbset -a -xres 800 -yres 600 -vxres 800 -vyres 1440 -depth 32 -pixclock 20000 -left 128 -right 16 -upper 24 -lower 2 -hslen 96 -vslen 6 -laced false
|
7376
|
24 # 1024x768 70Hz 32bpp (15" monitors)
|
9839
|
25 # fbset -a -xres 1024 -yres 768 -vxres 1024 -vyres 1440 -depth 32 -pixclock 12500 -left 144 -right 32 -upper 30 -lower 2 -hslen 192 -vslen 6 -laced false
|
7376
|
26 }
|
|
27
|
|
28 function TVdefaultmode {
|
2487
|
29
|
7376
|
30 ##
|
|
31 ## PAL modes
|
|
32 ##
|
|
33
|
|
34 # 640x512 80Hz 32bpp
|
10237
|
35 fbset -fb $1 -a -depth 32 -left 60 -right 0 -upper 70 -lower 39 -hslen 76 -vslen 4 -xres 640 -yres 512 -bcast true -laced false
|
7376
|
36 # 640x528 83Hz 32bpp
|
10237
|
37 # fbset -fb $1 -a -depth 32 -left 40 -right 0 -upper 63 -lower 29 -hslen 56 -vslen 4 -xres 640 -yres 528 -vxres 640 -vyres 528 -laced false -bcast true
|
7376
|
38 # 720x576 78Hz 32bpp
|
10237
|
39 # fbset -fb $1 -a -depth 32 -left 54 -right -36 -upper 55 -lower -6 -hslen 46 -vslen 4 -xres 720 -yres 576 -vxres 720 -vyres 576 -laced false -bcast true
|
7376
|
40
|
|
41 ##
|
|
42 ## NTSC modes
|
|
43 ##
|
2487
|
44
|
7376
|
45 # 640x240 non-interlaced 32bpp
|
10237
|
46 # fbset -fb $1 -a -depth 32 -xres 640 -yres 240 -vxres 640 -vyres 240 -pixclock 79443 -left 72 -right 40 -upper 15 -lower 5 -hslen 48 -vslen 3 -laced false
|
7376
|
47 # 640x480 interlaced 32bpp
|
10237
|
48 # fbset -fb $1 -a -depth 32 -xres 640 -yres 480 -vxres 640 -vyres 480 -pixclock 79443 -left 72 -right 40 -upper 30 -lower 10 -hslen 48 -vslen 5 -laced true
|
7376
|
49 }
|
|
50
|
|
51 function SetTVstandard {
|
9838
|
52 matroxset 1 # PAL
|
7376
|
53 # matroxset 2 # NTSC
|
|
54 }
|
9485
|
55
|
|
56 function SetMonitorMode {
|
9486
|
57 matroxset 128
|
|
58 }
|
|
59
|
|
60 function mappingreset {
|
|
61 matroxset -f /dev/fb0 -m 0
|
|
62 matroxset -f /dev/fb1 -m 0
|
|
63 matroxset -f /dev/fb0 -m 1
|
|
64 con2fb /dev/fb0 /dev/tty1
|
|
65 con2fb /dev/fb0 /dev/tty2
|
|
66 SetMonitorMode
|
|
67 defaultmode
|
9485
|
68 }
|
|
69
|
9486
|
70 function warn {
|
|
71 clear
|
10237
|
72 echo "tty2 will be automatically transferred to fb1 using the con2fb utility."
|
|
73 echo
|
9486
|
74 echo
|
10237
|
75 echo "A big \"1\" letter will be displayed on tty1 after the change."
|
|
76 echo "A big \"2\" letter will be displayed on tty2 after the change."
|
9486
|
77 echo
|
|
78 echo
|
|
79 echo "If you read this, PRESS ANY KEY TO CONTINUE"
|
|
80 read
|
9485
|
81 }
|
9486
|
82
|
|
83 function warn2 {
|
10237
|
84 id1 > /dev/tty1 &
|
|
85 id2 > /dev/tty2 &
|
|
86 }
|
|
87
|
|
88 function id1 {
|
|
89 sleep 1
|
9486
|
90 clear
|
|
91 echo
|
|
92 echo
|
|
93 echo
|
|
94 echo
|
10237
|
95 echo
|
|
96 echo
|
|
97 echo
|
|
98 echo
|
|
99 echo
|
|
100 echo
|
|
101 echo
|
|
102 echo " ****"
|
|
103 echo " *****"
|
|
104 echo " ******"
|
|
105 echo " *******"
|
|
106 echo " ***"
|
|
107 echo " ***"
|
|
108 echo " ***"
|
|
109 echo " ***"
|
|
110 echo " ***"
|
|
111 echo " *****"
|
|
112 echo
|
|
113 echo
|
|
114 echo " FAST console"
|
|
115 echo
|
9486
|
116 echo
|
10237
|
117 echo " Press ALT-F1 to change here"
|
|
118 }
|
|
119
|
|
120 function id2 {
|
|
121 sleep 1
|
|
122 clear
|
|
123 echo
|
|
124 echo
|
|
125 echo
|
|
126 echo
|
|
127 echo
|
|
128 echo
|
|
129 echo
|
|
130 echo
|
|
131 echo
|
|
132 echo
|
|
133 echo
|
|
134 echo " *****"
|
|
135 echo " ** **"
|
|
136 echo " * **"
|
|
137 echo " **"
|
|
138 echo " **"
|
|
139 echo " **"
|
|
140 echo " **"
|
|
141 echo " **"
|
|
142 echo " ** **"
|
|
143 echo " *******"
|
|
144 echo
|
|
145 echo
|
|
146 echo " SLOW console"
|
|
147 echo
|
|
148 echo
|
|
149 echo " Press ALT-F2 to change here"
|
|
150 }
|
9486
|
151
|
7376
|
152 echo
|
|
153 echo "Please read MPlayer's TV-out documentation, and install 'matroxset' and 'fbset'."
|
|
154 echo "Then edit this script to suit your monitor+TV set."
|
|
155 echo
|
9487
|
156 exit 1
|
2487
|
157
|
|
158 while [ 1 ]; do
|
|
159
|
|
160 clear
|
|
161
|
7524
|
162 echo " [ 0 ] Clear & blank screen"
|
7376
|
163 echo " [ 1 ] Monitor only"
|
9485
|
164 echo
|
10237
|
165 echo " [ 2 ] Cloning - CRTC1 -> Monitor"
|
|
166 echo " CRTC2 -> TV"
|
|
167 echo
|
|
168 echo " [ 3 ] Cloning - CRTC1 -> Monitor1"
|
|
169 echo " CRTC2 -> Monitor2"
|
9485
|
170 echo
|
10237
|
171 echo " [ 4 ] DualHead - CRTC1 -> Monitor1"
|
|
172 echo " CRTC2 -> Monitor2"
|
|
173 echo
|
|
174 echo " [ 5 ] DualHead - CRTC1 -> Monitor2 (SWAP!)"
|
|
175 echo " CRTC2 -> Monitor1"
|
9486
|
176 echo
|
10237
|
177 echo " [ 6 ] DualHead - CRTC1 -> Monitor1"
|
|
178 echo " CRTC2 -> TV"
|
|
179 echo
|
|
180 echo " [ 7 ] DualHead - CRTC1 -> TV (SWAP!)"
|
|
181 echo " CRTC2 -> Monitor1"
|
2487
|
182
|
|
183 echo
|
|
184
|
10237
|
185 echo "-- TV MODES on /dev/fb0 -- TV MODES on /dev/fb1"
|
9486
|
186 echo
|
10237
|
187 echo " [ a ] 640x512 PAL [ A ] 640x512 PAL"
|
|
188 echo " [ s ] 640x528 PAL [ S ] 640x528 PAL"
|
|
189 echo " [ d ] 720x576 PAL [ D ] 720x576 PAL"
|
|
190 echo " [ f ] 640x240 NTSC [ F ] 640x240 NTSC"
|
|
191 echo " [ g ] 640x480 NTSC, interlaced [ G ] 640x480 NTSCl"
|
|
192 echo
|
|
193 echo " (Warning, fb0 and fb1 tend to change RANDOMLY with these mode changers..)"
|
2487
|
194
|
|
195 read ABC
|
|
196
|
|
197 case "$ABC" in
|
7524
|
198 0)
|
|
199 clear
|
|
200 setterm -cursor off
|
|
201 setterm -blank 0
|
|
202 read
|
9486
|
203 setterm -cursor on
|
7524
|
204 ;;
|
|
205
|
2487
|
206 1)
|
9486
|
207 mappingreset
|
2487
|
208 echo
|
|
209 ;;
|
|
210
|
|
211 2)
|
9486
|
212 mappingreset
|
2487
|
213 matroxset -f /dev/fb0 -m 3
|
7376
|
214 SetTVstandard
|
10237
|
215 TVdefaultmode /dev/fb0
|
2487
|
216 ;;
|
|
217
|
9485
|
218 3)
|
9486
|
219 mappingreset
|
9485
|
220 matroxset -f /dev/fb0 -m 3
|
|
221 ;;
|
|
222
|
|
223 4)
|
9486
|
224 warn
|
|
225 mappingreset
|
|
226 matroxset -f /dev/fb0 -m 1
|
|
227 matroxset -f /dev/fb1 -m 2
|
|
228 warn2
|
|
229 ;;
|
|
230
|
|
231 5)
|
|
232 warn
|
|
233 mappingreset
|
9485
|
234 matroxset -f /dev/fb0 -m 2
|
|
235 matroxset -f /dev/fb1 -m 1
|
9486
|
236 warn2
|
9485
|
237 ;;
|
|
238
|
10237
|
239 6)
|
|
240 warn
|
|
241 mappingreset
|
|
242 con2fb /dev/fb1 /dev/tty2
|
|
243 matroxset -f /dev/fb0 -m 1
|
|
244 matroxset -f /dev/fb1 -m 2
|
|
245 SetTVstandard
|
|
246 TVdefaultmode /dev/fb1
|
|
247 warn2
|
|
248 ;;
|
|
249
|
|
250 7)
|
|
251 warn
|
|
252 mappingreset
|
|
253 con2fb /dev/fb1 /dev/tty2
|
|
254 matroxset -f /dev/fb0 -m 2
|
|
255 matroxset -f /dev/fb1 -m 1
|
|
256 SetTVstandard
|
|
257 TVdefaultmode /dev/fb0
|
|
258 warn2
|
|
259 ;;
|
|
260
|
2487
|
261 a)
|
7376
|
262 # 640x512 80Hz 32bpp
|
10237
|
263 fbset -depth 32 -left 60 -right 0 -upper 70 -lower 39 -hslen 76 -vslen 4 -xres 640 -yres 512 -bcast true -laced false
|
|
264 ;;
|
|
265
|
|
266 A)
|
|
267 # 640x512 80Hz 32bpp
|
|
268 fbset -fb /dev/fb1 -depth 32 -left 60 -right 0 -upper 70 -lower 39 -hslen 76 -vslen 4 -xres 640 -yres 512 -bcast true -laced false
|
2487
|
269 ;;
|
|
270
|
|
271 s)
|
7376
|
272 # 640x528 83Hz 32bpp
|
10237
|
273 fbset -depth 32 -left 40 -right 0 -upper 63 -lower 29 -hslen 56 -vslen 4 -xres 640 -yres 528 -vxres 640 -vyres 528 -laced false -bcast true
|
|
274 ;;
|
|
275
|
|
276 S)
|
|
277 # 640x528 83Hz 32bpp
|
|
278 fbset -fb /dev/fb1 -depth 32 -left 40 -right 0 -upper 63 -lower 29 -hslen 56 -vslen 4 -xres 640 -yres 528 -vxres 640 -vyres 528 -laced false -bcast true
|
2487
|
279 ;;
|
|
280
|
|
281 d)
|
7376
|
282 # 720x576 78Hz 32bpp
|
10237
|
283 # fbset -depth 32 -left 54 -right -36 -upper 55 -lower -6 -hslen 46 -vslen 4 -xres 720 -yres 576 -vxres 720 -vyres 576 -laced false -bcast true
|
|
284 fbset -depth 32 -right -36 -lower -6 -hslen 46 -vslen 4 -xres 720 -yres 576 -vxres 720 -vyres 576 -laced false -bcast true
|
|
285 ;;
|
|
286
|
|
287 D)
|
|
288 # 720x576 78Hz 32bpp
|
|
289 # fbset -fb /dev/fb1 -depth 32 -left 54 -right -36 -upper 55 -lower -6 -hslen 46 -vslen 4 -xres 720 -yres 576 -vxres 720 -vyres 576 -laced false -bcast true
|
|
290 fbset -fb /dev/fb1 -depth 32 -right -36 -lower -6 -hslen 46 -vslen 4 -xres 720 -yres 576 -vxres 720 -vyres 576 -laced false -bcast true
|
2487
|
291 ;;
|
|
292
|
7376
|
293 f)
|
|
294 # 640x240 non-interlaced 32bpp
|
10237
|
295 fbset -depth 32 -xres 640 -yres 240 -vxres 640 -vyres 240 -pixclock 79443 -left 72 -right 40 -upper 15 -lower 5 -hslen 48 -vslen 3 -laced false
|
|
296 ;;
|
|
297
|
|
298 F)
|
|
299 # 640x240 non-interlaced 32bpp
|
|
300 fbset -fb /dev/fb1 -depth 32 -xres 640 -yres 240 -vxres 640 -vyres 240 -pixclock 79443 -left 72 -right 40 -upper 15 -lower 5 -hslen 48 -vslen 3 -laced false
|
7376
|
301 ;;
|
|
302
|
|
303 g)
|
|
304 # 640x480 interlaced 32bpp
|
10237
|
305 fbset -depth 32 -xres 640 -yres 480 -vxres 640 -vyres 480 -pixclock 79443 -left 72 -right 40 -upper 30 -lower 10 -hslen 48 -vslen 5 -laced true
|
|
306 ;;
|
|
307
|
|
308 G)
|
|
309 # 640x480 interlaced 32bpp
|
|
310 fbset -fb /dev/fb1 -depth 32 -xres 640 -yres 480 -vxres 640 -vyres 480 -pixclock 79443 -left 72 -right 40 -upper 30 -lower 10 -hslen 48 -vslen 5 -laced true
|
7376
|
311 ;;
|
2487
|
312 esac
|
|
313
|
|
314 done
|