Installing X

Setup tslib

To use the touchscreen, you need to setup tslib first. First edit $ROOT/etc/tslib.conf and uncomment the line module_raw input. If you use the touchscreen the first time, you want to calibrate the screen. But before, specify your device using

ts_finddev /dev/input/event1 30

and touch the screen within 30 seconds. To calibrate the screen use

export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
ts_calibrate

Cross-compile preparations

For cross-compiling X you need first to install all proto headers on the target. Do this by executing

emerge-armv4tl-softfloat-linux-gnueabi x11-proto-meta

This is only needed on the cross-compile build root. You won't need this package anymore after building X. Now you need to emerge the X server by doing

emerge-armv4tl-softfloat-linux-gnueabi xorg-server

Make sure you have the tslib USE-flag enabled. If you want to use the still experimental glamo driver use

emerge-armv4tl-softfloat-linux-gnueabi xf86-video-glamo

Setup the X environment

In the next sections two working configuration files for the fbdev and glamo display driver are presented. In a third section, a setup using HAL to determine the input devices is shown.

Xorg setup with fbdev

A working configuration file using the framebuffer as a display driver looks as follows:

Section "Files"
        FontPath        "/usr/share/fonts/local"
        FontPath        "/usr/share/fonts/misc"
        FontPath        "/usr/share/fonts/Type1"
        FontPath        "/usr/share/fonts/TTF"
        FontPath        "/usr/share/fonts/75dpi"
        FontPath        "/usr/share/fonts/100dpi"
EndSection

Section "Monitor"
        Identifier      "Neo Display"
EndSection

Section "Device"
        Identifier      "SMedia Glamo"
        Driver          "fbdev"
EndSection

Section "Screen"
        Identifier      "Neo Screen"
        Device          "SMedia Glamo"
        Monitor         "Neo Display"
        DefaultDepth    16

        SubSection "Display"
                Depth   16
                Modes   "480x640"
        EndSubSection

EndSection

Section "InputDevice"
         Identifier      "Touchscreen"
         Driver          "tslib"
         Option          "CorePointer"           "true"
         Option          "SendCoreEvents"        "true"
         Option          "Device"                "/dev/input/event1"
         Option          "Protocol"              "Auto"
         Option          "Width"                 "480"
         Option          "Height"                "640"
         Option          "EmulateRightButton"    "1"
EndSection

Section "ServerLayout"
        Identifier      "Base layout"
        Screen          "Neo Screen"
        InputDevice     "Touchscreen"
EndSection

Section "ServerFlags"
        Option  "Xinerama" "Off"
EndSection

Section "Extensions"
        Option  "Composite" "Enable"
EndSection

Section "Module"
        Disable "dri"
        Disable "freetype"
        Disable "glx"
EndSection

Xorg setup with glamo

To use the xorg-glamo display driver make sure the driver is emerged

emerge-armv4tl-softfloat-linux-gnueabi xf86-video-glamo

After doing so, change the Device section of the config file above to

Section "Device"
        Identifier      "SMedia Glamo"
#        Driver          "fbdev"
        Driver          "glamo"
EndSection

Xorg setup with HAL

If you want to use HAL to handle input devices you need to setup HAL first. Make sure you have HAL installed. Now, we need to instruct HAL that our touchscreen wants to use xf86-input-tslib and NOT xf86-input-evdev (which is default). That is done by performing the following steps:

  1. Copy the policy file
    cp /usr/share/hal/fdi/policy/10osvendor/10-x11-input.fdi /etc/hal/fdi/policy/
    
  2. Change the touchpad driver. Please edit 10-x11-input.fdi file and change evdev for tslib (touchpad section should look as follow)
        <match key="info.capabilities" contains="input.touchpad">
          <merge key="input.x11_driver" type="string">mouse</merge>
          <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
                 string="Linux">
            <merge key="input.x11_driver" type="string">tslib</merge>
          </match>
        </match>
    
  3. Check /etc/ts.conf file and make sure module_raw input is NOT commented out.
  4. Reload the HAL configuration
    /etc/init.d/hald restart
    

After setting up HAL, we need to tell X that the input devices are handled by HAL now. For doing so, remove the InputDevice? information from your xorg.conf file. It should look like

#Section "InputDevice"
#         Identifier      "Touchscreen"
#         Driver          "tslib"
#         Option          "CorePointer"           "true"
#         Option          "SendCoreEvents"        "true"
#         Option          "Device"                "/dev/input/event1"
#         Option          "Protocol"              "Auto"
#         Option          "Width"                 "480"
#         Option          "Height"                "640"
#         Option          "EmulateRightButton"    "1"
#EndSection

Section "ServerLayout"
        Identifier      "Base layout"
        Screen          "Neo Screen"
#        InputDevice     "Touchscreen"
EndSection

Useful Tweaks

Tslib, right click emulation and HAL

If you use tslib with HAL, you might want to use right click emulation. To inject this option to tslib, add this key to its section in 10-x11-input.fdi:

<merge key="input.x11_options.EmulateRightButton" type="string">1</merge>

TROUBLESHOOTING

Q: Once I run startx, X server starts and dies few seconds later. Why is that?
A: You probably don't have anything in your .xinitrc file. Please add something like enlightenment_start to instruct X server to run this application after successful start.

Q: I've installed E, but all fonts on the screen are so small, I can't even read them.
A: You might want to install some additional fonts. Please check media-fonts for list of available fonts.

Q: My touchscreen act strangely. All clicks are like 90 degrees rotated.
A: Please make sure you calibrated your touchscreen by running ts_calibrate. Also please make sure you DO NOT touch stuff in /sys/class/i2c-adapter/i2c-0/0-0073/s3c2440-ts/calibration

Q: Xorg complains that "ts_open failed (device=(null))" even though Option "TslibDevice?" is set
A: Some HAL patch renamed "TslibDevice?" to just "Device" recently. Just change the line in xorg.conf contrary to what man tslib says (for example Option "Device" "/dev/input/event1") and you're good to go.