detecting the cg6 board

Xemu Division, Velcro Industries david at eng.sun.com
Fri May 25 03:45:16 AEST 1990


In article <8102 at brazos.Rice.edu> pcad!eddy at uunet.uu.net (Eduardo Juncosa)
writes:
>I am trying to detect within a program whether the SPARC station that is
>executing the program had a cg6 graphics accelerator board installed.  SUN
>suggested I do a pr_open("/dev/cgsix0").

The person at Sun who suggested this should be shot (well, at least
corrected) because a) there is no need for a /dev/cgsix0 device (/dev/fb
works just fine) and b) there is such a thing as a multi-headed system you
know!

Probably the best way to do this is to get a file descriptor pointing to
the frame buffer device and then use the FBIOGATTR ioctl.  For example, in
a SunView program you might do something like...

	int fd;
	struct screen screen;
	struct fbgattr fbattr;

	win_screenget((int) window_get(win, WIN_FD), &screen);

	if ((fd = open(screen.scr_fbname, 2, 0)) < 0) {
		/* error */
	}

	if (ioctl(fd, FBIOGATTR, &fbattr) < 0 ||
		fbattr.fbtype.fb_type != FBTYPE_SUNFAST_COLOR) {
		/* it's not a cg6 */
	}
	else {
		/* it is a cg6 */
	}

	(void) close(fd);

David DiGiacomo, Sun Microsystems, Mt. View, CA  david at eng.sun.com



More information about the Comp.sys.sun mailing list