下図の構成において、ディスプレイが同じタッチスクリーンデバイスである場合、
キャリブレーションプログラム(xinput_calibrator)は、セカンドディスプレイでは実行出来ません。
ミラー構成に設定するか、単一のディスプレイ出力にしてからキャリブレーションを行ってください。
また、タッチスクリーンデバイスの設定は、USBを挿抜したり、再ログインしたりすると初期化されてしまいます。
(0,0) (1919,0) (1920,0) (3839,0)
+--------------------+---------------------+
| gnome window manager |
| (ibus-engine) |
| DISPLAY=:0 DISPLAY=:0 |
| または |
| DISPLAY=:1 DISPLAY=:1 |
| |
+--------------------+---------------------+
(0,1079) (1919,1079) (1920,1079) (3889,1079)
マルチタッチスクリーンの
USBケーブルをリピータ接続してタッチスクリーンの電源をOFF/ONした際に、通信エラーを発生させます。
また、意図してタッチスクリーンの電源をOFF/ONしない場合でも、USB接続を自動的にREMOVE/ADDを繰り返す場合があります。
エラー発生の差に、まれにパニックが発生する現象が報告されました。
リピータ由来であっても、パニックを発生させることは好ましくないので、以下の対策を行ってください。
原因(自動的にREMOVE/ADDを繰り返す)
一部ベンダーのUSBはUSBのポーリングの際に、切断と接続を繰り返す、これを抑止するためには、カーネル起動時にHID_QUIRK_ALWAYS_POLL(0x400)パラメータを与える必要がある
usb 2-1.7.7: USB disconnect, device number 34
usb 2-1.7.7: new full-speed USB device number 35 using ehci-pci
usb 2-1.7.7: New USB device found, idVendor=0afa, idProduct=07d2
usb 2-1.7.7: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1.7.7: Product: USB Touch (WinXP&7)
usb 2-1.7.7: Manufacturer: UNITEC
hid-multitouch 0003:0AFA:07D2.0037: usb_submit_urb(ctrl) failed: -1
hid-multitouch 0003:0AFA:07D2.0037: timeout initializing reports
input: UNITEC USB Touch (WinXP&7) Pen as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7.7/2-1.7.7:1.0/0003:0AFA:07D2.0037/input/input76
input: UNITEC USB Touch (WinXP&7) as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.7/2-1.7.7/2-1.7.7:1.0/0003:0AFA:07D2.0037/input/input77
hid-multitouch 0003:0AFA:07D2.0037: input,hiddev0,hidraw3: USB HID v1.11 Pointer [UNITEC USB Touch (WinXP&7)] on usb-0000:00:1d.0-1.7.7/input0
対策(自動的にREMOVE/ADDを繰り返す)
対象のUSBIDを特定する。上記メッセージでは、0AFA:07D2である。
このUSBIDを利用して、grubの起動パラメータに下記を加える(ベンダーID:デバイスIDは、0x始まりの16進数を使用する事)。
/vmlinuz-3.16.54-RedHawk-7.0.4-trace root=UUID=aa0dd6a1-5178-4041-ba16-6d4018e0882c ro vconsole.keymap=jp106 vconsole.font=latarcyrheb-sun16 quiet LANG=ja_JP.UTF-8 crashkernel=128M@64M pci=routeirq pci=noaer workqueue.disable_numa usbhid.quirks=0AFA:07D2:0x00000400
原因(パニック発生)
/lib/modules/`uname -r`/build/drivers/hid/hid-multitouch.c中のmt_process_mt_event()関数内で、field->hidinputがNULLポインタになり、パニックを発生させる
対策(パニック発生)
/lib/modules/`uname -r`/build/drivers/hid/hid-multitouch.c中のmt_process_mt_event()関数を以下の様に変更し、再度hd-multitouch.cをインストールする。
static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
struct hid_usage *usage, __s32 value)
{
struct mt_device *td = hid_get_drvdata(hid);
__s32 quirks = td->mtclass.quirks;
#ifdef ORIGINAL/* field->hidinput がヌルポインタである場合を想定していない */
struct input_dev *input = field->hidinput->input;
#endif
if (hid->claimed & HID_CLAIMED_INPUT) {
switch (usage->hid) {
case HID_DG_INRANGE:
if (quirks & MT_QUIRK_VALID_IS_INRANGE)
td->curvalid = value;
if (quirks & MT_QUIRK_HOVERING)
td->curdata.inrange_state = value;
break;
case HID_DG_TIPSWITCH:
if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
td->curvalid = value;
td->curdata.touch_state = value;
break;
case HID_DG_CONFIDENCE:
if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
td->curvalid = value;
break;
case HID_DG_CONTACTID:
td->curdata.contactid = value;
break;
case HID_DG_TIPPRESSURE:
td->curdata.p = value;
break;
case HID_GD_X:
if (usage->code == ABS_MT_TOOL_X)
td->curdata.cx = value;
else
td->curdata.x = value;
break;
case HID_GD_Y:
if (usage->code == ABS_MT_TOOL_Y)
td->curdata.cy = value;
else
td->curdata.y = value;
break;
case HID_DG_WIDTH:
td->curdata.w = value;
break;
case HID_DG_HEIGHT:
td->curdata.h = value;
break;
case HID_DG_CONTACTCOUNT:
break;
case HID_DG_TOUCH:
/* do nothing */
break;
default:
#ifdef ORIGINAL /* パラメータがヌルポインタである場合を想定していない */
if (usage->type)
input_event(input, usage->type, usage->code,
value);
#else /* パラメータがヌルポインタである場合を想定する */
if (usage->type && field && field->hidinput && field->hidinput->input)
input_event(input, usage->type, usage->code,
value);
#endif
return;
}
if (usage->usage_index + 1 == field->report_count) {
/* we only take into account the last report. */
#ifdef ORIGINAL /* パラメータがヌルポインタである場合を想定していない */
if (usage->hid == td->last_slot_field)
mt_complete_slot(td, field->hidinput->input);
#else/* パラメータがヌルポインタである場合を想定する */
if (usage->hid == td->last_slot_field && field && field->hidinput && field->hidinput->input)
mt_complete_slot(td, field->hidinput->input);
#endif
}
}
}
静的キャリブレーションの値は、/etc/X11/xorg.conf.d/99-calibration.confや/etc/X11/xorg.confのevdev のOption “Catibration” “min-x max-x min-y max-y” で行う。
しかし、この設定は、マルチタッチスクリーンのUSBケーブルの挿抜や、DISABLEボタンのON/OFFでリセットされるため、xinputコマンドを利用して動的キャリブレーションを行う必要がある。
/etc/X11/xorg.conf.d/99-calibration.confへの記述例
キャリブレーションプログラム終了後のメッセージに従って、キャリブレーションファイル(/etc/X11/xorg.conf.d/99-calibration.conf)を生成する。
# xinput_calibrator --output-type xorg.conf.d --no-timeout --precalib 0 3839 0 2159
Calibrating EVDEV driver for "Nano TouchSystems Nano TouchSystems" id=9
current calibration values (from XInput): min_x=14, max_x=32809 and min_y=-43, max_y=32947
INFO: width=3840, height=2160
Doing dynamic recalibration:
Setting calibration data: 25, 32803, -48, 32983
--> Making the calibration permanent <--
copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
Identifier "calibration"
MatchProduct "Nano TouchSystems Nano TouchSystems"
Option "Calibration" "25 32803 -48 32983"
Option "SwapAxes" "0"
EndSection
/etc/X11/xorg.conf への記述例
/etc/X11/xorg.conf への記述は、以下の例のように行う。
デバイス名称の確認
evdevは、すべてのポインティングデバイスを同時に管理しているので、個別に値を設定するためには、以下の例のようにMatchProductタグで個別設定を行う。
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
Section "Files"
FontPath "/usr/share/fonts/default/Type1"
EndSection
Section "InputClass"
Identifier "calibration"
MatchProduct "Nano TouchSystems Nano TouchSystems"
Option "Calibration" "25 32803 -48 32983"
Option "SwapAxes" "0"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from data in "/etc/sysconfig/keyboard"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbLayout" "jp"
Option "XkbModel" "jp106"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
/etc/udev/rules.d/99_touchscreen.rulesへの記述例
udevは、ここ数年でかなり最近変更され、デーモンまたは他の長時間実行プロセスの開始は適切では無くなった。udevdはsystemdの一部で、より制限されるようになった。
結果、udevルールに記述されたシェルスクリプト等の 分岐したプロセスは、切り離されているかどうかに関係なく、イベント処理が終了した後、無条件に強制終了され、値がリセットされる。
解決策として、以下の様に2段階のシェルスクリプトを使用してジョブをスケジュールするようにudevルールを設定する。
/etc/udev/rules.d/99_touchscreen.rulesファイルのコメント部分を削除し、マルチタッチスクリーン及びスタイラスペンを別個に動的キャリブレーションする必要がある。
/etc/udev/rules.d/99_touchscreen.rules
#udev rules for touchscreen supported devices
#see udevadm monitor -p
#create the file '/etc/udev/rules.d/99_touchscreen.rules' with:
ACTION!="add|change", GOTO="touchscreen_end"
# (3) Dynamic Calibration Pen
#ACTION=="add",SUBSYSTEM=="input",KERNEL=="event*",ATTRS{idVendor}=="0eef",ATTRS{idProduct}=="c002",ENV{ID_INPUT_TABLET}=="1",RUN+="/usr/local/CNC/drivers/multitouch/hid/touchscreen.delayed.sh Pen"
# (4) Dynamic Calibration Touchscreen
#ACTION=="add",SUBSYSTEM=="input",KERNEL=="event*",ATTRS{idVendor}=="0eef",ATTRS{idProduct}=="c002",ENV{ID_INPUT_TABLET}=="1",RUN+="/usr/local/CNC/drivers/multitouch/hid/touchscreen.delayed.sh Touchscreen"
LABEL="touchscreen_end"
/usr/local/CNC/drivers/multitouch/hid/touchscreen.delayed.sh
#!/bin/sh
# touchscreen.delayed.sh
# Starting daemons or other long running processes is not appropriate
# for udev; the forked processes, detached or not, will be
# unconditionally killed after the event handling has finished.
#
# udev changed much lately in these years.
# It is become part of systemd and more confined.
# Set udev rule to run a script scheduling the job using at.
#
echo "/usr/local/CNC/drivers/multitouch/hid/touchscreen.calibration.sh $*"| at now
/usr/local/CNC/drivers/multitouch/hid/touchscreen.calibration.sh
#!/bin/sh
if [ "$1" == "Pen" ]
then
DISPLAY=:0.0 xinput set-int-prop "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143 Pen" "Evdev Axis Calibration" 32 50 16390 15 16388
DISPLAY=:0.0 xinput set-int-prop "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143 Pen" "Evdev Axes Swap" 8 0
fi
if [ "$1" == "Touchscreen" ]
then
DISPLAY=:0.0 xinput set-int-prop "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143" "Evdev Axis Calibration" 32 155 16385 -61 16485
DISPLAY=:0.0 xinput set-int-prop "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143" "Evdev Axes Swap" 8 0
fi
CoolTouch の場合
再起動し、以下のコマンドで、CoolTouch が組み込まれていることを確認する。
# xinput
| Virtual core pointer id=2 [master pointer (3)]
| | Virtual core XTEST pointer id=4 [slave pointer (2)]
| | Dell Dell USB Mouse id=9 [slave pointer (2)]
| L Advanced Silicon S.A. CoolTouch(TM) System id=10 [slave pointer (2)]
L Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
| Dell Dell USB Keyboard id=6 [slave keyboard (3)]
| Power Button id=7 [slave keyboard (3)]
L Power Button
# cat /proc/bus/input/devices
:
:
I: Bus=0003 Vendor=2149 Product=2122 Version=0110
N: Name="Advanced Silicon S.A. CoolTouch(TM) System"
P: Phys=usb-0000:00:1a.0-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2:1.0/input/input5
U: Uniq=
H: Handlers=mouse1 event5
B: PROP=2
B: EV=b
B: KEY=400 0 0 0 0 0
B: ABS=260800000000003
:
:
この時点で、マルチタッチスクリーンは動作している
このデバイスでは、特別な記述は必要ない。
Nano TouchSystems の場合
再起動し、以下のコマンドで、Nano TouchSystems Nano TouchSystems が組み込まれていることを確認する
Nano TouchSystems Nano TouchSystems Pen は、動作しない。)
# xinput
| Virtual core pointer id=2 [master pointer (3)]
| | Virtual core XTEST pointer id=4 [slave pointer (2)]
| L Nano TouchSystems Nano TouchSystems id=8 [slave pointer (2)]
L Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
| CHICONY USB Keyboard id=6 [slave keyboard (3)]
L Power Button id=7 [slave keyboard (3)]
この時点で、マルチタッチスクリーンは動作している。
この例では Nano TouchSystems Nano TouchSystems Pen は、evdev の対象から除外されているが、これが原因で、誤動作が発生した場合には、/etc/udev/rules.d/99_touchscreen.rules ファイルのコメント部分を削除し、以下のルールを適用することで、udev の組み込み対象から除外することができる。
#udev rules for touchscreen supported devices
#see udevadm monitor -p
#create the file '/etc/udev/rules.d/99_touchscreen.rules' with
ACTION!="add|change", GOTO="touchscreen_end"
# (0) remove Nano TouchSystems Nano TouchSystems Pen"
ACTION=="add", SUBSYSTEM=="input", KERNEL=="event*",ATTRS{idVendor}=="2c6c",ATTRS{idProduct}=="2200",ENV{ID_INPUT_TABLET}=="1" ,RUN+="/usr/bin/udevadm trigger --action=remove --parent-match=%p"
LABEL="touchscreen_end"
ILITEK Multi-Touch-V の場合
再起動し、以下のコマンドで、ILITEK Multi-Touch-Vが組み込まれていることを確認する。
# xinput
| Virtual core pointer id=2 [master pointer (3)]
| | Virtual core XTEST pointer id=4 [slave pointer (2)]
| | SIGMACHIP USB Keyboard id=8 [slave pointer (2)]
| | ILITEK Multi-Touch-V id=9 [slave pointer (2)]
| | HID 0557:2419 id=11 [slave pointer (2)]
| L Logitech USB Laser Mouse id=12 [slave pointer (2)]
L Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
| Power Button id=6 [slave keyboard (3)]
| SIGMACHIP USB Keyboard id=7 [slave keyboard (3)]
L HID 0557:2419 id=10 [slave keyboard (3)]
このデバイスでは、特別な記述は必要ない。
D-WAV Scientific の場合
再起動し、以下のコマンドで、eGalaxTouchが組み込まれていることを確認する。
# xinput
| Virtual core pointer id=2 [master pointer (3)]
| | Virtual core XTEST pointer id=4 [slave pointer (2)]
| | USB Optical Mouse id=8 [slave pointer (2)]
| | Dell KB216 Wired Keyboard id=10 [slave pointer (2)]
| | eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143 Pen id=12 [slave pointer (2)]
| L eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143 id=13 [slave pointer (2)]
L Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
| Power Button id=6 [slave keyboard (3)]
| Power Button id=7 [slave keyboard (3)]
| Dell KB216 Wired Keyboard id=9 [slave keyboard (3)]
L AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
この時点で、マルチタッチスクリーンおよびスタイラスペンは動作している
この定義ではマルチタッチスクリーン及びスタイラスペンはevdevに組み込まれているが、これらのデバイスを削除する必要がある場合には、/etc/udev/rules.d/99_touchscreen.rulesファイルのコメント部分を削除し、以下のルールを適用することで、udevの組み込み対象から除外することができる
#udev rules for touchscreen supported devices
#see udevadm monitor -p
#create the file '/etc/udev/rules.d/99_touchscreen.rules' with:
ACTION!="add|change", GOTO="touchscreen_end"
# (1) remove Pen "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143 Pen"
#ACTION=="add", SUBSYSTEM=="input", KERNEL=="event*",ATTRS{idVendor}=="0eef",ATTRS{idProduct}=="c002",ENV{ID_INPUT_TABLET}=="1" ,RUN+="/usr/bin/udevadm trigger --action=remove --parent-match=%p"
# (2) remove Touchscreen "eGalax Inc. eGalaxTouch P80H84 2961 v00_T1 k4.10.143"
#ACTION=="add", SUBSYSTEM=="input", KERNEL=="event*",ATTRS{idVendor}=="0eef",ATTRS{idProduct}=="c002",ENV{ID_INPUT_TOUCHSCREEN}=="1" ,RUN+="/usr/bin/udevadm trigger --action=remove --parent-match=%p"
LABEL="touchscreen_end"
Weida Hi-Tech Mildex32 の場合
# xinput
| Virtual core pointer id=2 [master pointer (3)]
| | Virtual core XTEST pointer id=4 [slave pointer (2)]
| | USB Optical Mouse id=8 [slave pointer (2)]
| | Dell KB216 Wired Keyboard id=10 [slave pointer (2)]
| L Weida Hi-Tech Mildex32 id=12 [slave pointer (2)]
L Virtual core keyboard id=3 [master keyboard (2)]
| Virtual core XTEST keyboard id=5 [slave keyboard (3)]
| Power Button id=6 [slave keyboard (3)]
| Power Button id=7 [slave keyboard (3)]
| Dell KB216 Wired Keyboard id=9 [slave keyboard (3)]
L AT Translated Set 2 keyboard id=11 [slave keyboard (3)]
この時点で、マルチタッチスクリーンは動作している。
このデバイスでは、/etc/X11/xorg.confに特別な記述は必要ない