2 * Copyright (c) 1992, 2000 Hellmuth Michaelis
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 /*---------------------------------------------------------------------------*
30 * ispcvt - check for pcvt driver running and its options
31 * ------------------------------------------------------
33 * Last Edit-Date: [Fri Mar 31 10:24:43 2000]
37 *---------------------------------------------------------------------------*/
43 #include <machine/pcvt_ioctl.h>
52 struct pcvtinfo pcvtinfo;
62 while( (c = getopt(argc, argv, "cd:nv")) != -1)
92 if((fd = open(device, O_RDWR)) == -1)
95 warn("ERROR opening %s", device);
104 if(ioctl(fd, VGAPCVTID, &pcvtid) == -1)
107 warn("ioctl VGAPCVTID failed, error");
111 if(!strcmp(pcvtid.name, PCVTIDNAME))
113 if(pcvtid.rmajor == PCVTIDMAJOR)
115 if(pcvtid.rminor != PCVTIDMINOR)
118 warnx("minor revision: expected %d, got %d", PCVTIDMINOR, pcvtid.rminor);
119 exit(4); /* minor revision mismatch */
125 warnx("major revision: expected %d, got %d", PCVTIDMAJOR, pcvtid.rmajor);
126 exit(3); /* major revision mismatch */
132 warnx("name check: expected %s, got %s", PCVTIDNAME, pcvtid.name);
133 exit(2); /* name mismatch */
138 warnx("\nkernel and utils match, driver name [%s], release [%1.1d.%02.2d]\n",
139 pcvtid.name, pcvtid.rmajor, pcvtid.rminor);
142 if(config == 0 && n_screens == 0)
145 if(ioctl(fd, VGAPCVTINFO, &pcvtinfo) == -1)
148 warn("ioctl VGAPCVTINFO failed, error");
154 printf("%d", pcvtinfo.nscreens);
160 fprintf(stderr,"PCVT_NSCREENS = %u\t\t", pcvtinfo.nscreens);
161 fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
162 fprintf(stderr,"PCVT_UPDATESLOW = %u\t\t", pcvtinfo.updateslow);
163 fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
164 fprintf(stderr,"PCVT_PCBURST = %u\t\t", pcvtinfo.pcburst);
165 fprintf(stderr,"PCVT_KBD_FIFO_SZ = %u\n\n", pcvtinfo.kbd_fifo_sz);
167 /* config booleans */
169 fprintf(stderr,"PCVT_132GENERIC = %s",
170 (pcvtinfo.compile_opts & CONF_132GENERIC) ? "ON" : "OFF");
172 fprintf(stderr,"PCVT_24LINESDEF = %s",
173 (pcvtinfo.compile_opts & CONF_24LINESDEF) ? "ON" : "OFF");
175 fprintf(stderr,"PCVT_CTRL_ALT_DEL = %s",
176 (pcvtinfo.compile_opts & CONF_CTRL_ALT_DEL) ? "ON" : "OFF");
178 fprintf(stderr,"PCVT_INHIBIT_NUMLOCK = %s",
179 (pcvtinfo.compile_opts & CONF_INHIBIT_NUMLOCK) ? "ON" : "OFF");
181 fprintf(stderr,"PCVT_META_ESC = %s",
182 (pcvtinfo.compile_opts & CONF_META_ESC) ? "ON" : "OFF");
184 fprintf(stderr,"PCVT_NO_LED_UPDATE = %s",
185 (pcvtinfo.compile_opts & CONF_NO_LED_UPDATE) ? "ON" : "OFF");
187 fprintf(stderr,"PCVT_NULLCHARS = %s",
188 (pcvtinfo.compile_opts & CONF_NULLCHARS) ? "ON" : "OFF");
190 fprintf(stderr,"PCVT_PRETTYSCRNS = %s",
191 (pcvtinfo.compile_opts & CONF_PRETTYSCRNS) ? "ON" : "OFF");
193 fprintf(stderr,"PCVT_SCREENSAVER = %s",
194 (pcvtinfo.compile_opts & CONF_SCREENSAVER) ? "ON" : "OFF");
196 fprintf(stderr,"PCVT_SETCOLOR = %s",
197 (pcvtinfo.compile_opts & CONF_SETCOLOR) ? "ON" : "OFF");
199 fprintf(stderr,"PCVT_SHOWKEYS = %s",
200 (pcvtinfo.compile_opts & CONF_SHOWKEYS) ? "ON" : "OFF");
202 fprintf(stderr,"PCVT_SLOW_INTERRUPT = %s",
203 (pcvtinfo.compile_opts & CONF_SLOW_INTERRUPT) ? "ON" : "OFF");
205 fprintf(stderr,"PCVT_USEKBDSEC = %s",
206 (pcvtinfo.compile_opts & CONF_USEKBDSEC) ? "ON" : "OFF");
208 fprintf(stderr,"PCVT_VT220KEYB = %s",
209 ((u_int)pcvtinfo.compile_opts & (u_int)CONF_VT220KEYB) ? "ON" : "OFF");
211 fprintf(stderr,"XSERVER = %s",
212 (pcvtinfo.compile_opts & CONF_XSERVER) ? "ON" : "OFF");
215 fprintf(stderr,"PCVT_GREENSAVER = %s",
216 (pcvtinfo.compile_opts & CONF_GREENSAVER) ? "ON" : "OFF");
218 fprintf(stderr,"\n\n");
222 fprintf(stderr,"PCVT_NSCREENS = %u\n", pcvtinfo.nscreens);
223 fprintf(stderr,"PCVT_UPDATEFAST = %u\n", pcvtinfo.updatefast);
224 fprintf(stderr,"PCVT_UPDATESLOW = %u\n", pcvtinfo.updateslow);
225 fprintf(stderr,"PCVT_SYSBEEPF = %u\n", pcvtinfo.sysbeepf);
226 fprintf(stderr,"Compile options = 0x%08X\n", pcvtinfo.compile_opts);
232 fprintf(stderr,"\nispcvt - verify current video driver is the pcvt-driver\n");
233 fprintf(stderr," usage: ispcvt [-c] [-d device] [-n] [-v]\n");
234 fprintf(stderr,"options: -c print compile time configuration\n");
235 fprintf(stderr," -d <name> use devicefile <name>\n");
236 fprintf(stderr," -n print number of virtual screens (to stdout)\n");
237 fprintf(stderr," -v be verbose\n\n");
245 fprintf(stderr, "%s", (i == 0) ? "\t\t" : "\n");