From: husemann@camelot.informatik.uni-erlangen.de (Dirk Husemann)
Subject: Re: BSDI, portables, and overhead projectors
Organization: CSD., University of Erlangen
Date: Mon, 12 Oct 1992 09:15:23 GMT

scs@iti.org (Steve Simmons) writes:


>Please forgive my depth of ignorance about PCs here . . .

>I will shortly be recieving a portable for the purpose of giving
>demos for a class.  My original plan was to put BSDI on it (go with
>what you know, right?) but there is a potential fly in the ointment.

>As part of the demo, they are currently connecting a device to the
>VGA output port of the portable.  This device can be placed on an
>overhead projector, and the entire class can see the result.  It
>turns out that one toggles the screen display between the lcd and
>the display unit by doing a magic key sequence on the keyboard.

Which --- unless you write some code for BSD/386 (and 386BSD to that
matter) --- works only while under BIOS control. We had this problem,
too. There are two ways to attack this:

	(1) Hit the Magic Keys while under BIOS control, i.e. at
	    boot time. Correct timing is crucial here 8=) Like playing
	    a pinball machine ...

	(2) Get documentation on the BIOS used by your laptop and write your
	    own little stuff for BSD/386, which we did after getting tired
	    of playing pin-ball ...

Find attached our piece of code which was done for a Compaq SLT 386/20. You need
to add the option COMPAQVGC to your config file:

	options 	COMPAQVGC

and the line

i386/isa/vgc.c	optional compaqvgc

to your files.i386 file in i386/config.

Also, you need to modify pccons.c to actually do something on hitting the
Magic Keys:

something along the line like:

[in function sgetc():]


		case ASCII: {
			exts = 0;
			if (!makebreak) {
	  			dt = pcconstab[dt].ascii[shfts | (ctls << 1) | (exalts << 2)];
				if (caps && (dt >= 'a' && dt <= 'z'))
		       			dt -= 'a' - 'A';
				if (alts) {
				        switch (dt) {
#ifdef COMPAQVGC
					case '<': vgaioctl(LCD);
					          break;
					case '>': vgaioctl(CRT);
					          break;
#endif /* COMPAQVGC */
					default:  dt |= 0x80;
					          break;
					}
				}
		            	return (dt);
			}


>If this key sequence won't work for BSDI, I'll have to drop back to
>DOS instead.  Anybody got a portable that they're doing this sort
>of thing with?  If so, let me know brand and sequence.

We're using the above on a Compaq SLT 386/20, but I should think that ---
given enough docs --- you should be able to do the same for your brand of
laptop.

	Dirk



Following is the piece of code. The copyright in this case is actually longer
then the code ...

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	vgc.h
#	vgc.c
#
echo x - vgc.h
sed 's/^X//' >vgc.h << 'END-of-vgc.h'
X/*
X * Copyright (c) 1992 Dirk Husemann, University of Erlangen-Nuremberg.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software developed by the University of
X *	Erlangen-Nuremberg.
X * 4. Neither the name of the University nor the names of its contributors
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE THE UNIVERSITY ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X/*
X * Support for switching from internal to external VGA on
X * a Compaq SLT386s/20
X */
X
X#define	LCD	0
X#define	CRT	1
X
X#define VGCPORT		0x3ce
X#define VGCCONFREG	0xb
END-of-vgc.h
echo x - vgc.c
sed 's/^X//' >vgc.c << 'END-of-vgc.c'
X/*
X * Copyright (c) 1992 Dirk Husemann, University of Erlangen-Nuremberg.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms, with or without
X * modification, are permitted provided that the following conditions
X * are met:
X * 1. Redistributions of source code must retain the above copyright
X *    notice, this list of conditions and the following disclaimer.
X * 2. Redistributions in binary form must reproduce the above copyright
X *    notice, this list of conditions and the following disclaimer in the
X *    documentation and/or other materials provided with the distribution.
X * 3. All advertising materials mentioning features or use of this software
X *    must display the following acknowledgement:
X *	This product includes software developed by the University of
X *	Erlangen-Nuremberg.
X * 4. Neither the name of the University nor the names of its contributors
X *    may be used to endorse or promote products derived from this software
X *    without specific prior written permission.
X *
X * THIS SOFTWARE IS PROVIDED BY THE THE UNIVERSITY ``AS IS'' AND
X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
X * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
X * SUCH DAMAGE.
X */
X
X#include "param.h"
X#include "ioctl.h"
X#include "errno.h"
X#include "syslog.h"
X#include "i386/isa/vgc.h"
X
X
X#define	VGCUNLOCK		{outb(VGCPORT, 0xf); outb(VGCPORT+1, 0x5);}
X#define	VGCLOCK			{outb(VGCPORT, 0xf); outb(VGCPORT+1, 0x0);}
X#define VGCREAD(reg, val)	{outb(VGCPORT, (reg)); val = inb(VGCPORT+1);}
X#define	VGCWRITE(reg, val)	{outb(VGCPORT, (reg)); outb(VGCPORT+1, (val));}
X
X/*
X * vgcioctl() may either be called from vgaioctl() or by pccons.c
X */
X
Xvgcioctl(int device)
X{
X	u_char c;
X
X	VGCUNLOCK;
X	VGCREAD(VGCCONFREG, c);
X	c = device ? (c | (1 << 3)) : (c & ~(1 << 3));
X	VGCWRITE(VGCCONFREG, c);
X	VGCLOCK;
X	return (1);
X}
END-of-vgc.c
exit

---

Xref: sparky comp.unix.bsd:7289 comp.unix.programmer:4938