个人工具

UbuntuHelp:AsusR1E

来自Ubuntu中文

Wikibot讨论 | 贡献2010年5月19日 (三) 21:37的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索
  1. title Making full use of the Asus R1E Tablet PC under Ubuntu 8.04/8.10

Introduction

<<Anchor(Introduction)>> This HOWTO is intended to help you fix problems related to Ubuntu and the Asus R1E Tablet PC. This HOWTO may be applicable to other models, such as the Asus R1F, where hardware specs overlap. Currently, this HOWTO only deals with the tablet function of the Asus R1E.

Disclaimer

<<Anchor(Disclaimer)>> This HOWTO is based on my experience with Ubuntu and the Asus R1E. I make no guarantees, nor take any responsibility for any consequences following the use of this HOWTO. This HOWTO is not for beginners; do NOT take any action, execute scripts or commands which you do not understand. While there is no malicious intent, incorrect usage of commands, scripts and programs can result in unintended consequences. Use at your own risk.

Enabling tablet functionality

<<Anchor(TabletInstallIntro)>> This section will guide you through updating and configuring the latest wacom development drivers, which include support for USB-based Tablet PCs. If the tablet function is already working properly, then you can skip this section. If you are having issues with the tablet, check the [[UbuntuHelp:[TabletTroubleshooting|Troubleshooting and known issues]]] section.

Installing required packages

<<Anchor(TabletInstallPackages)>> In order to install the development drivers, you need to compile them from source, and in order to do that, you need to install some development packages. The packages needed are: The linux-headers corresponding to the current kernel, build-essential, automake1.9, xserver-xorg-dev, libx11-dev, and libxi-dev. The following command will install them for you:

sudo apt-get install linux-headers-`uname -r` build-essential xserver-xorg-dev automake1.9 libx11-dev libxi-dev

Configuring, compiling and installing the drivers

<<Anchor(TabletCompileDriver)>>

Ubuntu 8.04

The following commands will download and install version 0.8.1-4 of the wacom driver. NOTE 1 - Check the linuxwacom project site for the latest version of the development drivers. NOTE 2 - The "--disable-quirk-tablet-rescale" is used as a workaround for jittery lines. The issue should be resolved in later versions and shouldn't be needed with any driver newer than 0.8.1-4.

wget http://prdownloads.sourceforge.net/linuxwacom/linuxwacom-0.8.1-4.tar.bz2
tar jxvf linuxwacom-0.8.1-4.tar.bz2
cd linuxwacom-0.8.1-4
./configure --disable-quirk-tablet-rescale --enable-wacom
make
sudo make install

It's possible that "make install" doesn't install the kernel module properly. If so, copy it manually (adjust kernel version directory as necessary):

sudo cp ./src/2.6.24/wacom.ko /lib/modules/`uname -r`/kernel/drivers/input/tablet/

Reload the driver:

sudo rmmod wacom
sudo depmod -e
sudo modprobe wacom

Note that the rmmod line removes the old wacom module if there is any. If no wacom module has been loaded prior to the installation above, then rmmod will most likely return an error saying so. Such errors can be ignored. The important thing is that there aren't any old wacom modules loaded prior to running depmod -e.

Ubuntu 8.10

Although a functional driver appears to be included with Ubuntu 8.10. I've had several issues, for example:

  • Non-functional pen
  • Non-functional pressure sensitivity and click-events
  • Unable to rotate pen coordinates due to xsetwacom not registering devices
  • Non-functional eraser

The first two issues were solved by compiling the drivers from version 0.8.1-6. The last two issues were solved by creating some entries in xorg.conf. In order to compile the drivers, do the following:

wget http://prdownloads.sourceforge.net/linuxwacom/linuxwacom-0.8.1-6.tar.bz2
tar jxvf linuxwacom-0.8.1-6.tar.bz2
cd linuxwacom-0.8.1-6
./configure --disable-quirk-tablet-rescale --enable-wacom
make
sudo make install

if "make install" doesn't install the kernel module, copy it manually:

sudo cp ./src/2.6.27/wacom.ko /lib/modules/`uname -r`/kernel/drivers/input/tablet/

Reload the driver, or reboot:

sudo rmmod wacom
sudo depmod -e
sudo modprobe wacom

