X41T问题贴(20090611update)

笔记本/便携移动设备,手机平板等软硬件
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

X41T问题贴(20090611update)

#1

帖子 allarem » 2009-01-30 11:13

9.04不要使用以下教程
后果很严重!原生的就已经很好很强大了,X41T完全可以正常使用


论坛很多人都说他们驱动不起来自己的wacom手写笔,包括我自己哈~ :em04
Google一会就发现了外国的伙计们早解决了这个问题,本文其实就算是照抄了以下文章。
http://ubuntuforums.org/showthread.php?t=967147
https://help.ubuntu.com/community/Wacom
http://linuxwacom.sourceforge.net/index ... /srvlayout
可能有BUG和不足,大家来找找……找到了跟帖哈,我会及时更新的。我的email:mengzhuo1203#gmail.com

本文仅在IBM-X41T下测试成功,但是也很有可能适用其他Wacom的手写笔
1.安装Wacom的XX(我菜,不知道是啥)

代码: 全选

sudo apt-get install xserver-xorg-input-wacom wacom-tools 
2.重启后?(当时关键更新完了……需要重启)

代码: 全选

xxd /dev/ttyS0
回车后,用笔在屏幕(或者别的)上画画,看看终端有没有反应(输出一些数据),可能里面的S0是可以改成别的数字只要你有很多手写板……

其他的USB驱动的手写笔可能要

代码: 全选

xxd /dev/input/event0
或者

代码: 全选

xxd /dev/input/wacom/
这一步其实就是测试有没有安装成功,可能命令相当于将内存里的数据展示出来。

3.修改/etc/X11/xorg.conf(在WIKI上是方案2,好吧,其实我两个都两个方案都用了)
配置文件后添加下面的东西(这是我的xorg.conf的一部分,X41T用户可以直接拿去不用改了)

代码: 全选

Section "InputDevice"
  Driver        "wacom"
  Identifier    "stylus"
#  Option        "Device"        "/dev/input/wacom" # USB ONLY?
  Option        "Device"        "/dev/ttyS0"      # SERIAL ONLY
  Option        "Type"          "stylus"
  Option        "ForceDevice"   "ISDV4"           # Tablet PC ONLY
#  Option        "USB"           "on"               # USB ONLY
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "eraser"
#  Option        "Device"        "/dev/input/wacom" # USB ONLY?
  Option        "Device"        "/dev/ttyS0"      # SERIAL ONLY
  Option        "Type"          "eraser"
  Option        "ForceDevice"   "ISDV4"           # Tablet PC ONLY
#  Option        "USB"           "on"               # USB ONLY
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "cursor"
#  Option        "Device"        "/dev/input/wacom" # USB ONLY?
  Option        "Device"        "/dev/ttyS0"      # SERIAL ONLY
  Option        "Type"          "cursor"
  Option        "ForceDevice"   "ISDV4"           # Tablet PC ONLY
#  Option        "USB"           "on"               # USB ONLY
EndSection


Section "ServerLayout"
  Identifier    "Default Layout"
  Screen        "Default Screen"
  InputDevice   "stylus"  "SendCoreEvents"
  InputDevice   "eraser"  "SendCoreEvents"
  InputDevice   "cursor"  "SendCoreEvents" # For non-LCD tablets only
#  InputDevice   "pad"                      # For Intuos3/CintiqV5/Graphire4/Bamboo tablets
# InputDevice   "touch"   "SendCoreEvents" # Only a few TabletPCs support this type
EndSection
保存,退出。
里面前面有 # 的那行就是被注释掉的(即不起作用), # SERIAL ONLY指串口专用,USB only指USB接口的专用。
如果是USB的Wacom

代码: 全选

Option        "Device"        "/dev/input/wacom" # USB ONLY?
里面把第2步中有输出数据的设备改进去

4.设置一个奇怪的文件(人菜……不知道这是什么,我觉得不必要,但是还是贴出来,这个是WIKI中的方案1)

代码: 全选

gksudo gedit /etc/hal/fdi/policy/custom_wacom.fdi
把下面的内容贴进文件里

