Subject: Re: Keyboard/Mouse drivers on SGI

From: Steve Alexander <[email-masked]>
Date: Mon, 23 Jun 1997 21:15:29 -0700

Miguel de Icaza <[email-masked]> writes:
>   I see that the Xsgi server uses /dev/input/mouse and
>/dev/output/keyboard.  I can see from par's output that it does some
>STREAMS ioctls it I_PUSH'es something (I am not even remotely familiar
>to STREAMS, so I dunno what those I_PUSHes do).

I am not the best person to explain this, but my understanding is that the
keyboard and mouse (or spaceball, etc...) are linked (I_LINKed) under a driver
called 'shmiq,' which is the shared-memory event queue driver.  This driver
takes STREAMS data from the underlying devices and converts it into some sort
of standard event queue.  This allows events to be given to the X server in a
standard format, and I believe that this is done by pinning memory in the
X server and then copying events into this memory; I have no idea what happens
if the server doesn't respond fast enough.

My guess is that /dev/input/{keyboard,mouse} are both some sort of standard
serial port driver and that the modules I_PUSHed on top are what interpret the
low-level keyboard/mouse protocols.

SCO use a similar approach; their driver is called 'ev' if I remember
correctly.

So, if my theory is correct, what I'd expect to see is:

	mfd = open /dev/input/mouse
	I_PUSH mfd "mouse"
	kfd = open /dev/input/keyboard
	I_PUSH kfd "keyboard"

	sfd = open /dev/shmiq
	I_LINK sfd mfd
	I_LINK sfd kfd

More than that, I don't know.

-- Steve

---

From: "William J. Earl" <[email-masked]>
Date: Tue, 24 Jun 1997 12:04:31 -0700

Steve Alexander writes:
...
 > More than that, I don't know.

     There are drivers for the actual devices, such as pckm on Indy,
to operate the actual keyboard controller, and then there are higher
level streams modules, such as pckbd and pcmouse on Indy, which know
about the keyboard and mouse devices (and other devices, such as
tablets).  The IRIX pckeyboard(7) and pcmouse(7) man pages document the
supported keyboards and mice.  As far as I know, the interface to the
streams modules is not well-documented, as it is used directly only
by the X server and the textport driver.  

    For the time being, I recommend that you go with the usual linux
driver for PC keyboard/mouse controller, which the Indy hardware 
emulates.

---

From: Miguel de Icaza <[email-masked]>
Date: Thu, 26 Jun 1997 20:32:43 -0500

> driver for PC keyboard/mouse controller, which the Indy hardware 

I may probably go with a SunOS-like mode of this, since it may be the
easier to hack on the X server I am using right now (X11R6.1, and I
plan to move to X11R6.3 once I have the thing demoable).

Later I could sit down and write the emulation mode for a couple of
the STREAMS ioctls.

Cheers,
Miguel

---

From: "William J. Earl" <[email-masked]>
Date: Fri, 27 Jun 1997 09:06:08 -0700

> Later I could sit down and write the emulation mode for a couple of

     The streams ioctl's don't do much in themselves, except in the sense
that they turn on other behavior by pushing streams modules.  The latter
have more complex behavior.  You could hack I_PUSH of a given name to
enable specific behavior, and then implement that behavior.  The pushed
streams module is responsible for controlling the device (keyboard, mouse,
tablet, and so on), whereas the driver is mostly responsible for
managing the link controller or serial port to which the device is attached.