3

Soon I'll commence a PhD study with a strong focus on modelling. I'm lucky enough to have my supervisor offer me a laptop. Since besides making and running models I'll be making minutes of meetings and perhaps giving a lecture from time to time, we were thinking of a touchscreen notebook.

Due to contracts I'll be stuck with HP or Dell. A nice laptop we've found can be seen at here. The most important aspect here is probably that the graphics chip is an Intel HD Graphics 3000.

Ideally I'd work with just the touchscreen during meetings and lectures, and would extend the laptop to an external monitor for modelling purposes. In the latter case I'd still use my laptop screen to draw diagrams. There are two points I'm worried about for now:

  1. Will the laptop touchscreen work with Ubuntu 11.10? Although similar questions on AskUbuntu and Googling suggest that it won't be a problem, I'd like to know for sure before buying the laptop. Would be a real waste if I need to switch back to Windows just to use the touchscreen.

  2. And if the touchscreen works, will it still work when I connect an external monitor? I found a similar question (see How do I calibrate a touchscreen on a dual monitor system?) but unfortunately that one has never been answered.

If you can tell me anything that might help (different set-ups that worked or didn't work, etc.), please let me know.

4 Answers 4

5

I had the same problem on my Surface Pro 2 with Ubuntu 12.04 64 bit. I have a dual-monitor setup with a MiniDisplay to HDMI cable, my second monitor isn't touch enabled. What worked for me was to find device names by:

xinput --list

This returned:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ HOLTEK Wireless USB Device                id=10   [slave  pointer  (2)]
⎜   ↳ Atmel Atmel maXTouch Digitizer            id=13   [slave  pointer  (2)]
⎜   ↳ MICROSOFT SAM                             id=11   [slave  pointer  (2)]
⎜   ↳ MICROSOFT SAM                             id=12   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ HOLTEK Wireless USB Device                id=9    [slave  keyboard (3)]
    ↳ Front LifeCam                             id=14   [slave  keyboard (3)]
    ↳ Rear LifeCam 

"xsetwacom --list" mentioned by @phnomic wouldn't return anything.

We then map devices to screens like @phnomic suggested:

xsetwacom set "Atmel Atmel maXTouch Digitizer" MapToOutput eDP1
xsetwacom set 11 MapToOutput eDP1
xsetwacom set 12 MapToOutput eDP1

note that 11 and 12 are device IDs for the two devices both named "MICROSOFT SAM"

1
  • Thanks for letting us know! Good to hear that xinput does the same job as xsetwacom --list. A small suggestion if I may, consider using "MICROSOFT SAM" instead of IDs 11 and 12. The IDs might change, the name won't.
    – Tomas
    Dec 12, 2013 at 6:28
4

There is a specific command for mapping input to a display in xsetwacom called MapToOutput. Here is what you do:

Start by figuring out the name of the display you want to map to. This can be done by running xrandr:

phnomic@phnomic-jobb:~$ xrandr
Screen 0: minimum 320 x 200, current 3200 x 1597, maximum 8192 x 8192
LVDS1 connected 1280x800+1920+797 (normal left inverted right x axis y axis) 286mm x 179mm
   1280x800       60.0*+
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
   1920x1200      59.9*+
   1920x1080      60.0  
   1600x1200      60.0  
   1680x1050      60.0  
   1280x1024      60.0  
   1440x900       59.9  
   1280x960       60.0  
   1024x768       60.0  
   800x600        60.3  
   640x480        60.0  
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)

In my case I want to use LVDS1.

Next, figure out what your devices are called. This is done using xsetwacom --list:

phnomic@phnomic-jobb:~$ xsetwacom --list
Wacom ISDv4 E6 Pen stylus           id: 20  type: STYLUS    
Wacom ISDv4 E6 Pen eraser           id: 21  type: ERASER    
Wacom ISDv4 E6 Finger touch         id: 22  type: TOUCH     

Finally run the command xsetwacom set "[device name]" MapToOutput [screen name] for all devices that you wish to assign. In my case, this becomes:

phnomic@phnomic-jobb:~$ xsetwacom set "Wacom ISDv4 E6 Pen stylus" MapToOutput LVDS1
phnomic@phnomic-jobb:~$ xsetwacom set "Wacom ISDv4 E6 Pen eraser" MapToOutput LVDS1
phnomic@phnomic-jobb:~$ xsetwacom set "Wacom ISDv4 E6 Finger touch" MapToOutput LVDS1

And then you are all good to use your fancy touch screen regardless of what monitors you connect it to and what orientation you use for your monitors.

If you want to know more, I recommend this sourceforge post.

1
  • Your method is quicker and more elegant. The other answer might be useful for other applications, but yours should be the accepted answer. Thanks a lot :)
    – Tomas
    Mar 8, 2012 at 1:09
1

I wrote a simple script that will fix things using udev. First create /etc/udev/rules.d/99-monitor-hotplug.rules

It is just this line:

ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/usr/share/X11/touchscreen.sh"

Now the /usr/share/X11/touchscreen.sh file (mark it +x !!) :

#!/bin/sh
#
# This is designed to be run by hotplug.  See hotplug docs ...
#

# Make sure PATH is sane
export PATH="/bin:/usr/bin"

