summaryrefslogtreecommitdiff
path: root/app-misc/rogentoslive-tools/files/2/vga-cmd-parser
blob: 1e44317143022551071d8151d35fc07a7097889b (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
#!/usr/bin/python
# Copyright 2008 Fabio Erculiani, Sabayon Linux Chief Architect
# parses vga= parameters from cmdline given by isolinux and returns the right resolution
# Shut up!

res_map = {
	"0x385": ("640x400",24),
	"0x312": ("640x480",24),
	"0x315": ("800x600",24),
	"0x318": ("1024x768",24),
	"0x31b": ("1280x1024",24),
	"0x330": ("640x400",16),
	"0x33E": ("640x400",24),
	"0x331": ("640x480",16),
	"0x33F": ("640x480",24),
	"0x332": ("800x600",16),
	"0x340": ("800x600",24),
	"0x333": ("1024x768",16),
	"0x341": ("1024x768",24),
	"0x334": ("1152x864",16),
	"0x342": ("1152x864",24),
	"0x335": ("1280x960",16),
	"0x343": ("1280x960",24),
	"0x336": ("1280x1024",16),
	"0x344": ("1280x1024",24),
	"0x337": ("1400x1050",16),
	"0x345": ("1400x1050",24),
	"0x338": ("1600x1200",16),
	"0x346": ("1600x1200",24),
	"0x339": ("1792x1344",16),
	"0x347": ("1792x1344",24),
	"0x33A": ("1856x1392",16),
	"0x348": ("1856x1392",24),
	"0x33B": ("1920x1440",16),
	"0x349": ("1920x1440",24),
	"0x33C": ("2048x1536",16),
	"0x34A": ("2048x1536",24)
}

f = open("/proc/cmdline")
cmdline = f.readline().strip().split()
cmdline.reverse()
for item in cmdline:
	if item.startswith("vga="):
		item_split = item.split("=")
		if len(item_split) == 2:
			data = item_split[1]
			try:
				if res_map.get(data) != None:
					print res_map[data][0],res_map[data][1]
				break
			except TypeError:
				pass