代码: 全选

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">

  <device>
    <match key="info.capabilities" contains="input">
      <match key="info.product" contains="Wacom">
        <merge key="input.x11_driver" type="string">wacom</merge>
        <merge key="input.x11_options.Type" type="string">stylus</merge>
      </match>
      <match key="info.product" contains="WALTOP">
        <merge key="input.x11_driver" type="string">wacom</merge>
        <merge key="input.x11_options.Type" type="string">stylus</merge>
      </match>
    </match>
    <!-- N-Trig Duosense Electromagnetic Digitizer -->
    <match key="info.product" contains="HID 1b96:0001">
      <match key="info.parent" contains="if0">
       <merge key="input.x11_driver" type="string">wacom</merge>
       <merge key="input.x11_options.Type" type="string">stylus</merge>
      </match>
    </match>
  </device>

</deviceinfo>
5.
hotcat 写了:重新启动X
原理就是先干掉X,再重新运行一次
(其实干掉X之后它自动会重启,类似于Windows下面的Explorer)

先用top命令查看X的Pid,
然后再用kill <Pid>干掉X,
这时就会黑屏,然后X就重启了

万一出问题就Ctrl+Alt+F1切到终端,手动启动X:startx
可选:
6.X41T旋转屏幕的脚本

代码: 全选

  
#!/bin/sh

output="(normal left inverted right)" #LVDS
 # if [ "$XROT_OUTPUT" ]
 # then     
 #         output=$XROT_OUTPUT;
 # fi
devices="stylus cursor"

geomnbr=0
xrandr=normal
wacom=normal
if [ "$1" == "-" ] || [ "$1" == "+" ] || ! [ "$1" ];
then    
        operator="$1";
        [ "$1" ] || operator='+';
        case `xrandr --verbose | grep "$output" | sed "s/^[^ ]* [^ ]* [^ ]* ([^(]*) \([a-z]*\).*/\1/"` in
                normal)         geom=0;;
                left)          geom=1;;
                inverted)       geom=2;;
                right)          geom=3;;
        esac
        let geom=${geom}${operator}1+4
        let geom=${geom}%4	
else    
        geom="$1"
fi
case $geom in
        1)      wacom=2; xrandr=left ;;
        2)      wacom=3; xrandr=inverted ;;
        3)      wacom=1; xrandr=right ;;
        *)      wacom=0; xrandr=normal ;;
esac

echo "xrandr to $xrandr, xsetwacom to $wacom" >&2

if xrandr -o "$xrandr"; then
        for d in $devices
        do      
                xsetwacom set "stylus" Rotate "$wacom"
        done
fi

#workaround for linuxwacom bug
if [ "`xsetwacom get stylus Mode`" == '1' ]; then
        for d in $devices
        do      
                xsetwacom set stylus CoreEvent "off"
                xsetwacom set stylus Mode "off"
        done
        { sleep 1;
        for d in $devices
        do      
                xsetwacom set stylus Mode "on"
                xsetwacom set stylus CoreEvent "on"
        done; } &
fi


用的时候就加个参数(0,1,2,3)在后面,原文在http://www.thinkwiki.org/wiki/Wacom_Serial_Tablet_PC_Stylus


临时解决转了再按键又转不回来的问题,当然这个脚本很笨也是直接修改原来的,希望大侠们能帮帮忙

代码: 全选

#!/bin/sh
#
# This script rotates the display in TabletPCs when screen is changed from
# laptop to tablet mode, or when rotation button is pressed

touch /tmp/screen-rotation
ROTATION=`cat /tmp/screen-rotation`
case "$ROTATION" in
   right)
   NEW_ROTATION="normal"
   xsetwacom set "stylus" Rotate 0
   ;;
   *)
   NEW_ROTATION="right"
   xsetwacom set "stylus" Rotate 1
   ;;
esac
/usr/bin/xrandr -o $NEW_ROTATION && echo $NEW_ROTATION > /tmp/screen-rotation
——————————————
pheyx 写了:windows日记本可以用xournal来代替
源里有

——————————————
关于那些该死的tablet按键
9.04以后不知道为什么以前的所有设置都不正确了
在网上搜到一篇要翻墙才看得到的文章(省略废话2W字)
只针对x41t,其他用户不要随便玩……
直接在开机的脚本里启动一些setkeycodes
比如修改/etc/rc.local
添加

代码: 全选

