Path: utzoo!attcan!uunet!husc6!rice!sun-spots-request From: dna@emmy.umd.edu (Doug Arnold) Newsgroups: comp.sys.sun Subject: Re: How to discover screen depth Message-ID: <8811142048.AA08370@emmy.umd.edu> Date: 23 Nov 88 07:43:13 GMT Sender: usenet@rice.edu Reply-To: Sun-Spots@Rice.edu Organization: Rice University, Houston, Texas Lines: 64 Approved: Sun-Spots@rice.edu Original-Date: Mon, 14 Nov 88 15:48:45 EST X-Sun-Spots-Digest: Volume 7, Issue 24, message 6 of 12 >> Is there an easy way to find out the screen depth? I use the following simple program, which I call displaytype. It works like this: emmy% displaytype Sun 2 or 3 color 900 x 1152 x 8 pixels emmy% rsh athena displaytype Sun 2 or 3 monochrome 900 x 1152 x 1 pixels There should be a better way to handle color 3/60's or other machines with two framebuffers correctly. It currently reports monochrome. Perhaps someone knows how to do it? -- Doug Arnold (dna@emmy.umd.edu or arnold@eneevax.umd.edu) /* * displaytype -- identify type of display connected to Sun workstation * compile with "cc -o displaytype displaytype.c" */ #include #include #include #include #include extern int errno; char *displaytype[] = { "Sun 1 monochrome", "Sun 1 color", "Sun 2 or 3 monochrome", "Sun 2 or 3 color", "Sun 2 or 3 graphics processor", "type unknown", "type unknown", "Sun 4 monochrome", "Sun 4 color", "" }; main() { int fd; struct fbtype fbinfo; /* struct for frame buffer info */ fd = open("/dev/fb", O_RDONLY); if (fd < 0) { printf("Error opening /dev/fb, error #%d\n", errno); exit(2); } if (ioctl(fd, FBIOGTYPE, &fbinfo) == -1) { printf("Ioctl error on /dev/fb, error #%d\n", errno); exit(3); } printf("%s %d x %d x %d pixels\n", displaytype[fbinfo.fb_type], fbinfo.fb_height, fbinfo.fb_width, fbinfo.fb_depth); exit(0); }