|
|
|
||
| Keyboard - Special keys | |
|
Many new keyboards these days have a number of special keys, often
referred to as the Internet keys or the Multi-Media keys. In official
USB language, these keys are called the Consumer Control keys.
By default, these keys cannot be used, as RISC OS only supports the
basic keyboard functionality. This is where !HID comes to the rescue.
Not only does it recognise each special key, it also allows you to
assign a useful function to such a key.
|
| Contents | |
| How does it work? | |
|
Well, the USBHID module, featured in this package,
extracts detailed information from the keyboard and assigns a unique
number to each key. This is not restricted to just 256
keys as on a normal keyboard. Each KeyCode produced by the USBHID
module is 32-bit wide and will generally be presented in hexadecimal
format, e.g. 220c01e5.
From this number, the software can not only read the key number, but also
the group to which a key belongs and the status of the modifier keys
(i.e. Control, Shift, Alt and the GUI keys).
Further down this chapter we'll explain how this number is built.
The USBHID module then passes the KeyCode together with the DeviceID
on to the WimpKey module
which in turn allows you to link a useful action to each key.
A more technical description can be found in Appendix 2.A.
|
| Editing the list of keys | |
A list of keys and their action can be maintained by !HID.
This is called the Keyboard window.
The Keyboard window may open automatically when the application
is started (if configured to do so).
If it doesn't open automatically, select Keyboard from the
iconbar menu. Alternatively click Select on the iconbar icon.
A window similar to the one below will open showing the current
key mappins.
In advanced mode, each line will show the following information: Line number, Device present, DeviceID, PortID, KeyCode, Last key pressed, State of the modifiers (Control, Shift, Alt and GUI), Name of the key (as per USB convention), Action assigned to the key, Name of a task linked to the key (if any), Parameter (e.g. a path name).
|
| The Keyboard Menu | |
|
A small menu reveals the various features available to this window.
It allows the contents of the Keyboard window to be saved and reloaded.
Furthermore, it allows new lines to be added and existing lines to be edited.
Several display options are available and the on-line user manual is only
a key press away.
|
| Editing a single key | |
|
Lines can be moved around by dragging them to the required
position. A line may be selected by clicking it, or by
navigating using the cursor keys (ArrowUp, ArrowDown, PageUp, PageDown, etc.).
A selected line will have a pale-blue background.
The contents of a line can be edited, by double clicking the line,
or by pressing Enter. This will bring up a window similar to the one shown here.
Although this may appear as a rather technical window, it allows you to configure each key easily. The window consists of a number of areas. The top part of the window shows advanced information about the KeyCode (i.e. the key number, group, usage and modifier state). The middle part of the window is used to show details about the Vendor and Product ID numbers as presented by the actual USB device. The lower part of the window is used to assign an action to the KeyCode. Some features of this window are described below. A more detailed description can be found in the section about the Edit key window. |
| |||
| Adding new key definitions | |
There are several ways in which a new key can be added to the list.
Each of these methods is described here. A key mapping can be added
by one of the following methods:
|
| Inserting a new line | |
|
When editing the Keyboard window, you may insert a new line
either at the top of the window, the bottom of the window
or above the currently selected line. This can be done via
the menu or through the keyboard short-cuts.
Once a new line is inserted, the window Edit key definition
will automatically open.
|
| Dragging an application into the Keyboard window | |
|
If you want to launch an application, you may also drop the required
application directly inside the Keyboard window. A new line will be
inserted at the position of the mouse pointer.
The name of the application and its path will be filled in automatically
and you may now link a KeyCode to it. The latter can be done by typing
a KeyCode (if known) directly in the KeyCode field, or by using the
Learn mode.
|
| Grabbing a new key | |
|
Once a KeyCode is already linked to a certain Action, e.g. launching an
application, it is still possible to change the KeyCode. This can be
done by changing the KeyCode directly in the multi-coloured field, or
by entering Learn mode. This can also be used when added new
lines.
As an extra aid, three menus have been added, one for Key, one for Group and one for Usage. These menus are created dynamically, directly from the official USB key definitions as maintained by the Suse Linux group. |
| |||
| Using the pop-up window | |
|
Please note that this window will only appear if it is configured
to do so from Choices.... If you've clicked the button Don't tell me again,
the window is closed and won't appear when another new special key is pressed,
until !HID is restarted. If you've pressed the button accidently, you may
turn the pop-up window back on from the menu in the Keyboard window,
by ticking the option Display -> Pop-up new keys, or from the iconbar
menu Keyboard -> Pop-up new keys.
|
| Testing a key | |
|
You may whish to test a certain key without having the actual
device that holds the key present. Hold down Control and
Double click the required line to execute the action.
Alternatively you may select Preview from the menu or
press Ctrl-P.
Alternatively you may want to monitor the KeyCodes assigned to the various key combinations of your keyboard. To do so, open the Monitor window shown here. Pressing a special key will cause this window to be updated. Please note that the window will only respond to keys or key combination generating SpecialKey events. |
| |||
| Keyboard short-cuts in the 'Keyboard' window | |
|
| Using different keyboards | |
Any USB keyboard can be used with this package, ranging form a simple (standard)
PS2-like keyboard to the more advanced multi-media and Internet keyboards
from manufacturers like Logitech and Microsoft.
Many such keyboards have special keys for CD control, web browsing, e-mail, etc.
The USB standard imposes certain rules on these keys, so that the e-mail key
on a Logitech keyboard will generate the same key code as the e-mail key on
a Microsoft keyboard.
USB describes the use for each key carefully. Most of the extra keys will be
referred to as the Consumer Control Keys. We will call these the Consumer
keys. At present we can recognise 3 different groups of Consumer keys:
|
|
||||
| Keyboard auto-repeat | |
|
Some special keys can be made to auto-repeat whenever they are held down
for a certain period, just like for the standard keys on the keyboard.
Please note that auto-repeat will only work with the Consumer Control keys.
Other special keys, such as the System Sleep key will not auto-repeat,
as this would not be convenient. Auto-repeat may be useful e.g. for media
control keys, such as Volume up and Volume down. On some keyboards
the audio volume can be adjusted with a rotary dial, but other keyboards
may have a separate Up and Down key instead.
Auto-repeat can be turned on and off in the section Keyboard settings in Choices. By default, the auto-repeat settings of the operating system will be used. These are the same settings as for the normal keyboard. Alternatively you may specify your own settings for the Consumer Control keys only. |
| The DeviceID number in more detail | |
Each USB device has some unique identification number on board which allows
the computer to recognise it. Whenever a special key is pressed, the USBHID
module not only broadcasts the 32-bit KeyCode, but also the 32-bit DeviceID.
This anables applications to discriminate one keyboard from another. E.g. the
e-mail button on each keyboard could be given a different function.
The DeviceID is a 32-bit number, presented in hexadecimal format, and consists
of two parts: the VendorID and the ProductID. The VendorID is unique for
each manufacturer and the ProductID is unique for each product from that
manufacturer. The first 4 digits of the hexadecimal number represent the
Vendor ID. The remaining 4 digits are the Product ID. This is clearly
demonstrated in the centre part of the Edit key window.
|
| Using the PortID | |
|
When using multiple devices with the same DeviceID (e.g. two identical
keyboards) you may want to assign different Actions the the keys of each
keyboard. This can be done by using the PortID in the the centre part
of the Edit key window.
There are two ways to identify the device:
A. By using the Absolute port number An 8-digit hexadecimal number is assigned by USBHID to each device, representing its physical position in the USB topology. This is called the Hardware port number.
B. By using the Relative port number As an alternative to the above, you may also use the method by which each device is given a relative port number. When using two or more identical devices, the one on the lowest physical port will be given relative port number 0. The next one will be 1 and so on. This number is called the Index.
|
| Related subjects | |
|
|
|
© Copyright Paul Reuvers
X-Ample Technology bv
| |