Friday, December 20, 2013

Fedora 20: Touchscreen doesn't work after lid closed

Fedora 20 was released recently and finally I've got the balls to install it in my new touchscreen laptop (which is preinstalled with Windows 8). The installation step is rather easy, takes me only few steps and I was like "that's it? It's installed?"

It looks nice, but there're some issues with my touchscreen. It appears that touchscreen will not work after I close my laptop lid, or probably when the laptop is put to sleep. So my early assumption is that whatever thing that should be handling the input from the touchscreen is not restarted. I'm almost correct, but the actual reason is that the touchscreen device was not mapped to the output device (i.e. the screen).

To solve this, first you need to know the name of your output device using the following command:
$ xrandr
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1366x768       60.0*+
   1024x768       60.0 
   800x600        60.3     56.2 
   640x480        59.9 
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)


in my case, LVDS1 is my laptop screen. Then you need to know your touchscreen ID using the following command:
$ xinput list
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Atmel Atmel maXTouch Digitizer              id=11    [slave  pointer  (2)]
⎜   ↳ ETPS/2 Elantech Touchpad                    id=14    [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)]
    ↳ Video Bus                                   id=8    [slave  keyboard (3)]
    ↳ Sleep Button                                id=9    [slave  keyboard (3)]
    ↳ USB Camera                                  id=10    [slave  keyboard (3)]
    ↳ Asus WMI hotkeys                            id=12    [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard                id=13    [slave  keyboard (3)]


from the output, my touchscreen would be Atmel maxTouch with id 11.

Now that you have both my output and input id, you can now map the input to the out using the following command:
$ xinput --map-to-output 11 LVDS1

Now test your touchscreen, it should've work after you execute the command.

Hope this helps. :)