HPlogo Using the X Window System > Chapter 3 Preliminary Configuration

Using Special Input Devices

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

Input devices are connected to Hewlett-Packard computers through several different hardware interfaces. Among the interfaces supported are the Hewlett-Packard Human Interface Link (HP-HIL) and the industry standard RS-232C (serial) and DIN interfaces. Some Hewlett-Packard computers do not support all of these interfaces.

How the Server Chooses the Default Keyboard and Pointer

The X server can access input devices through any of the above interfaces. Devices that use the HP-HIL interface and devices that use the DIN interface and that are compatible with the HP DIN keyboard and mouse can be used by simply plugging them into the computer. Devices that use the RS-232C interface require the installation of input device driver software before they can be used.

If no explicit input device configuration is done, the X server chooses the X keyboard device and X pointer device from the input devices that are connected to the computer (in most cases, the keyboard and a mouse). On computers that support both HP-HIL and DIN interfaces, the DIN input devices are used if both types of devices are connected.

HP-HIL input devices can plug into other HP-HIL devices, with up to seven input devices connected together. If there are no DIN input devices connected, and there are multile HP-HIL input devices, the following algorithm is used to choose an X keyboard and pointer device.

  1. If no explicit specification is made through the X devices file, the last mouse (the one farthest from the computer on the HP-HIL line) is used as the X pointer and the last keyboard is used as the X keyboard.

  2. If no mouse is available, the last pointing device (such as a dial box, graphics tablet, or trackball) is used as the X pointer. If no keyboard is available, the last key device (such as a buttonbox or barcode reader) is used as the X keyboard.

  3. If no pointing device is available, the last keyboard is used as the X pointer as well as the X keyboard.

  4. If no pointer and keyboard are available, the X server won't run unless explicitly configured to run with no input devices.

X0devices File

The X server reads an input device file, X0devices in /etc/X11, to find out what input devices it should open and attach to the display.

NOTE: The sample X0devices file is loaded into /etc/X11 unless one already exists. In that case, it is loaded into /usr/newconfig/etc/X11.

The default X0devices file contains lines of text, but does not specify any input configuration. Rather, it assumes the default input configuration of one keyboard and one pointer.

If this is your configuration, you may not want to change the contents of the file for three reasons:

  • Clients can request and receive the services of an input device regardless of whether the device is specified in a device configuration file. Thus, you need not change the X0devices file, or create a custom file, even though you have a custom input configuration.

  • Even if you have other screen configurations, you can rely on the default input device configuration without having to create an X*devices file to match every X*screens file. For example, if you had a custom X*screens file, you would not necessarily need an X*devices file.

A custom X*devices file is required only when you want to tell the X server about a custom input device configuration.

Explicitly Specifying Input Device Use

The X server can be explicitly configured to use a specific input device as the X pointer or X keyboard, or merge the data from an input device with that from the X pointer or keyboard. This configuration is done by adding information to the X*devices file. There is one syntax to use for HP-HIL devices, and another syntax for devices that require a device driver to be loaded by the X server (such as RS-232 devices).

HP-HIL devices can be specified in either of two ways:

  • Device type and position.

  • Device file name.

Explicitly specifying RS-232 Input Device Use

Some RS-232C input devices can be used with the X server. A device driver must exist for the desired serial input device, and it must reside in the /usr/lib/X11/extensions directory. Input device drivers are usually supplied by the input device vendor along with the input device. Sample input device drivers and documentation describing how to write an input device driver may be found in the /usr/contrib/X11drivers/input directory.

To use an RS-232 input device, you must modify the X*devices file to inform the X server which input device driver is to be loaded, the serial port to which it is connected, and how it is to be used. This is done by adding an entry to the X*devices file of the following form:

   Begin_Device_Description

   Name        device_driver_name

   Path        device_file_path

   Use         device_use

   End_Device_Description

where:

device_driver_name

Specifies the name of the input device driver shared library.

device_file_path

Specifies the name of the device file for the serial port being used.

device_use

Specifies the desired use of the input device, such as "keyboard", "pointer", "other", or "extension".

The following example specifies a Spatial System Spaceball ® connected to the serial port associated with device file /dev/tty00 as the X pointer:

   Begin_Device_Description

   Name        spaceball.sl

   Path        /dev/tty00

   Use         pointer

   End_Device_Description

More examples of input device specifications for RS-232 input devices are in the /usr/newconfig/etc/X11/X0devices file.

Specifying HP-HIL Input Device Use by Device Type and Position

The device can be specified using its device type and position by adding an entry to the X*devices file with the following form:

   relative_position   device_type   use   #comments

where:

relative_position

Specifies the position of the device on the HP-HIL relative to the other devices on the HP-HIL, for example, "first", "second", and so on.