# Now the rest of the ENV to hook into X
# This should probably be run by Dbus, but I don't know how.
# Instead I see who's running Dbus, and get that user's .Xauthority
# So, its kind of a hack!

export USER=`ps -ef | grep dbus-daemon | grep session | cut -d ' ' -f 1`
export DISPLAY=":0"
export XAUTHORITY=/home/$USER/.Xauthority
export ICON=/usr/share/icons/Humanity/devices/48/monitor.svg

# Find Touchscreen id number -- sets id
export id=`xinput | grep Touch | cut -d '=' -f 2 | cut -f 1`

# Find the primary screen! 
export screen=`xrandr | grep primary | cut -d ' ' -f 1`

# Use xinput to map them
xinput --map-to-output $id $screen

su $USER -c "notify-send -i $ICON \"TouchScreen\"\
 \"Mapping Device $id to your $screen screen\""

The last line just pops up a nice message telling you what it did. When from a terminal, on any user-id, it works great, but won't work from udev! The script itself works fine - its just the notification that fails from udev. Yet nother dbus issue I think. If anyone can fix that - let me know!!

3
  • great script except xinput | grep Touchscreen | cut -f 2 returns ID=11 (in my use case) but the xinput --map-to-output command only accepts 11 without the ID= xinput | cut -d '=' -f 2 | cut -f 1 Jul 18, 2020 at 18:30
  • Ok, I give up. This script doesn't work under Ubuntu 20.04 Unable to connect to X Server No Protocol specified Can't open Display :0 Jul 18, 2020 at 18:45
  • This was written years ago and I havent bothered to connect an external monitor in forever. I may look into this if I think about it. However, if it says cant open display ... Is X running? Is it running on :0 ? Jul 19, 2020 at 20:24
0

Too bad, apparently no-one knows.

I was lucky, however. A colleague of mine bought the touchscreen laptop a few months ago and didn't mind me playing around with it a bit when he was in the lab. This is what I figured out so far:

The touchscreen works flawlessly in Ubuntu 11.10, at least until you connect an external monitor. At that point the touchscreen is aligned to the combined original screen and external monitor, which means you cannot use the touchscreen properly. The good news is that it works just like the Wacom drawing tablets. This means that you can change the monitor area for which the touchscreen operates. By tweaking the Area property of all your devices you can get the touchscreen to work how you want it, for example by executing:

for pad in "Serial Wacom Tablet stylus" "Serial Wacom Tablet eraser" "Serial Wacom Tablet touch"
do
    xsetwacom --set "$pad" Area 0 0 10000 10000
done

where the 0 0 10000 10000 values are arbitrary (haven't had the time to figure this out).

My hero for today is chh, he figured out and posted how to do this on http://ubuntuforums.org/showthread.php?t=1527548. On this link you can also find his scripts to calculate the correct values. The xsetwacom version he used is different from the one I downloaded today, so his scripts didn't do the trick for me. Still, with this link, you should be able to figure it out for yourself.

Long story short, if you're planning to buy the HP laptop I mentioned earlier, you should be able to get the touchscreen to work properly with an external display attached.

And I should get back to work now.


Update! I finally got my laptop this week and did some more in-depth analysis about the dual screen scenario described in this question.

Using xsetwacom --list you can get a list of the Wacom-like devices (i.e., your touchscreen). Using the id returned by this command, you can save yourself a lot of typing. In case you want to reproduce what I'm going to explain, it might be useful to know my exact configuration:

tomas@EliteBook:~$ xsetwacom --list
Serial Wacom Tablet stylus          id: 16  type: STYLUS    
Serial Wacom Tablet eraser          id: 18  type: ERASER    
Serial Wacom Tablet touch           id: 19  type: TOUCH   

Using id 16 I can get the current area settings (18 and 19 should give the same results here):

tomas@EliteBook:~$ xsetwacom --get 16 Area
0 0 26312 16520

What this value means I'll leave to the experts. For me, it is important to know that this means 100%. Whether or not the external display is connected, this value remains the same. Trial-and-error gave me a decent touchscreen calibration for xsetwacom --set 16 0 0 50000 22000. When you look into it a bit more, you'll see why this makes sense: Define the correct calibration as 0 0 x y and the initial (what I called the 100%) setting as 0 0 x0 y0. Knowing my resolution is 1280x800 for the laptop and 1920x1080 for the external monitor and the external monitor is positioned to the right of my laptop, the top part aligned, you'll notice that in the horizontal direction the correct factor is the ratio of my total resolution (for me, 1280+1920) over my desired touchscreen resolution (1280). This gives a factor I'll define as a = 2.5. In the vertical direction this is 1080 over 800, or b = 1.35.

You might want to read the sentence above again. To help you a bit, see this screenshot of arandr.

To obtain the perfect value for my horizontal area, x, Simply multiply x0 by factor a. Do the same for your vertical area, y = b*y0, and then repeat for all your touchscreen devices (pen, eraser, touch) and you're all set:

xsetwacom --set 16 Area 0 0 65780 22302
xsetwacom --set 18 Area 0 0 65780 22302
xsetwacom --set 19 Area 0 0 65780 22302

edit: hmm, that's weird, the required area for finger/touch is smaller than the other devices by about a factor 10.

If I missed anything or if I'm not clear, send me a message and I'll try to help out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .