Tải bản đầy đủ - 0 (trang)
1 What Is a Kiosk, and Why Do I Want One?

1 What Is a Kiosk, and Why Do I Want One?

Tải bản đầy đủ - 0trang


For any other purpose, you will probably want to invest in specialized hardware.

Kiosk hardware is usually similar to desktop hardware but is typically more rugged

and is often mounted in a custom-built case. Obviously, the wide range of kiosk

applications means that there is also a wide range of possible kiosk hardware configurations: what is suitable for a vending machine is not suitable for an Internet café.


Although LCDs have long life, low-power consumption, and a flat surface, they usually have a soft plastic surface that is not sufficiently durable for public operation.

Therefore, many kiosks use an LCD display covered by a glass, acrylic, or polycarbonate sheet, or a traditional CRT display. Since most kiosks are used from a standing position, the display may be farther from the user than a normal desktop display.

Because some users may have visual impairment, it is best to use a large, bright, highcontrast display. The monitor should be positioned to accommodate users of many

different heights, including people in wheelchairs.

For some applications such as public information displays or video walls, you may

want to consider using a rear-projection screen and one or more LCD or DLP video



Mice are inappropriate for most kiosks, because the cord and position sensor are susceptible to damage. When the kiosk application requires pointer positioning (not

always the case), a touchscreen, touchpad, or trackball are usually used.


Some kiosk applications require a full keyboard. Keyboards are susceptible to dirt,

abraded labels, and liquids; to deal with this, some kiosk builders use cheap keyboards that can be replaced inexpensively, while others choose rugged keyboards

that resist liquids and can be easily cleaned. The keyboard can be mounted behind a

metal or acrylic panel cut to shape.

If your application does not require a full keyboard, you may be able to use a USB

numeric keypad instead; these are commonly marketed for use with laptops.

There are a number of companies that make custom keycaps for use with keyboards

or keypads; you can order standard sets of specialized symbols, blank keycaps (for

unused keys on the keyboard), or custom legends. Another possibility is mounting

heavy-duty pushbuttons adjacent to the screen and wiring those pushbuttons in parallel with the keys on a keypad or keyboard; the application can then present soft

keys—on-screen options that can be selected by pressing one of the adjacent buttons.


Chapter 15: Building a Kiosk


For applications that require only limited keyboard input, consider using a touchscreen and presenting the keyboard on-screen when necessary.

Avoid using a touchscreen for password or PIN entries, since it’s too

easy for someone else to view (or video-record) the password as it

being entered.

System Unit, Power Supply, and Ventilation

Most kiosks have an inner and outer case; the outer case is visible to the user and

takes the form of a vending machine, podium, recessed wall unit, or whatever is

suited to the application. The inner case is usually a standard or rackmount PC chassis. Because kiosks may run without inspection for weeks or months at a time, it is

wise to select a basic but rugged chassis with a good power supply and extra fans for

the system unit. Easily washed air filters which are oversized (in case they become

partially clogged) will help prolong the life of the unit, and airflow through the outer

case or cabinet of the kiosk should also be carefully planned. Ventilation louvers

should be positioned to allow good airflow while eliminating the possibility of liquids or foreign objects reaching internal components (an internal baffle can prove

helpful). A good UPS with temperature monitoring is highly recommended. Depending on the application, the external power supply cable, network cable, and (if necessary) alarm cables may need to be armored.

15.3 Configure X for a Kiosk

Configuring X for a kiosk involves removing features to limit what the user can do.

The three main configuration entries for this can be placed in the ServerFlags


Section "ServerFlags"








This prevents the user from changing the display resolution, terminating the X

server, or switching virtual terminals.

During the development and testing of the kiosk, you may want to store the kiosk X

configuration in a separate file (such as /etc/X11/xorg.kiosk.conf) so that the default X

server retains its original configuration. To start X with the kiosk configuration, supply the -config argument on the command line:

blue$ X -config /etc/X11/xorg.kiosk.conf

15.3 Configure X for a Kiosk 221


15.4 Controlling the Keyboard

Many programs have special functions that can be invoked using function keys, Altor Ctrl-key combinations, or Alt-Ctrl-Shift-modified mouse clicks. To prevent the

users from accessing these functions, you can modify the keyboard map using the X

Keyboard Extension or the xmodmap command. In most cases, the xmodmap command provides the simplest solution.

Here is an xmodmap file that will disable the Ctrl, Alt, and CapsLock keys as well as

