KB and KBSEND                                   John Elliott, 18 August 2009
============================================================================

  KB and KBSEND are ad-hoc utilities I developed to test various keyboards
and report on the scancodes they return.

  These programs should be run under DOS (booted from a floppy if necessary),
not in any form of DOS box under Windows or Linux.

Reporting scancodes
===================

  To report scancodes, use KB:

  KB {scancode-set} {options}

  The scancode set is 1-3. If not provided, it defaults to 3.

  Additional options are:

     X: Turn translation on. The keyboard controller normally translates
       scancodes it receives, but KB disables this functionality by default.

     V: Verbose. All command and result bytes are displayed.

  When the program is run, it will query the keyboard for its identity (if
supported) and current scancode set (if supported). Then it will change to the 
requested scancode set and wait for keypresses. It will terminate when no keys 
are pressed for ten seconds.

  For example:

     KB 2

  will request scancode set 2 with no translation

     KB 3 X

  will request scancode set 3 with translation

     KB 1 V

  will request set 1, with no translation, and verbose output.

Testing LEDs
============

  If the L option is present, KB will display a test pattern on the keyboard
LEDs:

     KB L

   Again, if the V option is present, command and result bytes will be
displayed.

Sending commands to the keyboard
================================

  KBSEND is used to send arbitrary commands to the keyboard.

  WARNING: Some commands (in particular, F5) will cause the keyboard to stop 
responding, and you will have to reboot.

  The syntax is:

  KBSEND hex hex hex ...

  For example,

     KBSEND ED 07

  should light all the LEDs. The output shown will be:

Sending command: ed 07
Sending  ed
Received fa
Sending  07
Received fa
Any further output:

  'Any further output' displays bytes received from the keyboard in the
half-second after the command was sent. For example, most keyboards take
some time to reset, so the result of the test may appear there.

     KBSEND FF

Sending command: ff
Sending  ff
Received fa
Any further output: aa

Source
======
  The source code is designed to compile with Pacific C, in the large model.

Bugs
====
  The timeout when receiving bytes from the keyboard is arbitrary and depends
on CPU speed.

   KBSEND cannot send multibyte commands to the IBM Rapid Access Keyboard II,
because it doesn't send them quickly enough; the keyboard times out and resets
itself.

Copying
=======

Copyright (c) 2009 John Elliott <jce@seasip.demon.co.uk>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