device_type

Specifies the type of input device, such as "keyboard", "mouse", or "tablet".

use

Is "keyboard", "mouse", or "other".

#comments

Describes device. Comments are optional, but must start with a "#".

Valid positions, types, and uses are in “Selecting Values for `X*devices' Files”, along with examples.

Separate the parts of your entry with tabs or spaces.

The position of an input device on the HP-HIL is relative to other devices of the same type. For example if you have two keyboards, a graphics tablet, and a mouse connected, they are referred to as "first keyboard", "second keyboard", "first tablet", and "first mouse".

This syntax is useful for computers on which a single X server is running, and on which no other programs directly access input devices. With this syntax, if you add a new input device to the HP-HIL, you don't have to edit the X*devices file unless the device is of the same type as one already named in the file and you add the device ahead of the existing device.

This syntax should not be used if more than one X server will be run on the same computer, or if non-X programs will be directly accessing input devices. The X server interprets "first" to mean "first accessible", so you may not always get the first on the HP-HIL, just the first one not already in use.

Selecting Values for `X*devices' Files

X*devices files use the following special names for positions, devices, and uses:

Table 3-3 Values for `X*devices' Files.

PositionsDevice Type (Device Class)Uses
firstkeyboard (keyboard)keyboard
secondmouse (pointer)pointer
thirdtablet (pointer)other
fourthbuttonbox (keyboard) 
fifthbarcode (keyboard) ** 
sixthone_knob (pointer) 
seventhnine_knob (pointer) * 
 quadrature (pointer) 
 touchscreen (pointer) 
 trackball (pointer) *** 
 null 

 

* The nine-knob box appears to the X server as three separate input devices. Each row of knobs is a separate device with the first device being the bottom row.

** Note also that the HP barcode reader has two modes: keyboard and ASCII. The modes are set via switches on the reader. If you set the barcode reader to ASCII transmission mode, it appears to the server as a barcode reader and the device name is therefore barcode. However, if you set the barcode reader to emulate a keyboard, the barcode reader appears as a keyboard and the device name should therefore be keyboard. What distinguishes a barcode reader set to keyboard mode from a real keyboard is the relative position or the device file name, depending on which syntax you use.

*** Similar to the barcode reader, the trackball appears to the server, not as a trackball, but as a mouse. Therefore, to specify a trackball, use the mouse device name. Again, what specifies the trackball instead of the real mouse is the relative position or the device filename, depending on which syntax you use.

Examples

You can create a system on which the X server runs, but which does not have any input devices. In this case, clients could be run from a remote terminal, or from a remote host, and their output directed to the X server. To create a system with no input, include the following lines in the X0devices file:

   first   null   keyboard

   first   null   pointer

If you had a more complicated configuration, such as two graphics tablets, two keyboards, and a barcode reader, your X*devices file could look like this:

   first    tablet     pointer   The pointer.

   second   tablet     other     Merged with the pointer.

   first    keyboard   other     Merged with the keyboard.

   second   keyboard   keyboard  The keyboard.

   first    barcode    other     Merged with the keyboard.

In this example, the first tablet acts as the pointer, the second keyboard acts as the keyboard, input from the second tablet is treated as if it came from the X pointer, and input from the first keyboard and the barcode reader is treated as if it came from the X keyboard.

Note that the barcode reader is in ASCII mode in this example. If the barcode reader were in keyboard mode, the last line of the example would read as follows:

   third   keyboard    other

More examples can be found in the X0devices file in /usr/newconfig/etc/X11.

Specifying HP-HIL Input Device Use by Device File Name

The device can be specified using the name of the device to which it is attached. This can be done by adding an entry to the X*devices file with the form:

   /path/device_file     use     #comments

where:

path/device_file

Specifies the name of the device file associated with the input device.

use

is "keyboard", "pointer", or "other".

#comments

Describes the device. Comments are optional, but must be preceded with a "#".

This syntax should be used if more than one X server will be running on the computer, or if non-X programs will be accessing the input devices. It refers to a specific position on the HP-HIL.

Redefining the HP-HIL Search Path

The X*devices file can be used to redefine the path searched for HP-HIL devices. By default, the path searched is /dev/hil. The device files are named by appending the numbers "1" through "7" to the path.

The path is redefined by adding an entry to the X*devices file with the following form:

   path     hil_path        #comment

where:

path

Specifies the path to be searched for the HP-HIL input devices.

#comments

Describes the path. Comments are optional, but must be preceeded by a "#"/

The X server appends the numbers "1" through "7" to the specified path. For example, specifying:

   /tmp/foo     hil_path

results in the device names /tmp/foo1, /tmp/foo2, and so on.

© 1995 Hewlett-Packard Development Company, L.P.