function keys F1–F12:

! clear unneeded modifier keys

clear CTRL

clear mod1

clear mod2

clear mod3

clear mod4

clear mod5

clear lock

! clear the function keys (F1-F12)

keysym 0xffbe =

keysym 0xffbf =

keysym 0xffc0 =

keysym 0xffc1 =

keysym 0xffc2 =

keysym 0xffc3 =

keysym 0xffc4 =

keysym 0xffc5 =

keysym 0xffc6 =

keysym 0xffc7 =

keysym 0xffc8 =

keysym 0xffc9 =

To use this file, pass the filename (/usr/local/kiosk/xmodmap.txt in this case) to

xmodmap as an argument:

$ xmodmap /usr/local/kiosk/xmodmap.txt

To disable other keys, discover the keycode by running the xev utility, then add additional lines to clear out the key symbols (also called keysyms) associated with that

keycode. For example, to disable the A key, run xev and press the A key. xev will

output a message like this on stdout:

KeyPress event, serial 29, synthetic NO, window 0x3a00001,

root 0x119, subw 0x0, time 342476839, (176,174), root:(1062,320),

state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,

XLookupString gives 1 bytes: (61) "a"

XmbLookupString gives 1 bytes: (61) "a"

XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x3a00001,

root 0x119, subw 0x0, time 342476939, (176,174), root:(1062,320),


Chapter 15: Building a Kiosk


state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,

XLookupString gives 1 bytes: (61) "a"

From this output you can see that the keysym for A is 0x0061; append a line to the

xmodmap file disabling that key:

keysym 0x0061 =

15.5 Controlling the Mouse

The middle and left mouse buttons can be used to access special features of some

programs. For example, if you highlight a URI in Firefox and press the middle mouse

button on a nonlink portion of a web page, the browser will load the page at that

URI. Likewise, the right mouse button provides a pop-up menu of features that you

may not want your users to access, such as saving onto the local filesystem.

You can configure which physical mouse buttons generate which button event using

xmodmap. Normally, button 1 generates a button 1 event, button 2 generates a button 2 event, and so forth.

To change the mouse button mapping, first find out how many mouse buttons are

configured by your X server:

$ xmodmap -pp

There are 5 pointer buttons defined.















In normal operation, buttons 1–3 correspond to the left, middle, and right mouse

buttons; button 4 and 5 are scrollwheel up and down; and buttons 6 and 7 are scrollwheel left and right (for mice that have two scrollwheels, a tiltable scrollwheel, or

buttons on the side of the mouse and typically used for browser history navigation).

You can use the xmodmap pointer command to specify the button event code for

each physical button:

$ xmodmap -e "pointer = 1 10 11 4 5"

You must specify a code for each button defined on the mouse (five for this mouse).

In this example, button 1 (left button) and buttons 4 and 5 (scrollwheel up and

down) retain their original meaning, but button 2 will generate a button 10 event,

and button 3 will generate a button 11 event, both of which are ignored by most

applications. This effectively disables buttons 2 and 3.

15.5 Controlling the Mouse 223


If you are using xmodmap to change the keyboard, you can append the pointer line

to the end of the xmodmap input file:

pointer = 1 10 11 4 5

Some applications may not use the pointer mapping set by xmodmap and may continue to recognize all of the mouse buttons. In that case, you can disable all but the

first mouse button by using the Buttons option in the mouse’s InputDevice section of

the X server configuration file:

Section "InputDevice"

Identifier "Mouse0"




"Buttons" "1"


"Protocol" "IMPS/2"


"Device" "/dev/input/mice"


15.6 Starting a Single Fullscreen Application

For a kiosk that runs only one application, it makes sense to omit the window manager and just start that one application in fullscreen mode.

For many applications, this can be done with a command-line geometry specification; on a 1024 × 768 screen, this opens a full-screen xclock:

$ xclock -geometry 1024x768+0+0

It is common to use a web browser as a kiosk application. Unfortunately, most of the

current generation of web browsers ignores command-line geometry specifications,

and, although they have a fullscreen mode, this mode is not accessible from the command line. In that case, it may be necessary to use a browser extension or chrome

file; alternately, you can use JavaScript to invoke a full-screen browser window, using

a file such as this:

'-//W3C//DTD XHTML 1.0 Transitional//EN'


Kiosk Startup


Chapter 15: Building a Kiosk


