Linux - Serial Keyboard Configuration

I'm looking to attach a 101-key serial keyboard (DB9 interface) to a computer running CentOS 5.3.  The keyboard requires a 1200 bps interface.  I've been able to attach the keyboard using the inputattach utility with the ps2serkbd driver, but this does not map all the keys correctly.  I've also tried connecting the keyboard using xorg.conf, but I have not found ways to specify the options I need (port and baud rate) to make this work.  I would prefer to connect the keyboard so that it can be used outside of the xserver as well, in any case.  Is there any way to map keys after connecting with inputattach or to use a different driver (none that are currently referenced work) with inputattach that will map the keys correctly from the start?  I would also appreciate any knowledge as to how the keyboard is actually dealt with in Linux.
dbCncAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

colinvannCommented:
Hi there,

There is a command called loadkeys that loads the keymap for your console.

After a bit of reading I have found that on bootup, this command is normally used in conjunction with the /etc/sysconfig/keyboard file to load the specified keymap into the kernel.

From Redhat documentation I have found the following:
---
4.1.20. /etc/sysconfig/keyboard

The /etc/sysconfig/keyboard file controls the behavior of the keyboard. The following values may be used:

    * KEYBOARDTYPE="sun|pc" where sun means a Sun keyboard is attached on /dev/kbd, or pc means a PS/2 keyboard connected to a PS/2 port.
    * KEYTABLE="<file>", where <file> is the name of a keytable file.

      For example: KEYTABLE="us". The files that can be used as keytables start in /lib/kbd/keymaps/i386 and branch into different keyboard layouts from there, all labeled <file>.kmap.gz. The first file found beneath /lib/kbd/keymaps/i386 that matches the KEYTABLE setting is used.
---

So this tells me that you can change the keyboard mapping that is used at boot-up by finding the correct mappings file under /lib/kbd/keymaps/i386

There may be a sticker on the bottom of the keyboard that tells you what keytables you need to use. Its probably not going to be called a keytable, more likely a 'type' or something similar. From this info you could probably find the correct mapping.

You can also build your own keymap files through a process of finding the code that each key on your keyboard send to the system (by using the showkey command - I have found the -a switch the most useful) and mapping it to the key that you pressed.
This is from the loadkeys man page:
---
For many countries and keyboard types appropriate keymaps are available
       already,  and  a  command like `loadkeys uk' might do what you want. On
       the other hand, it is easy to construct one's own keymap. The user  has
       to tell what symbols belong to each key. She can find the keycode for a
       key by  use  of      showkey(1),  while  the  keymap  format  is  given  in
       keymaps(5) and can also be seen from the output of dumpkeys(1).
---

To get the format of a key map file type
 man keymaps 5

Or check out any of the keymap files under /lib/kbd/keymaps/i386/

It will probably be easier to alter an existing keymap file that to create one from scratch.

Hope that helps,
Colin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Peripherals

From novice to tech pro — start learning today.