Any errors from rmmod can be ignored.

Updating xorg.conf

Ubuntu 8.04

Due to automatic detection not working properly, I had to manually set the values for the wacom driver in xorg.conf. This configuration is the result of some experimentation with values reported by the various tools provided by the linuxwacom package, and are specific to the Asus R1E. Other models, with the possible exception of R1F, will most likely require other values. After reloading the wacom driver, or rebooting the system, you should have a "/dev/input/wacom" entry. If you don't, then it's either named something else, or the drivers haven't been installed properly. If it's named something else, adjust the config accordingly. Add the following under the InputDevice sections of xorg.conf:

Section "InputDevice"
        Driver          "wacom"
        Identifier      "stylus"
        Option          "Device"        "/dev/input/wacom"
        Option          "Type"          "stylus"
        Option          "USB"           "on"
        Option          "bottomy"       "17876"
        Option          "bottomx"       "28606"
        Option          "topy"          "0"
        Option          "topx"          "0"
        Option          "Button2"       "3"
EndSection

Section "InputDevice"
        Driver          "wacom"
        Identifier      "eraser"
        Option          "Device"        "/dev/input/wacom"
        Option          "Type"          "eraser"
        Option          "USB"           "on"
        Option          "bottomy"       "17876"
        Option          "bottomx"       "28606"
        Option          "topy"          "0"
        Option          "topx"          "0"
        Option          "Button2"       "3"
EndSection

You can tweak the The top*, bottom* values if you feel that the cursor isn't following the pen movements properly... In order for X to process input from the tablet, add the following to the bottom of the "ServerLayout" section:

        InputDevice     "eraser"        "SendCoreEvents"
        InputDevice     "stylus"        "SendCoreEvents"

Now, restart X or reboot the computer, and the tablet should function.

Ubuntu 8.10

Due to differences in how xorg handles configurations, some additional things are needed, while some options are no longer needed. Basically, we want to map the buttons correctly, as well as making sure that the stylus and eraser are registered correctly. The following xorg.conf file does the job:

Section "Monitor"
        Identifier "Configured Monitor"
EndSection

Section "Screen"
        Identifier "Default Screen"
        Monitor    "Configured Monitor"
        Device     "Configured Video Device"
EndSection

Section "Device"
        Identifier "Configured Video Device"
EndSection

Section "InputDevice"
        Driver          "wacom"
        Identifier      "stylus"
        Option          "Device"        "/dev/input/wacom"
        Option          "Type"          "stylus"
        Option          "USB"           "on"
        Option          "Button2"       "3"
EndSection

Section "InputDevice"
        Driver          "wacom"
        Identifier      "eraser"
        Option          "Device"        "/dev/input/wacom"
        Option          "Type"          "eraser"
        Option          "USB"           "on"
        Option          "Button2"       "3"
EndSection

Section "ServerLayout"
        Identifier        "Default Layout"
        Screen            "Default Screen"
        InputDevice       "stylus" "SendCoreEvents"
        InputDevice       "eraser" "SendCoreEvents"
EndSection

Enable "rotate screen" functionality

Ubuntu 8.04

The "Rotate Screen" button appears to generate the same event as when the screen is rotated into "tablet mode":

hotkey ATKD 0000009b xxxxxxxx

xxxxxxxx is a hexadecimal number which increases by one every time the event is triggered. This basically means that you can't separate the events in a good way. However, it is possible to check the current orientation of the screen, and thus determine what the new orientation should be when an event is triggered. The following shell script will rotate the screen orientation clockwise, or counter clockwise, depending on the current orientation. The script isn't very sophisticated, and is dependent on a specific output from xrandr, which means that it may stop working if the output changes. First, create the file asus-rotate.sh at /etc/acpi/ (/etc/acpi/asus-rotate.sh) as root (sudo), and paste the following in it:

#!/bin/bash

orientation=`xrandr --query | grep LVDS | awk '{print $4}'`

if [ "$orientation" = "(normal" ]; then
        xrandr -o right
        xsetwacom set stylus rotate CW
        xsetwacom set eraser rotate CW
else
        xrandr -o normal
        xsetwacom set stylus rotate
        xsetwacom set eraser rotate
fi