# PageDown, PageUp, Enter, Escape 
setkeycodes 6e 109
setkeycodes 6d 104 
setkeycodes 69 28
setkeycodes 6b 1
# Tablet Menu Key
setkeycodes 68 130 
# Tablet Rotate 
setkeycodes 6c 131 
# Tablet Ctrl-Alt-Del Key 
setkeycodes 67 132
就可以了,下边贴出来那篇文章,省得大家翻墙
http://wordsarelies.blogspot.com/2009/0 ... d-x41.html
I recently bought a Thinkpad X41 tablet cheap off eBay. And, because it's the kind of thing I do, I promptly set to work installing the latest release of Ubuntu (9.04, Jaunty Jackalope) on it. Since the X41t doesn't have an optical drive, I installed via LiveUSB. The USB can easily be created from an existing Ubuntu install or LiveCD using the included USB Startup Disk Creator (System -> Administration -> USB Startup Disk Creator), or from Windows via instructions like these or these.

I won't trouble you with installation instructions, because the installer is well set up, the Ubuntu Installation Guide is very good, and I didn't have to do anything special to get it working. Installation took about 15 minutes (seriously: very fast), and afterwards it took about 30 seconds to go from GRUB to the login screen.

I'm happy to say that basically everything worked out of the box - including the wireless card and basic tablet functionality. For handwriting recognition, I used Synaptic to install the equivalent of Windows XP's Tablet Input Panel, Cellwriter. And, because it's useful, I installed a Windows Journal equivalent, Xournal.

Two things did not work right away: the tablet hardware buttons (including special PageUp and PageDown keys, a screen rotation button, and a few others), and (since there was no button for it) any kind of screen rotation that didn't involve going through the control panels. The volume keys work, but apparently control the hardware volume level (as distinct from the software volume level set in the Sound control panel), and therefore have no on-screen display.

My key resources for getting these things working were LIKEN Apuntes's Installing Linux, Ubuntu 8.04 Hardy, on a IBM X41 Tablet and Thinkwiki.org, which is a staggeringly good resource for getting Linux to work on Thinkpads.

Tablet Keys

Tablet keys were not actually difficult to make work, but took me a long time because Thinkwiki was down. My understanding of the problem is this: every keypress generates a hexadecimal key scancode in the kernel, which is then passed to X and assigned a separate keycode from 0 to 255. Keycodes from 0-119 are used for standard keyboard keys, and keycodes 120 and above are mostly unused. Once you find the keycodes the kernel uses, it's a trivial matter to find set a keycode in X and assign shortcuts to it. Unfortunately, in 9.04, the kernel's keyboard mask is set to disregard those buttons entirely, making it very difficult to find those keycodes.

Fortunately, though, Thinkwiki has an article on Tablet Hardware Buttons. Armed with these keycodes, I needed only edit my /etc/rc.local (sudo gedit /etc/rc.local) to assign those keys codes in X at startup. The keycodes for the tablet PageUp, PageDown, Enter, and Escape buttons aren't arbitrary: they're the same ones used by the normal PageUp, PageDown, Enter, and Escape keys. For those, add these lines to /etc/rc.local:

# PageDown, PageUp, Enter, Escape
setkeycodes 6e 109
setkeycodes 6d 104
setkeycodes 69 28
setkeycodes 6b 1

...where 6e, 6d, 69, and 6b are the kernel scancodes in the Thinkwiki article I linked, minus the '0x', and 109, 104, 28, and 1 are the keycodes X uses for PageDown, PageUp, Enter, Escape. If you're interested, you can find out what keycode X uses for what key by entering "sudo dumpkeys" (or, since the output is very long, "sudo dumpkeys | less") into the terminal. Sorry if that's a little over-deliberate.

For the other three keys, you can assign keycodes fairly arbitrarily. All the unused keycodes will be at the end of the dumpkeys output; I used 130, 131, and 132 for the Tablet Menu, Rotate, and Ctrl-Alt-Del keys:

# Tablet Menu Key
setkeycodes 68 130
# Tablet Rotate
setkeycodes 6c 131
# Tablet Ctrl-Alt-Del Key
setkeycodes 67 132

These keys are a little trickier, though, because they don't do anything by themselves. I wanted to assign my Tablet Menu key to open up Cellwriter, so I went to System -> Settings -> Keyboard Shortcuts, hit the "Add" button at the bottom, created a "Cellwriter" shortcut which called on the cellwriter command. Then, I clicked the shortcut box and pressed the Tablet Menu key, and the name X uses for that keycode showed up in the box. Unfortunately, when I was done with that, my Tablet Menu key still didn't do anything.

