Mirror of git://git.busybox.net/busybox with our patches on top
Source
35
35
#include "busybox.h"
36
36
37
37
#define DEFAULTFBDEV "/dev/fb0"
38
38
#define DEFAULTFBMODE "/etc/fb.modes"
39
39
40
40
static const int OPT_CHANGE = (1 << 0);
41
41
static const int OPT_INFO = (1 << 1);
42
42
static const int OPT_READMODE = (1 << 2);
43
43
44
44
enum {
45
-
CMD_HELP = 0,
46
45
CMD_FB = 1,
47
46
CMD_DB = 2,
48
47
CMD_GEOMETRY = 3,
49
48
CMD_TIMING = 4,
50
49
CMD_ACCEL = 5,
51
50
CMD_HSYNC = 6,
52
51
CMD_VSYNC = 7,
53
52
CMD_LACED = 8,
54
53
CMD_DOUBLE = 9,
55
54
/* CMD_XCOMPAT = 10, */
131
130
__u32 reserved[6]; /* Reserved for future compatibility */
132
131
};
133
132
134
133
135
134
static struct cmdoptions_t {
136
135
char *name;
137
136
unsigned char param_count;
138
137
unsigned char code;
139
138
} g_cmdoptions[] = {
140
139
{
141
-
"-h", 0, CMD_HELP}, {
142
140
"-fb", 1, CMD_FB}, {
143
141
"-db", 1, CMD_DB}, {
144
142
"-a", 0, CMD_ALL}, {
145
143
"-i", 0, CMD_INFO}, {
146
144
"-g", 5, CMD_GEOMETRY}, {
147
145
"-t", 7, CMD_TIMING}, {
148
146
"-accel", 1, CMD_ACCEL}, {
149
147
"-hsync", 1, CMD_HSYNC}, {
150
148
"-vsync", 1, CMD_VSYNC}, {
151
149
"-laced", 1, CMD_LACED}, {
152
150
"-double", 1, CMD_DOUBLE}, {
153
-
"-help", 0, CMD_HELP}, {
154
151
"-n", 0, CMD_CHANGE}, {
155
152
#ifdef BB_FEATURE_FBSET_FANCY
156
-
"-help", 0, CMD_HELP}, {
157
153
"-all", 0, CMD_ALL}, {
158
154
"-xres", 1, CMD_XRES}, {
159
155
"-yres", 1, CMD_YRES}, {
160
156
"-vxres", 1, CMD_VXRES}, {
161
157
"-vyres", 1, CMD_VYRES}, {
162
158
"-depth", 1, CMD_DEPTH}, {
163
159
"-match", 0, CMD_MATCH}, {
164
160
"-geometry", 5, CMD_GEOMETRY}, {
165
161
"-pixclock", 1, CMD_PIXCLOCK}, {
166
162
"-left", 1, CMD_LEFT}, {
349
345
350
346
/* parse cmd args.... why do they have to make things so difficult? */
351
347
argv++;
352
348
argc--;
353
349
for (; argc > 0 && (thisarg = *argv); argc--, argv++) {
354
350
for (i = 0; g_cmdoptions[i].name; i++) {
355
351
if (!strcmp(thisarg, g_cmdoptions[i].name)) {
356
352
if (argc - 1 < g_cmdoptions[i].param_count)
357
353
show_usage();
358
354
switch (g_cmdoptions[i].code) {
359
-
case CMD_HELP:
360
-
show_usage();
361
355
case CMD_FB:
362
356
fbdev = argv[1];
363
357
break;
364
358
case CMD_DB:
365
359
modefile = argv[1];
366
360
break;
367
361
case CMD_GEOMETRY:
368
362
varset.xres = strtoul(argv[1], 0, 0);
369
363
varset.yres = strtoul(argv[2], 0, 0);
370
364
varset.xres_virtual = strtoul(argv[3], 0, 0);