Next, make it executable:

sudo chmod +x /etc/acpi/asus-rotate.sh

Now, create an event handler by creating the file /etc/acpi/events/asus-rotate as root, and fill it with the following:

event=hotkey ATKD 0000009b
action=/etc/acpi/asus-rotate.sh

Restart ACPId

sudo /etc/init.d/acpid restart

or reboot the computer. The screen should now switch orientation when the "rotate screen" button is pressed or the screen is rotated into "tablet mode". NOTE - xrandr doesn't work well with compiz, so make sure you use Metacity or something else if you intend to rotate the screen. NOTE 2 - If the above doesn't work after a reboot, restart acpid manually ("sudo /etc/init.d/acpid restart"). It's possible that acpid has been disabled or doesn't start properly.

Ubuntu 8.10

The functionality has already been added to this release. However, it doesn't take the pen coordinates into account, so while the screen switches orientation automatically, the pen doesn't. To fix this, edit /etc/acpi/rotatescreen.sh and replace the following:

case "$ROTATION" in
        right)
        NEW_ROTATION="normal"
        ;;
        *)
        NEW_ROTATION="right"
        ;;
esac

with

case "$ROTATION" in
        right)
        NEW_ROTATION="normal"
        PEN_ROTATION=""
        ;;
        *)
        NEW_ROTATION="right"
        PEN_ROTATION="CW"
        ;;
esac

and

for x in /tmp/.X11-unix/*; do
        displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
        getXconsole;
        if [ x"$XAUTHORITY" != x"" ]; then
            export DISPLAY=":$displaynum"           
            /usr/bin/xrandr -o $NEW_ROTATION && echo $NEW_ROTATION > /var/lib/acpi-support/screen-rotation
        fi
done

with

for x in /tmp/.X11-unix/*; do
        displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
        getXconsole;
        if [ x"$XAUTHORITY" != x"" ]; then
            export DISPLAY=":$displaynum"           
            /usr/bin/xrandr -o $NEW_ROTATION && echo $NEW_ROTATION > /var/lib/acpi-support/screen-rotation
            /usr/local/bin/xsetwacom set stylus rotate $PEN_ROTATION
            /usr/local/bin/xsetwacom set eraser rotate $PEN_ROTATION
        fi
done

Troubleshooting and known issues

<<Anchor(TabletTroubleshooting)>>

Jitter

<<Anchor(TabletTroubleshootingJitter)>> If the pen is producing jagged lines (jitter), try compiling with or without the "--disable-quirk-tablet-rescale" flag. If the jitter is due to the pen being too sensitive (shaky hand), try playing with the "Suppress" option, which takes a value between 0 and 100. Keep in mind that while a high value will reduce jitter, it will also reduce accuracy. Update it directly without restarting X:

xsetwacom set stylus Suppress value
xsetwacom set eraser Suppress value

When you've found a good value, add it to each wacom InputDevice section of xorg.conf to make it permanent:

        Option          "Suppress"          "value"

Missing functionality

<<Anchor(TabletTroubleshootingFunctionality)>> The tablet ctrl-alt-del button isn't working. This appears to be because it's sending "left ctrl+left alt+KP delete", which isn't mapped to any specific action.

Applications

<<Anchor(TabletTroubleshootingApps)>> Some applications require that you set up the tablet as a valid input device, in order to use some tablet specific features, such as pressure sensitivity. For use with the GIMP, you have to enable the stylus and eraser in the GIMP: File->Preferences->Input Devices->Configure Extended Input Devices..., select stylus and eraser, and set Mode to Screen. GIMP doesn't appear to update the in-program cursor position when rotating the screen. If the tablet input is off, restart GIMP while the screen is rotated the way you want. Xournal may produce jagged lines, even if the tablet works fine in other applications. If so, try switching "Discard Core Events" on and off, when "Use XInput" is checked.

Useful applications

<<Anchor(TabletUsefulApps)>>

The GIMP

Image Manipulation Program. Supports pressure sensitivity from tablet input if enabled.

Xournal

Note taking application. Useful for taking notes or making quick notes. Uses vector graphics to store input.

CellWriter

Handwriting recognition software. Handwriting input with support for most unicode characters. Also has a normal click-based keyboard function.