As a workaround, I went to the configuration editor (gconf-editor in terminal) and from there to apps -> metacity -> keybinding_commands. I arbitrarily assigned command_11 to cellwriter, then went to apps -> metacity -> global_keybindings and assigned run_command_11 to the name the Keyboard Shortcuts control panel gave when I pressed the Tablet Menu key. This is incredibly clumsy, but it worked for me.

I left the Ctrl-Alt-Del key alone, because I couldn't think of anything I wanted to do with it. The Tablet Rotate key requires some extra work.

Tablet Rotation

LIKEN Apuntes has a script and very good directions for setting up your tablet screen to rotate. You can even make the screen rotate automatically when it swivels. If you follow those directions, your tablet will screen will rotate automatically, and you can use gconf-editor to assign, say, command_12 to /usr/local/bin/rotatetablet, and run_command_12 to whatever name Keyboard Shortcuts gives you for your Tablet Rotate key.

There is a problem with this. Your screen will rotate, but the tablet input will not, making pen use awkward at best. This is because of a change in the way Ubuntu Jaunty interprets tablet input. Never fear; there is a fix. I've taken it directly from post 104 of this thread on the Ubuntu forums. Without further ado, run:

sudo gedit /etc/init.d/wacomtohal

and paste in these lines:

#! /bin/sh
## find any wacom devices
for udi in `hal-find-by-property --key input.x11_driver --string wacom`
do
type=`hal-get-property --udi $udi --key input.x11_options.Type`
## rewrite the names that the Xserver will use
hal-set-property --udi $udi --key info.product --string $type
done

Save it, close it, and run these two commands in terminal:

sudo chmod +x /etc/init.d/wacomtohal
sudo update-rc.d wacomtohal defaults 27

After you've done that, restart and everything should work just fine.

Conclusion

Tablet PC support in Linux obviously isn't great, but with a little work the tablet can be made to do everything you'd expect from Windows XP Tablet Edition. Cellwriter and Xournal aren't as good as the Tablet Input Panel and Windows Journal (Cellwriter's handwriting recognition is fairly rudimentary, and Xournal doesn't have it at all), but Ubuntu is snappy on the X41t, and even snappier if you switch (as I did) from the default Gnome desktop environment to Xfce - a simple matter of installing xfce-4 in Synaptic, going to Options -> Select Session and selecting Xfce. It'll even ask you if you want to make it default.

Overall, I'm very happy with the tablet functionality - handwriting recognition isn't something I care much about, since any serious input I do will be through the keyboard anyway. Inking in Xournal is perfectly satisfactory for notetaking, and the ability to annotate PDFs is a nice feature. My only complaint is that Flash videos (from YouTube and Hulu, mostly) are choppy in fullscreen or HD under Ubuntu. This is not the machine's fault, though, or even Ubuntu's - Flash videos run fine in Windows, and higher-definition video formats run fine in Ubuntu using VLC or MPlayer. The fault lies entirely at the door of Adobe's poor Flash implementation in Linux.

That's it - it works.
上次由 allarem 在 2010-01-02 23:53,总共编辑 9 次。
pheyx
帖子: 6
注册时间: 2006-01-19 20:47

Re: 如何“驱动”Wacom手写笔-X41T

#2

帖子 pheyx » 2009-01-31 19:35

windows日记本可以用xournal来代替
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-X41T

#3

帖子 allarem » 2009-01-31 22:08

pheyx 写了:windows日记本可以用xournal来代替
:em11 谢谢哈
回头我去试试看
————
LS的06年注册到现在才处女帖。这太荣幸了……
More
帖子: 28
注册时间: 2008-06-15 11:23

Re: 如何“驱动”Wacom手写笔-X41T

#4

帖子 More » 2009-02-09 12:09

呵呵,T2010本本的手写笔终于能用了,但touch和手写功能还不行,还要怎么设置呢?
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-X41T

#5

帖子 allarem » 2009-02-09 21:12

More 写了:呵呵,T2010本本的手写笔终于能用了,但touch和手写功能还不行,还要怎么设置呢?
可以试试看第3步里面这些

