Pointer and Keyboard Configuration


Fedora has tools available to configure and customize your input devices. If you need to change your keyboard's language, or alter settings for your mouse you will need to know about them. These tools include

  • gnome-mouse-propertiesA graphical mouse configuration tool for the Fedora desktop

  • system-config-keyboardA graphical keyboard configuration tool for the Fedora desktop

The following sections explain how to use these tools to configure keyboards and pointing devices in Fedora.

Configuring Keyboards with Linux

Note

Linux supports many different types of keyboards. Until the last few years, most keyboards used the PS/2 protocol (originally developed by IBM) attached to a PC with a six-pin mini-connector. Today, however, nearly all computers use universal serial bus (USB) connectors for user input devices. Although many of today's PCs (and notebooks) continue to provide PS/2 ports, most manufacturers are now introducing legacy-free computers without direct PS/2 support.


You can make a number of keyboard configuration choices in Fedora. You can choose a keyboard language that supplies the keyboard letters, diacritical marks, and layout appropriate for the language you will be typing in during your console or graphical sessions. Other configuration options include changing the keyboard's translation table to remap the order of keys on your keyboard, swapping specific keys (such as Caps Lock and Ctrl), or changing the delay period between the press of the key and the appearance of the character onscreen. (This configuration can help you synch the character entry to your typing speed.)

You can make keyboard configuration changes through text-based (console) keyboard commands or by using the graphical user interface.

If you do not use X, use Fedora's system-config-keyboard command to change your keyboard type and language. This command can be used without an active X session (or if you are using X, from inside a terminal window) like this:

# system-config-keyboard


After you press Enter, you will see the Configure Keyboard dialog, as shown in Figure 4.1.

Figure 4.1. The system-config-keyboard command can be used to choose a keyboard map (language) for Fedora.


This dialog enables you to choose a new keyboard type.

Scroll through the list to highlight a desired keyboard type, and then use the Tab key to highlight the OK button and press Enter. The listings represent entries under the /lib/kbd/keymaps/i386 directory, which are used to associate your keyboard's layout and keys with a language. The keyboard configuration is stored in the file /etc/sysconfig/keyboard, which might look like this:

KEYBOARDTYPE="pc" KEYTABLE="us"


If you are using the Fedora desktop during an X session, you can use the graphical interface to select a keyboard language. To open the keyboard configuration dialog box, click the desktop panel System Settings Keyboard menu item, or use the system-config-keyboard client at the command line of a terminal window, like so:

$ system-config-keyboard


After you press Enter, you will be prompted for the root password. Enter the password and click OK. You will then see the Keyboard dialog box shown in Figure 4.2. This dialog box is similar to that displayed by system-config-keyboard.

Figure 4.2. The system-config-keyboard client is used during an X session to choose the language you will be keyboarding in during your desktop sessions.


Scroll through the list of languages, highlight a language, and then click OK to save your change. Table 4.1 lists text-based and graphical commands you can use to manipulate or get information about your keyboard.

Table 4.1. Linux and X Keyboard-Related Commands

dumpkeys

Displays keyboard translation tables

kbd_mode

Modifies current keyboard mode

kbdrate

Changes keypress delay, repeats

loadkeys

Loads new keyboard table

showkey

Prints character, keycode, and other keystroke information

setleds

Displays, changes keyboard light-emitting diode (LED) settings

xkbcomp

Shows, sets keyboard character translations for X

xkbprint

Displays or saves X keyboard mappings

xset

Modifies keyboard settings for X

xmodmap

Changes key mappings for X


The X11 keyboard and other clients can be used to input a keyboard description into a running X server, show current keyboard character translations, change a keyboard map, and set other keyboard (and pointer) preferences. X11 settings are generally contained in a system's xorg.conf file (see Chapter 6, "The X Window System," for more information).

As a trivial example, the following short shell script (see Chapter 15 for more information on how to use shell scripts) can be used to blink the keyboard Caps Lock LED on and off each second (press Ctrl+C to stop the blinking) while using the console:

#!/bin/sh while :   do    setleds -L +caps ; sleep 1 ; setleds -L -caps ; sleep 1; done


Perhaps a more useful example is to switch the Caps Lock and Ctrl keys on your keyboard. Some users might find typing sessions a bit more comfortable if the locations are swapped. There are a number of ways to swap the keys. For your console-based sessions, use the loadkeys command to read in a file containing reverse key values for the keys:

keymaps 0-15 keycode 58 = Control keycode 29 = Caps_Lock


You can then immediately swap the keys by using loadkeys to read in the file (perhaps named swapkeys) like so:

