2 * Copyright (c) 1987-1993, The University of Utah and
3 * the Center for Software Science at the University of Utah (CSS).
6 * Permission to use, copy, modify and distribute this software is hereby
7 * granted provided that (1) source code retains these copyright, permission,
8 * and disclaimer notices, and (2) redistributions including binaries
9 * reproduce the notices in supporting documentation, and (3) all advertising
10 * materials mentioning features or use of this software display the following
11 * acknowledgement: ``This product includes software developed by the Center
12 * for Software Science at the University of Utah.''
14 * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
15 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
16 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 * CSS requests users of this software to return to css-dist@cs.utah.edu any
19 * improvements that they make and grant CSS redistribution rights.
21 * from: Utah $Hdr: grfinfo.c 1.3 94/04/04$
22 * $NetBSD: grfinfo.c,v 1.8 2001/02/19 23:22:43 cgd Exp $
25 #include <sys/cdefs.h>
27 __RCSID("$NetBSD: grfinfo.c,v 1.8 2001/02/19 23:22:43 cgd Exp $");
30 #include <sys/types.h>
31 #include <sys/ioctl.h>
32 #include <dev/grfioctl.h>
47 { GRFGATOR
, "gatorbox" },
48 { GRFBOBCAT
, "topcat" },
49 { GRFRBOX
, "renaissance" },
50 { GRFFIREEYE
, "fireeye" },
51 { GRFHYPERION
, "hyperion" },
52 { GRFDAVINCI
, "davinci" },
56 void getinfo
__P((void));
57 int main
__P((int, char **));
58 void printall
__P((void));
59 const char *tname
__P((void));
60 void usage
__P((void));
69 while ((c
= getopt(argc
, argv
, "at")) != -1)
90 printf("%s\n", tname());
100 if (f
< 0 || ioctl(f
, GRFIOCGINFO
, &gi
) < 0) {
113 printf("%s: %d x %d ", dname
, gi
.gd_dwidth
, gi
.gd_dheight
);
114 if (gi
.gd_colors
< 3)
115 printf("monochrome");
117 printf("%d color", gi
.gd_colors
);
119 printf(", %d plane", gi
.gd_planes
);
121 printf(" %s\n", tname());
122 printf("registers: 0x%x bytes at %p\n",
123 gi
.gd_regsize
, gi
.gd_regaddr
);
124 printf("framebuf: 0x%x bytes at %p (%d x %d)\n",
125 gi
.gd_fbsize
, gi
.gd_fbaddr
, gi
.gd_fbwidth
, gi
.gd_fbheight
);
133 for (gp
= info
; gp
->grf_id
>= 0; gp
++)
134 if (gi
.gd_id
== gp
->grf_id
)
137 * Heuristics to differentiate catseye from topcat:
138 * low-res color catseye has 1k x 1k framebuffer and 64 colors
139 * hi-res mono and color catseye have 1280 wide display
141 if (gi
.gd_id
== GRFBOBCAT
&&
142 (gi
.gd_dwidth
== 1280 ||
143 (gi
.gd_fbsize
== 0x100000 && gi
.gd_colors
== 64)))
145 return(gp
->grf_name
);
152 fprintf(stderr
, "usage: %s [-at] device\n", getprogname());