• Aucun résultat trouvé

Using Special Input Devices

Dans le document the X Window System (Page 48-55)

The X server reads an input device file, XOdevices in your system directory, to find out what input devices it should open and attach to the display.

The Default 'XOdevices' File

The default XOdevices 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 XOdevices file, or create a custom file, even though you have a custom input configuration.

• Non-clients (terminal-based programs) such as Starbase cannot receive the services of an input device if the device is specified in the device configuration file. Any device in the device configuration file is opened for use by the X server. Thus, changing the XOdevices file or creating a custom file to inform the server about a certain input device may interfere with a non-client's ability to access the device.

• 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.

Note The OSF /1 operating system uses only the XOdevices file. You can modify it as described below.

3

How the Server Chooses the Default Keyboard and Pointer

HP-UX and OSF /1 Systems

Input devices attach to HP- UX and OSF /1 cOlnputers through an interface known as the Hewlett-Packard Human Interface Link (HP-HIL). Up to seven 3 input devices can be attached to each HP-HIL. However, if the X*devices file

does not exist, or does not specify otherwise, the X server recognizes only two devices: a pointer and a keyboard (clients, however, may still recognize other input devices).

The X server uses the following order when choosing a pointer or keyboard:

1. If the X*devices file specifies an input device as the pointer or keyboard, the X server uses that device as specified.

2. If X*devices makes no specification, or there is no X*devices file, the X server takes the last mouse on the HP -HIL (the mouse farthest on the link from the computer) as the pointer and the last keyboard (the keyboard farthest on the link from the computer) as the keyboard.

3. If the X server can open no mouse, it takes the last pointer device (knob box, graphics tablet, trackball, or touchscreen) on the HP-HIL as the pointer.

4. If the X server can open no pointer device, it takes the last keyboard on the HP-HIL as the pointer as well as the keyboard.

5. If the X server can open no keyboard, it takes the last key device (buttonbox, barcode reader) on the HP-HIL as the keyboard.

6. If no pointer and keyboard can be opened, the server will not run, unless it is explicitly instructed to run without a keyboard or pointer by the X*devices file.

Domain/OS Systems

The Domain/OS borrow mode server (Xdomain) allows client programs to receive input from a supported set of input devices that are attached to the computer via a serial (RS-232) interface. The supported serial devices are listed in the sample XOdevices file in your system directory.

For example, assume an Apollo Lighted Programmable Function Keyboard is attached to the computer via the first serial port. It is an extra input device that client programs access through protocol requests defined by the X input extensions. It can be identified to the X server by adding the following lines to the X*devices file.

Begin_Device_Description Name Apollo_LPFK

Path /dev/siol Use Extension

End_Device_Description

Creating a Custom 'X*devices' File

At some point, you may want to instruct the server to open a particular device as the keyboard or pointer or have the server open another input device as an extension of the keyboard or pointer. Additional devices with keys are treated as extensions to the keyboard; additional devices that point are treated as extensions to the pointer.

To tell the server about a non-default input device configuration, you must add a device specification line to the appropriate X*devices. For example, you would use XOdevices if you used XOscreens and X2devices if you used X2screens.

Syntax for Device Type and Relative Position

The HP- UX and OSF /1 operating systems can refer to a device by its location on the HP-HIL. This syntax uses device type and relative position on the HP-HIL to specify input devices. Separate the part of your entry with tabs or spaces.

relativeposition device type use

[#

comments]

relativeposition

de vice type

Specifies the position of a device on the HP-HIL relative to other input devices of the same kind.

Specifies the type of input device.

3

3

use Specifies whether the device is the keyboard, the pointer, or has some other use.

Valid positions, types, uses, and examples are in the section "Selecting Values for 'X*devices' Files" in this chapter.

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 that type. Thus, first means the device connected closest to the computer on the HP-HIL of any device of that type.

This syntax is most useful for systems running a single X server with no other programs directly opening input devices. Here, 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 new device ahead of that existing device.

This syntax may become ambiguous when more than one X server is running on the same system or when non-client programs directly access input devices.

This is because first actually means first device of that type available to the server. Thus, a device may be physically first on the HP-HIL, but not first for the server if the device is unavailable because it is currently being used by some other program.

Syntax for Device File Name

This syntax uses the device file name to specify input devices:

/path/devicefile use

[#

comments]

/pa th/de vice file use

Specifies the path and device file to use as the input device.

Specifies whether the device is the keyboard, the pointer, or has some other use.

This syntax is unambiguous when several X servers are running on the same computer or when non-client programs directly access the input device.

The Syntax for Reconfiguring the Path to Device Files

The default path to the device files is /dev/hil, but you can specify another path if you choose. Also, if you have more than one HP-HIL, you can specify which HP-HIL the server should use.

The syntax is:

path hil_path

[#

comments]

path Specifies the path to the device files.

The X server appends numbers to the path to create the names that it attempts to open for use as input devices. For example, specifying

/tmp/foo hil_path

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

Selecting Values for 'X*devices' Files

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

3

3

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

Positions Device Type (Device Class) Uses first keyboard (keyboard) keyboard second mouse (pointer) pointer third tablet (pointer) other fourth buttonbox (keyboard)

fifth barcode (keyboard) sixth one_knob (pointer) seventh nine_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 XOdevices 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 An extension of the pointer.

first keyboard other An extension of the keyboard.

second keyboard keyboard The keyboard.

first barcode other A n extension of the keyboard.

In this example, the first tablet acts as the pointer, the second keyboard acts as the keyboard, the second tablet acts as an extension to the first, the first keyboard acts as an extension to the second, and the barcode reader acts as a second extension to the 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 should read as follows:

third keyboard other

More examples can be found in the XOdevices file in /usr/Xll/newconfig for OSF /1, etc/newconfig for HP-UX, or your system directory for Domain/OS.

3

3

Dans le document the X Window System (Page 48-55)