diff options
Diffstat (limited to 'fbset.c')
-rw-r--r-- | fbset.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -32,9 +32,14 @@ | |||
32 | #include <ctype.h> | 32 | #include <ctype.h> |
33 | #include <sys/ioctl.h> | 33 | #include <sys/ioctl.h> |
34 | #include <linux/fb.h> | 34 | #include <linux/fb.h> |
35 | #include <linux/version.h> | ||
35 | 36 | ||
36 | #define PERROR(ctx) do { perror(ctx); exit(1); } while(0) | 37 | #define PERROR(ctx) do { perror(ctx); exit(1); } while(0) |
37 | 38 | ||
39 | #ifndef KERNEL_VERSION | ||
40 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
41 | #endif | ||
42 | |||
38 | #define DEFAULTFBDEV "/dev/fb0" | 43 | #define DEFAULTFBDEV "/dev/fb0" |
39 | #define DEFAULTFBMODE "/etc/fb.modes" | 44 | #define DEFAULTFBMODE "/etc/fb.modes" |
40 | 45 | ||
@@ -185,10 +190,16 @@ static void showmode(struct fb_var_screeninfo *v) | |||
185 | #endif | 190 | #endif |
186 | printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, | 191 | printf("\tgeometry %u %u %u %u %u\n", v->xres, v->yres, |
187 | v->xres_virtual, v->yres_virtual, v->bits_per_pixel); | 192 | v->xres_virtual, v->yres_virtual, v->bits_per_pixel); |
193 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) | ||
188 | printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, | 194 | printf("\ttimings %u %u %u %u %u %u %u\n", v->pixclock, v->left_margin, |
189 | v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, | 195 | v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, |
190 | v->vsync_len); | 196 | v->vsync_len); |
191 | printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); | 197 | printf("\taccel %s\n", (v->accel_flags > 0 ? "true" : "false")); |
198 | #else | ||
199 | printf("\ttimings %lu %lu %lu %lu %lu %lu %lu\n", v->pixclock, v->left_margin, | ||
200 | v->right_margin, v->upper_margin, v->lower_margin, v->hsync_len, | ||
201 | v->vsync_len); | ||
202 | #endif | ||
192 | printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, | 203 | printf("\trgba %u/%u,%u/%u,%u/%u,%u/%u\n", v->red.length, v->red.offset, |
193 | v->green.length, v->green.offset, v->blue.length, v->blue.offset, | 204 | v->green.length, v->green.offset, v->blue.length, v->blue.offset, |
194 | v->transp.length, v->transp.offset); | 205 | v->transp.length, v->transp.offset); |
@@ -215,7 +226,6 @@ extern int fbset_main(int argc, char **argv) | |||
215 | #endif | 226 | #endif |
216 | { | 227 | { |
217 | struct fb_var_screeninfo var, varset; | 228 | struct fb_var_screeninfo var, varset; |
218 | struct fb_fix_screeninfo fix; | ||
219 | int fh, i; | 229 | int fh, i; |
220 | char *fbdev = DEFAULTFBDEV; | 230 | char *fbdev = DEFAULTFBDEV; |
221 | char *modefile = DEFAULTFBMODE; | 231 | char *modefile = DEFAULTFBMODE; |