# loadkeys <swapkeys


The same swapping can be used for your Fedora desktop by editing your /etc/X11/xorg.conf file's keyboard InputDevice section and adding

Option     "XkbOptions"   "ctrl:swapcaps"


Yet another way to get the same results is to create a file named .Xmodmap in your home directory that contains

remove Lock = Caps_Lock remove Control = Control_L keysym Control_L = Caps_Lock keysym Caps_Lock = Control_L add Lock = Caps_Lock add Control = Control_L


Or you can save the settings in a file (such as mykeyswap) and use the xmodmap client to directly read in the new keys like so:

$ xmodmap mykeyswap


Note that this will only work if you use the xterm or rxvt terminal clients. See Chapter 6 for more information about the Fedora desktop.

Tip

The system-config-keyboard command will present its graphical interface if launched from the command line during a graphical desktop session (that is, while using the X Window System). However, you can force system-config-keyboard to use its text-based console interface by including the --text option on the command line like this:

# system-config-keyboard --text


This technique can also be used with the sndconfig command discussed later in this chapter. Using a console-based interface with one of these commands can be handy if you do not want the client to launch over a network after you have connected from a remote host.


Configuring Pointing Devices in Fedora

This section introduces pointer device configuration for Fedora Core. You will see how to use the graphical gnome-mouse-properties client for configuring a mouse for your desktop.

Note

Many pointing devices, such as the IBM Trackpoint (found in several versions of IBM non-notebook keyboards) work fine with Fedora. However, if you use a trackball, joystick, or other devices such as the Synaptics TouchPad, the Cirque GlidePoint, and wireless or infrared (IrDA) pointers, you might need to experiment with different configuration settings or use a driver provided (hopefully) by the manufacturer.

Linux PC tablet users will have good reason to rejoice with the release of the Linux 2.6 series kernel. The new kernel will feature built-in touchscreen support and other improvements to make life easier when using Linux on a tablet PC. Compaq Tablet TC1000 users can browse to http://linux-tablet-pc.dhs.org/ for links to various drivers and supporting software. Some manufacturers provide direct links to Linux drivers or support reports. For example, Toshiba 3501 Tablet PC users can browse to http://linux.toshiba-dme.co.jp/linux/eng/pc/ptg3501_report.htm for additional information.

Starting from Fedora 5, there is no longer support for serial-based mice as they are considered to be obsolete. Most modern mice use the USB interface, although PS/2 mice are still quite common. Also, readers of previous editions might notice that mouseconfig and system-config-mouse have been totally removed from Fedora. This is because the hardware support is now so effective that these packages have been made redundant!

Fedora does include some support for joystick use through the jsattach, jscal, and jstest commands (installed from the joystick*.rpm package). You can use these commands to support, calibrate, and test certain joystick makes and models.


The Fedora installer will recognize and correctly configure a computer's pointing device, but if you install a new pointing device, you will need to reconfigure the system for its use.

When using a PS/2 pointing device, a file named /dev/mouse will point to /dev/psaux; when using a USB pointing device, /dev/mouse will point to /dev/input/mice. The /dev/mouse file is a symbolic link, used for the convenience of many Linux applications. It is much more convenient for a program to look for /dev/mouse instead of /dev/input/mice or /dev/psaux.

USB service (most likely initially configured by the installer) is started during the boot process by an entry in the system's module configuration file, /etc/modprobe.conf:

alias usb-controller usb-uhci


In this example, the PC platform uses a universal host controller interface (UHCI), and the uhci.o kernel module will be loaded from the /lib/modules/2.6-X/kernel/drivers/usb directory when Linux boots. Another USB controller commonly in use is the open host controller interface (OHCI), requiring loading of the ohci.o module to enable USB service.

If your pointing device does not work, you can use the dmesg command to see if Linux has recognized the device during the boot process. This can provide some diagnostic information because Linux or the driver (perhaps a module) usually outputs diagnostic information:

... usb-uhci.c: USB UHCI at I/O 0xd800, IRQ 15 usb-uhci.c: Detected 2 ports usb.c: new USB bus registered, assigned bus number 2 hub.c: USB hub found hub.c: 2 ports detected usb-uhci.c: v1.275:USB Universal Host Controller Interface driver hub.c: USB new device connect on bus1/1, assigned device number 2 usb.c: USB device 2 (vend/prod 0x1241/0x1122) is not claimed by any \ active driver. usb.c: registered new driver hiddev usb.c: registered new driver hid input0: USB HID v1.00 Mouse [1241:1122] on usb1:2.0 hid-core.c: v1.8 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz> hid-core.c: USB HID support drivers mice: PS/2 mouse device common for all mice ...


