summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <Alan.Coopersmith@sun.com>2005-09-28 17:07:55 +0000
committerAlan Coopersmith <Alan.Coopersmith@sun.com>2005-09-28 17:07:55 +0000
commit01e802406bc8ef19b22a9bb3782a1fbbb0f83707 (patch)
treea0fc7766a7fc4783690f9db0fdac7d4cc85c16fb
parent4ee8638ac7f420cc290b88018bc7702457d234fa (diff)
Updates for modularization and to match current Solaris version.XORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901
-rw-r--r--constype.c85
-rw-r--r--constype.man38
2 files changed, 70 insertions, 53 deletions
diff --git a/constype.c b/constype.c
index 10e9621..878f4ce 100644
--- a/constype.c
+++ b/constype.c
@@ -1,4 +1,4 @@
-/*
+/* $XdotOrg: $
* $Xorg: constype.c,v 1.3 2000/08/17 19:48:29 cpqbld Exp $
*
* consoletype - utility to print out string identifying Sun console type
@@ -38,8 +38,25 @@ Note on coding style: the function wu_fbid is actually located in a local
library, accounting for what otherwise might appear to be a strange coding
style.
*/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# if defined(SVR4) || defined(CSRG_BASED)
+# define STDC_HEADERS 1
+# endif
+# if defined(SVR4) || defined(__bsdi__)
+# define HAVE_SYS_FBIO_H 1
+# if defined(SVR4) && defined(sun)
+# define HAVE_SYS_VISUAL_IO_H 1
+# endif
+# elif defined(CSRG_BASED)
+# define HAVE_MACHINE_FBIO_H
+# endif
+#endif
+
#include <stdio.h>
-#if defined(SVR4) || defined(CSRG_BASED)
+#ifdef STDC_HEADERS
#include <string.h>
#else
/* SunOS */
@@ -47,12 +64,10 @@ style.
#endif
#include <unistd.h>
-int wu_fbid(char *devname, char **fbname, int *fbtype);
+static int wu_fbid(const char *devname, char **fbname, int *fbtype);
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int fbtype = -1;
char *fbname, *dev;
@@ -75,21 +90,22 @@ main (argc, argv)
putchar ('\n');
return error;
}
+
#include <sys/ioctl.h>
#include <sys/file.h>
-#if defined(SVR4) || defined(__bsdi__)
-#include <fcntl.h>
-#include <sys/fbio.h>
-#if defined(SVR4) && defined(sun)
+#ifdef HAVE_SYS_FBIO_H
+# include <fcntl.h>
+# include <sys/fbio.h>
+# ifdef HAVE_SYS_VISUAL_IO_H
/* VIS_GETIDENTIFIER ioctl added in Solaris 2.3 */
-#include <sys/visual_io.h>
-#endif
+# include <sys/visual_io.h>
+# endif
#else
-#ifndef CSRG_BASED
-#include <sun/fbio.h>
-#else
-#include <machine/fbio.h>
-#endif
+# ifndef HAVE_MACHINE_FBIO_H
+# include <sun/fbio.h>
+# else
+# include <machine/fbio.h>
+# endif
#endif
/* Sun doesn't see fit to update <sys/fbio.h> to reflect the addition
@@ -111,7 +127,7 @@ static char *decode_fb[] = {
"bw1", "cg1",
"bw2", "cg2",
"gp2",
- "bw3", "cg3",
+ "cg5", "cg3",
"cg8", "cg4",
"nsA", "nsB", "nsC",
#ifdef FBTYPE_SUNFAST_COLOR
@@ -143,16 +159,13 @@ static char *decode_fb[] = {
#endif
};
-int wu_fbid(devname, fbname, fbtype)
- char* devname;
- char** fbname;
- int* fbtype;
+static int
+wu_fbid(const char* devname, char** fbname, int* fbtype)
{
struct fbgattr fbattr;
int fd, ioctl_ret;
#ifdef VIS_GETIDENTIFIER
int vistype;
- char *visname = NULL;
struct vis_identifier fbid;
#endif
@@ -163,7 +176,10 @@ int wu_fbid(devname, fbname, fbtype)
#ifdef VIS_GETIDENTIFIER
if ((vistype = ioctl(fd, VIS_GETIDENTIFIER, &fbid)) >= 0) {
- visname = fbid.name;
+ *fbname = fbid.name;
+ *fbtype = vistype;
+ close(fd);
+ return 0;
}
#endif
@@ -172,13 +188,6 @@ int wu_fbid(devname, fbname, fbtype)
ioctl_ret = ioctl(fd, FBIOGTYPE, &fbattr.fbtype);
close(fd);
if ( ioctl_ret == -1 ) {
-#ifdef VIS_GETIDENTIFIER
- if (visname != NULL) {
- *fbname = visname;
- *fbtype = vistype;
- return 0;
- }
-#endif
*fbname = "ioctl on fb failed";
return 2;
}
@@ -191,13 +200,6 @@ int wu_fbid(devname, fbname, fbtype)
*fbname = "tcx";
return 0;
} else {
-#ifdef VIS_GETIDENTIFIER
- if (visname != NULL) {
- *fbname = visname;
- *fbtype = vistype;
- return 0;
- }
-#endif
*fbname = "unk";
return 1;
}
@@ -206,13 +208,6 @@ int wu_fbid(devname, fbname, fbtype)
* have entries for some of the values returned by the ioctl.
* Compare <sun/fbio.h> to the entries in "decode_fb" */
if ( decode_fb[fbattr.fbtype.fb_type] == NULL ) {
-#ifdef VIS_GETIDENTIFIER
- if (visname != NULL) {
- *fbname = visname;
- *fbtype = vistype;
- return 0;
- }
-#endif
*fbname = "unk";
return 1;
}
diff --git a/constype.man b/constype.man
index 9d7f5e0..4da1e9f 100644
--- a/constype.man
+++ b/constype.man
@@ -1,5 +1,5 @@
.\" $Xorg: constype.man,v 1.3 2000/08/17 19:48:29 cpqbld Exp $
-.\"
+.\" $XdotOrg: $
.\" $XFree86$
.\"
.TH CONSTYPE 1 __xorgversion__
@@ -13,22 +13,32 @@ constype \- print type of Sun console
.B \-num
]
.SH DESCRIPTION
-The
-.I constype
-program
-writes on the standard output the Sun code for the type of display
-that the console is.
+.B constype
+prints on the standard output the Sun code for the type of display
+that the specified device is.
The types output include these:
.sp 2
.in +0.5i
.nf
bw? Black and White, where ? is 1-4. (eg) 3-50s are bw2
-cg? Colour Graphics display, where ? is 1-4
+cg? Colour Graphics display, where ? is 1-6, 8, 12
gp? Optional Graphics Processor board, where ? is 1-2
ns? Not Sun display \(em where ? is A-J
.fi
.in -0.5i
.sp 2
+If the OS and device support the VIS_GETIDENTIFIER ioctl, the value
+returned from the ioctl is the value printed by constype. Sample types
+output for these include:
+.sp 2
+.in +0.5i
+.nf
+SUNWffb Sun Creator 3D (ffb) Graphics Accelerator
+SUNWm64 Sun PGX8, PGX24 or PGX64 Frame Buffer
+SUNWtext Generic vgatext console for Solaris x86 graphics devices without specific kernel drivers
+.fi
+.in -0.5i
+.sp 2
This is useful in determining startup values and defaults for window
systems.
.LP
@@ -51,8 +61,20 @@ The program exits with status 0 if it identified a known console type,
1 if the type was unknown, and 2 if the device could not be opened or
another error occurred.
.SH BUGS
-Not tested on all monitor types
+Not tested on all frame buffer types
+.SH "SEE ALSO"
+.BR visual_io (7I)
.SH COPYRIGHT
Copyright 1988, SRI
+.PP
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of SRI not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission. SRI makes no representations about the
+suitability of this software for any purpose. It is provided "as is"
+without express or implied warranty.
.SH AUTHOR
Doug Moran <moran@ai.sri.com>