PREH POS Keyboards


Preh PS2 Keyboard Driver for Linux (i386)

Installation Notes - Release 0.1.6

Version January 15 2004

Overview

The Preh PS2 Linux Keyboard Driver Package installs a driver to access the Preh Keyboards via PS2 keyboard interface of an i386 computer. This driver is used by the Preh JavaPOS Driver for Linux and other Preh PS2 keyboard utilities.

The package contains all necessary sources files and installation instructions needed to compile and install the Linux driver for the Preh PS2 keyboards. In fact the driver is realized as a loadable module. The software has been released under the term of the GPL license, which has been included in this package.

Notes:
If your Preh keyboard is connected via USB to your computer, it is not necessary to install this driver. In this case no special driver is needed, nor the kernel must be modified.

To install and use this loadable PS/2 keyboard driver module a modification in the Linux kernel source and a recompile of the Linux kernel is necessary.
For details and further informations on compiling the Linux kernel we would ask you to consult your Linux distribution's documentation and also the HOWTO instructions on the internet. Especially as you could use several different distributions with small but important differences, we cannot give all the informations in this installation instructions.

Features

The Linux driver has been developed to provide simple access to the Preh PS2 keyboards and their internal modules (like MSR, keylock, PosKeys...) and can perform the following functions:

System requirements

Notes:
This PS2 keyboard driver V0.1.6 is only to be used for Linux kernel 2.2 up to 2.4.x. Beginning with kernel version 2.5 a new architecture will be built into Linux. So this driver can NOT be used for kernel 2.5.x and above.

Version History

Package Contents

prehdrv-0.1.6.tar.gz - Archive containing the following files:

Installation Procedure

To install the Preh PS2 Keyboard driver for Linux (i386) please follow this procedure precisely. Those basic steps have to be done:

  1. Prepare the Linux kernel - Details
  2. Make and install the driver - Details
  3. Additional steps - Details
A. Prepare the Linux kernel

Important Notes:
This kernel preparation only has to be done once for each kernel you are using. If you already have done this for the kernel used, you can go to step B to make and install the Preh PS2 keyboard driver for Linux.

  1. Log in as "root"

  2.  
  3. Change to the kernel source directory:
    cd /usr/src/linux
  4. Open the kernel Makefile to to modify (optional step):
  5. Extraversion=-preh
  6. Save the modified file and exit.

  7.  
  8. Modify the kernel file pc_keyb.c to prepare the kernel for Preh PS2 loadable driver module :

  9.  
    1. Open the kernel file /usr/src/linux/drivers/char/pc_keyb.c to modify:

    2. add this comment to the file header (2 lines):
    3. * kbdhook function added by Rudolf Limpert <tech-support@preh.de> 2001-11-28.
      * send_data() exported by Rudolf Limpert <tech-support@preh.de> 2001-11-28.
    4. add the following code to the #include section - as the first include (1 line):
    5. #include <linux/module.h>
    6. Search for this text (function declaration): static unsigned char handle_kbd_event(void);
    7. After those line add the following code (2 lines):
    8. /* add kbdhook function (PREH LR) 2001-11-28 */
      int (*kbdhook)(unsigned char cScancode) = NULL;
    9. Search for this text: handle_scancode
    10. Modify this source code line the following way:
    11. if (do_acknowledge(scancode))
          if((kbdhook == NULL) || !(kbdhook(scancode))) // PREH LR 2001-11-28
               handle_scancode(scancode, !(scancode & 0x80));
    12. go to the end of the file and add 3 lines:
    13. /* added by Rudolf Limpert <tech-support@preh.de> 2001-11-28 */
      EXPORT_SYMBOL(send_data);
      EXPORT_SYMBOL(kbdhook);
    14. Save the modified file and exit.

    15.  
  10. Modify the character device Makefile to support pc_keyb as a module:

  11.  
    1. Open /usr/src/linux/drivers/char/Makefile (in the directory of pc_keyb.c) to modify:
    2. Search for this text: export-objs
    3. append the following entry to the list of modules:
    4. pc_keyb.o
    5. Save the modified file and exit.

    6.  
  12. Change to the kernel source directory.
    cd /usr/src/linux

  13.  
  14. Now configure and compile the kernel and the kernel modules.

  15.  
  16. Reboot and start using the new kernel.