This script requires that pop-up blocking be disabled in the browser.

Insert the desired URI, width, and height into the window.open line, save the file

locally (e.g., at /usr/local/kiosk/index.html) and then invoke the browser with the


$ firefox file:/usr/local/kiosk/index.html

This will start a second window on top of the first, with a 1024 × 768 geometry and

no menu bar. Since no window manager is running, the user cannot close, minimize,

or move the top window to return to the first window. To disable the status bar, navigation bar, and other user interface features on a browser such as Mozilla or Firefox, start the browser normally and deselect those features using the View menu,

then exit the browser. The browser configuration files will automatically be updated

with your preferences.

You may also be able to configure a kiosk mode for a browser using

the browser’s chrome capability, theming, or an extension.

15.7 Network Status Monitoring

Impaired or broken kiosk operation can be very frustrating to users, so automatic

monitoring (and notification) of network status may help prevent users from taking

out their frustration on your hardware.

If you’re using a browser as your kiosk application, you can use a command such as

wget to periodically poll the server and determine whether it is available. For example, if the main index page for the kiosk is http://yellow/, you could check whether

the remote server is prepared to serve that page with this command:

blue$ wget http://yellow/ --spider -t 1

The exit status will be 0 if the page is available, or 1 if it is not. The --spider argument instructs wget to check the page availability (using the HTTP HEAD command)

rather than retrieve the page (using HTTP GET), therefore reducing the amount of

data transferred over the network.

If you’re using another network-based service, you can use any other appropriate

tool (such as ping for general server connectivity, showmount -e for NFS servers, or a

netcat or a Perl script for a custom service) to test whether the service the kiosk

needs is available.

15.7 Network Status Monitoring 225


Using the wget command, we can create a script that will place a message on the

kiosk display when the remote server becomes unavailable and removes it when the

remote server comes back online:



# monitor.sh :: monitor server availability, warn user if service unavailable


# === Configuration variables

# Seconds between service availability tests


# Command to test the server availability

CHECK="wget http://yellow/ --spider -t 1"

# URIs for warning message (should be file://...) and kiosk's homepage



# === End of configuration variables


while sleep $SECONDS




case "$STATE" in


if [ "$RESULT" -ne "0" ]


firefox -remote "openurl($WARN)"





if [ "$RESULT" -eq 0 ]


firefox -remote "openurl($HOMEPAGE)"






This script uses the Firefox -remote argument to instruct a running instance of Firefox to load a local error message page ($WARN) or the kiosk’s home page on the

remote server ($HOMEPAGE) when connectivity to the remote server is lost or restored.


Chapter 15: Building a Kiosk


If you’re setting up a kiosk that uses an application other than a browser, substitute

another command to check that the remote server is accessible and replace the

browser messages with a graphic image that will fill the screen when the server is




# monitor.sh :: monitor server availability, warn user if service unavailable


# === Configuration variables

# Seconds between service availability tests


# Command to test the server availability

CHECK="ping yellow"

# File containing a full-screen warning image


# === End of configuration variables


while sleep $SECONDS




case "$STATE" in


if [ "$RESULT" -ne "0" ]


xloadimage -fullscreen $WARN





if [ "$RESULT" -eq 0 ]


killall xloadimage

# Add any application-reset commands here






15.7 Network Status Monitoring 227


If xloadimage is not included with your distribution/system, you can

obtain it from ftp://ftp.x.org/R5contrib/ or use a similar application

such as ImageMagick’s display. Note that both xloadimage and display

can be exited by pressing Q, so they may not be appropriate for desktops that are equipped with a full keyboard (but will work fine on

kiosks that have only a keypad, soft keys, or a pointer device).

15.8 Using xscreensaver to Reset a Kiosk

It’s often desirable to reset a kiosk after a period of inactivity. For example, if a kiosk

is presenting a library catalog, it should return to the library home page after a few

minutes of idle time.

Although there are many ways to detect kiosk inactivity, xscreensaver (Section 6.13)

already contains the required logic and can be easily put to use.

xscreensaver uses various graphics hacks to present screensaver effects—whether

bouncing cows, fractals, or floating text. You can add, as an additional hack, a script

that simply resets your kiosk application and deactivates the screensaver, or you can

create a script that resets your application and then executes an existing graphics


To simply reset your application and the disable the screensaver, create a script like




# kiosk-reset :: xscreensaver 'hack' to reset the kiosk

# Reset the kiosk application (Firefox browser in this case)