In this example (your output might look different), the kernel has recognized a generic USB mouse. USB support is initially enabled by the usbcore.o kernel module. In this example, the USB controller interface is initialized and configured by loading the usbuhci.o kernel module, and then additional modules, such as input.o and hid.o, will be loaded to support a mouse (and/or keyboard) USB device.

You can see what modules have been loaded by using the output of the lsmod command. Note that you might see different memory size values, depending on your computer and module version:

# lsmod ... mousedev        4288  1 hid          18720  0 (unused) input          3744  0 [mousedev hid] usb-uhci        21636  0 (unused) usbcore        59072  1 [hid usb-uhci]


As you can see, USB device support, especially for pointing devices, involves proper loading of a chain of modules rather than a single driver.

Tip

On booting or connection, every USB device reports a pair of numbers representing a vendor and associated product (model). Problems can arise if the vendor and product ID are not recognized by a pertinent Linux kernel module. If a device is not properly recognized, it might not work with Linux. It is sometimes possible to rebuild a USB kernel module and include your device's vendor and product ID in order to get the device to work. For example, if you have installed the Linux kernel source, the file named scanner.h under the /usr/src/linux-2.6/drivers/usb directory contains many popular USB scanner vendor and product IDs that are used by the kernel's scanner.o kernel module. See Chapter 39 for more information about rebuilding the Linux kernel and kernel modules. For a list of the latest USB devices supported with Linux, browse to http://www.qbik.ch/usb/devices/.


After Linux has recognized your hardware, you can use the gnome-mouse-properties command to configure a new pointer. Start the command like this:

$ gnome-mouse-properties


Tip

If Linux recognizes a two-button pointer, the three-button emulation is automatically selected. (A simultaneous depress of both buttons sends a middle-button click.)

Using a three-button mouse is essential for copy and paste operationseither at a text console or during X sessions. The left mouse button is most often used for clicking and selection, whereas the right mouse button is generally used for configuration or property display. The middle button is used for scrolling and pasting text or graphics.


After you press Enter, the Mouse Preferences dialog appears, as shown in Figure 4.3.

Figure 4.3. The gnome-mouse-properties command can be used to configure a new pointing device.


The configuration entry contained in the /etc/X11/xorg.conf and used by X.org for the Fedora desktop, looks like

Section "InputDevice"     Identifier   "Mouse0"     # Modified by mouseconfig     Driver     "mouse"     Option     "Device"        "/dev/mouse"     Option     "Protocol"       "PS/2"     Option     "Emulate3Buttons"    "yes"     #Option     "ZAxisMapping"     "4 5" EndSection


This entry enables the use of a USB pointing device during X sessions. See Chapter 6 to learn about X.

The ZAxisMapping entry (disabled in the preceding example) enables scrolling with a mouse that has a combination scroll-wheel and middle button. Many other types of input devices can be used with Linux and X.org. For information about using a mouse with X.org, read the file README.mouse under the /usr/X11R6/lib/X11/doc directory.

Mouse support for copy and paste operations during a Linux console session is provided by the General Purpose Mouse driver (gpm). gpm is a daemon, or software that runs in memory as a background process while you use Linux. If you make the appropriate configuration choices, the /etc/rc.d/init.d/gpm script starts the gpm daemon when Fedora boots. If you are not using X, you can configure Linux to start gpm when booting by using the ntsysv command from the console. Run the ntsysv command as root, like this:

# ntsysv


After you press Enter, you will see the Services dialog, as shown in Figure 4.4.

Figure 4.4. Use the ntsysv command to produce the Services dialog, in which you can select the gpm driver to start at boot time.


Scroll through the list of services using the Up or Down cursor keys to highlight the gpm service. Press the spacebar to toggle use of the service on (an asterisk appears between the brackets) or off (no asterisk). Press the Tab key to highlight the OK button and then press Enter to save your changes. The changes will take effect the next time you boot Fedora.

Note

You can use the chkconfig command or the system-config-services client to configure Linux to run the gpm daemon when you are working in console mode (but not during X Window System sessions). Use the chkconfig command like this:

# chkconfig --level 3 gpm on # chkconfig --level 5 gpm off


See Chapter 15 to see how to configure when services run under Fedora.




Red Hat Fedora 5 Unleashed
Red Hat Fedora 5 Unleashed
ISBN: 067232847X
EAN: 2147483647
Year: 2004
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net