For details and further informations on compiling the Linux kernel we would ask you to consult your Linux distribution's documentation and also the HOWTO instructions on the internet. Especially as you could use several different distributions with small but important differences, we cannot give all the informations in this installation instructions. In the Annex you can find some example for kernel compile steps in RedHat 8.0.
 

B. Install the Preh PS/2 Keyboard driver

For details and further informations on compiling the Linux kernel we would ask you to consult your Linux distribution's documentation and also the HOWTO instructions on the internet. Especially as you could use several different distributions with small but important differences, we cannot give all the informations in this installation instructions. In the Annex you can find some example for kernel compile steps in RedHat 8.0.

Note:
If you're using the Preh PS/2 keyboard driver from within the Preh JavaPOS package for Linux, the following steps 1..5 are done automatically during the global JavaPOS "setup" script.
In addition you have to configure your system to load the Preh PS/2 loadable driver module at startup. Please see the annotations below.

  1. Unpack the driver to the directory of your choice (e.g. /home/user1):
  2. cd /home/user1
    tar -xzvf prehdrv-0.1.6.tar.gz
  3. Change to the Preh PS2 driver directory:
  4. cd prehdrv
  5. Make the driver:
  6. make
  7. Install the driver (must be done as "root"!):
  8. make install
  9. Delete all temporarily files
  10. make clean

Automatically loading the driver at boot time:
In order to load the Preh PS2 keyboard driver at boot time, you have to do some additional configuration - one of the following lines has to be added to the list of Linux system modules to be loaded at startup:

This is usually done in a startup configuration file:

Unload the Preh PS2 keyboard driver:
The driver can be unloaded by the following command:
make uninstall

Some useful Linux commands:
uname -a returns all information about the kernel version
/sbin/lsmod show loaded modules

Additonal steps - Testing

After proper installation of the Preh PS2 keyboard driver you will find a module loaded named 'preh_dev'. You can check this by via /sbin/lsmod.

Usage

The Preh PS2 keyboard driver is used by Preh software for Linux, for example the Preh JavaPOS driver for Linux.

If the Preh PS2 PS2 keyboard driver is loaded, it will provide some additonal character devices. Usually there is no need for direct access to the devices provided by the Preh PS2 keyboard driver.
Nevertheless you can directly access the keyboard's modules by the following device names with your own software:

Example:
To read MSR data, open the device '/dev/preh_msr', then read this device. If 0 is returned then no data is available, else a data string is available containing the MSR track data string. Close the opened device before exiting your tool.


Annex: Basic kernel compile steps for RedHat 8.0

The following text is based on the RedHat 8.0 documentation. For details and further informations on compiling the Linux kernel we would ask you to consult your Linux distribution's documentation and also the HOWTO instructions on the internet. Especially as you could use several different distributions with small but important differences, we cannot give all the informations in this installation instructions.

System Requirements:
--------------------
- You must have the kernel-source package installed.
- You have to be logged in as "root"

How to compile the kernel:
--------------------------

1.  Open a shell prompt and change to the directory /usr/src/linux-2.4.
    terminal: cd /usr/src/linux-2.4

    All commands from this point forward must be executed from this directory.

2.  It is important that you begin a kernel build with the source tree in a
    known condition.
    terminal: make mrproper

3.  Create a configuration file that will determine which components to include
    in your new kernel)
    terminal: make xconfig    (If you are running the X Window System)
    terminal: make config     (An interactive text program which deos not
                               require X Window System)
    terminal: make menuconfig (A text mode, menu driven program, which deos not
                               require X Window System)
    terminal: make oldconfig  (This is a non-interactive script that will set
                               up your configuration file to contain the
                               default settings)

4.  Set up all the dependencies correctly.
    terminal: make dep

5.  Prepare the source tree for the build.
    terminal: make clean

6.  Build the kernel.
    terminal: make bzImage

7.  Build any modules you configured.
    terminal: make modules

8.  Install the kernel modules (even if you did not build any).
    terminal: make modules_install

9.  Copy your new kernel and its associated files to the proper directories.
    terminal: make install

10. Make shure that you add the new kernel-image into your bootmanager (grub
    or lilo)

If you should have any problems on installing and using these drivers we of course will like to help you. Also if you have any comments or suggestions to improve our drivers and installation scripts please email to: tech-support@preh.de. Further informations and latest drivers you can find in the internet at www.preh.com