firefox -remote 'openURL(http://yellow/)' &

# Deactivate the screensaver to return to normal display mode

/usr/bin/xscreensaver-command -deactivate

The location of the xscreensaver command varies between operating


Name this script kiosk-reset, add execute permission, and save it in /usr/libexec/

xscreensaver (or whatever location is used by your version of xscreensaver).

Next, add a line configuring this hack into /usr/share/X11/app-defaults/XScreenSaver,

in the *programs section:


"Kiosk reset"

"Qix (solid)"


/usr/libexec/xscreensaver/kiosk-reset \n\

/usr/libexec/xscreensaver/qix -root -solid -segments 100 \n\

Chapter 15: Building a Kiosk


If you have an existing ~/.xscreensaver file, delete it so that the changes to /usr/share/

X11/app-defaults/XScreenSaver are detected.

Use the xscreensaver-demo application to configure xscreensaver, specifying the

length of idle time before the screensaver should kick in and denoting Kiosk reset as

the one and only screensaver to be used.

The script above will reset the Firefox browser to the specified page, and then

resume normal operation; however, the screen will go black briefly when

xscreensaver kicks in.

Instead of this unpolished blanking effect, it may be better to run one of the existing

hacks to present a message to users while the kiosk is idle; for example, the

GLslideshow hack can very attractively zoom around and cross-fade between product images, or fontglide can present advertising messages or announcements in an

attention-getting manner.

To invoke another hack from your script, you need to find the command line for that

hack; this can most easily be done by copying (or modifying) the command line for

the hack from /usr/share/X11/app-defaults/XScreenSaver, or configuring the hack

using the Settings feature in /usr/share/X11/app-defaults/XScreenSaver and then using

the Advanced tab to view the command line.

Replace the xscreensaver-command line in the earlier kiosk-reset script with the command line for your selected hack:



# kiosk-reset :: xscreensaver 'hack' to reset the kiosk

# Reset the kiosk application (Firefox browser in this case)

firefox -remote 'openURL(http://yellow/)' &

# Execute an existing xscreensaver hack

exec /usr/libexec/xscreensaver/phosphor -program 'echo -e "\fX Power Tools

\nby Chris Tyler\nO\'Reilly Media, 2007\n\nEverything you ever wanted\nto know

about X - and then\n some\n-Slashdot Anonymous Coward\n\nTouch the mouse to

begin..."' -root

15.9 Refining the Kiosk Appearance

The default X cursor (which is a thick X, visible whenever an application has not

taken overridden the default cursor shape) and the root window appearance (either

solid black or a stippled grayscale pattern) are ugly. You can control both using the

xsetroot command:

blue$ xsetroot -cursor_name left_ptr -solid steelblue

left_ptr is the name of the standard, northwest-pointing arrow cursor; to see other

possible cursor names, read /usr/include/X11/cursorfont.h. To see the cursor shapes,

15.9 Refining the Kiosk Appearance 229


use the X font display program, and match up the character numbers (seen at the top

of the window when you click on a shape) with the numbers in /usr/include/X11/


$ xfd -fn cursor

The -solid argument takes a color name (Section 3.13) or a color code (hex digits in

the form #rrbbgg) as its argument.

15.10 Putting It All Together: Scripting a Kiosk

The core of most kiosk systems is a script (or group of scripts) that start the X server,

kiosk applications, and any related services, and then monitor the kiosk application,

restarting the X sever or applications when necessary.

Here is an example of a basic kiosk script, combining the ideas from the other articles in this chapter:



# kiosk.sh :: start a web browser in Kiosk mode


# --- Configuration variables

export DISPLAY=":1"






XMODMAP="/usr/bin/xmodmap /usr/local/kiosk/xmodmap.txt"

SCREENSAVER="/usr/bin/xscreensaver -nosplash"

SCREENSETUP="xsetroot -cursor_name left_ptr -solid blue"


CHECK="wget $HOMEPAGE --spider -t 1"

# --- End of configuration variables

while true


# Step 1: Start the X server, allowing local connections only

$XSERVER $DISPLAY -nolisten tcp -ac -terminate &


# Step 2: Start the screensaver


# Step 3: Adjust the keymapping, pointer configuration, mouse shape,

# and root window color




Chapter 15: Building a Kiosk

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

1 What Is a Kiosk, and Why Do I Want One?

Tải bản đầy đủ ngay(0 tr)