代码: 全选

#  InputDevice   "pad"                      # For Intuos3/CintiqV5/Graphire4/Bamboo tablets
# InputDevice   "touch"   "SendCoreEvents" # Only a few TabletPCs support this type
的第一个注释去掉
注意备份先……,花屏了就麻烦了
hogcat
帖子: 6
注册时间: 2009-02-27 20:46

Re: 如何“驱动”Wacom手写笔-X41T

#6

帖子 hogcat » 2009-02-27 20:52

重新启动X
原理就是先干掉X,再重新运行一次
(其实干掉X之后它自动会重启,类似于Windows下面的Explorer)

先用top命令查看X的Pid,
然后再用kill <Pid>干掉X,
这时就会黑屏,然后X就重启了

万一出问题就Ctrl+Alt+F1切到终端,手动启动X:startx
:em11
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-X41T

#7

帖子 allarem » 2009-02-28 15:05

hogcat 写了:重新启动X
原理就是先干掉X,再重新运行一次
(其实干掉X之后它自动会重启,类似于Windows下面的Explorer)

先用top命令查看X的Pid,
然后再用kill <Pid>干掉X,
这时就会黑屏,然后X就重启了

万一出问题就Ctrl+Alt+F1切到终端,手动启动X:startx
:em11
:em09 我更新一下哈
redhot
帖子: 5
注册时间: 2009-03-04 20:41

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#8

帖子 redhot » 2009-03-04 21:44

我的是X41 1866
xxd /dev/ttyS0的时候有反应
按上述步骤操作之后不但触摸笔无法使用,屏幕右边也出现一个区域一直在闪,我估计是刷新率变了。
请大虾指教
Screenshot.png
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#9

帖子 allarem » 2009-03-04 22:41

redhot 写了:我的是X41 1866
xxd /dev/ttyS0的时候有反应
按上述步骤操作之后不但触摸笔无法使用,屏幕右边也出现一个区域一直在闪,我估计是刷新率变了。
请大虾指教
Screenshot.png
怎么闪的?我也闪过……但是重新载入我写的那个xorg.conf就不闪了

最好先恢复xorg.conf试试

其实我也是菜鸟的……
redhot
帖子: 5
注册时间: 2009-03-04 20:41

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#10

帖子 redhot » 2009-03-04 22:53

恢复了,不闪了,不过触摸笔还是不能用。。。
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#11

帖子 allarem » 2009-03-04 22:58

redhot 写了:恢复了,不闪了,不过触摸笔还是不能用。。。
那个XML写入了没?……其实我也不知道到底哪个起作用的……都是看帖子的
redhot
帖子: 5
注册时间: 2009-03-04 20:41

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#12

帖子 redhot » 2009-03-04 23:08

写入了。。还是一样,右边花屏。。
汗,
头像
allarem
帖子: 1025
注册时间: 2008-05-31 17:27
来自: SUES
联系:

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#13

帖子 allarem » 2009-03-05 10:48

redhot 写了:写入了。。还是一样,右边花屏。。
汗,
右边闪貌似是对xorg.conf配置不正确,你改分辨率到1024*800试试
redhot
帖子: 5
注册时间: 2009-03-04 20:41

Re: 如何“驱动”Wacom手写笔-例子X41T(20090228update)

#14

帖子 redhot » 2009-03-06 13:08

重装了ubuntu,更新了新的包。。可以用了。。汗一把。。

用8.04环境操作失败,成功驱动估计是升级到了8.10才正常的。
头像
lamoda
帖子: 7
注册时间: 2009-03-31 16:35
来自: 亚美克星

Re: 如何“驱动”Wacom手写笔-例子X41T(20090425update)

#15

帖子 lamoda » 2009-04-27 21:01

ok, 我刚测试了一些,9.04 下是可以修改xorg.conf(前提是wacom tablet一直连着电脑,否则的话启动是xorg会出问题,需要脸上wacom才能正常启动,否则只能在低分辨率下干活), 虽然9.04能够识别wacom,但是在Qt app程序中手写程序是无法获得wacom event,因为Qt对stylus,eraser等进行了硬编码,只有修改xorg.conf,才能正常工作。
上次由 lamoda 在 2009-04-27 21:46,总共编辑 2 次。
You are so boring that when I see you my feet go to sleep。
回复