First of all I recorded a video on the phenomenon, this might be more descriptive than my words: video of the problem

I have a project in which I have to use two displays: the first one is the 7 inch touchscreen shipped with the Raspberry (link), and the other one is a generic non-touch monitor connected via HDMI.

The first display is used as a touch control-panel, the second one is used only for displaying some information.

The problem is the following: When using only the touchscreen, everything is fine, the pointer clicks exactly where my finger is. But when I attach and configure the secondary monitor, the virtual "canvas" grows to more than twice the size, and my touches on the touchscreen become highly shifted to the right.

So the touch area now wants to cover the entire virtual canvas, offsetting the pointer from the physical touch, and making it nearly impossible to precisely hit any button on the screen.

I would be glad to receive any help!

  • Do you know if that official touchscreen is certified to work with the Pi 4? The specs I have seen for it say it works with Pi 3B+ and A+.
    – Mike Poole
    Nov 6, 2019 at 7:31
  • 1
    @MikePoole I don't know about specs, but in my experience, it does work very well with the Pi 4.
    – dJani
    Nov 8, 2019 at 23:30

1 Answer 1


The answer lies in this document: ELI Touch Screen Calibration in Linux

First of all, we need to check the name of the display with the following command:


For me, it was DSI-1.

Then we need to do the same for our touch input:


For me, it was 10.

Then to put it all together, we map the input to the desired display:

xinput map-to-output <input_device_id> <display_device_id>

So in my case, this meant xinput map-to-output 10 DSI-1. This command has to be executed each time the device boots. On this matter, see the following post: Execute script on start-up

Hope this finds many people who need it!


  • 1
    Which method did u use to executed the command on boot up? Able to share how you did it? Aug 19, 2020 at 8:08
  • I'm running a Python GUI application that opens up as soon as the system starts. This application is started by the /etc/xdg/lxsession/LXDE-pi/autostart script. It was convenient for me to call the touch configuration from the already running Python application, making it less painful to configure on new hosts. But in your case, simply add these commands to /etc/xdg/lxsession/LXDE-pi/autostart, and I suppose you should get the same result.
    – dJani
    Aug 19, 2020 at 10:50
  • 1
    Just want to thank you for this answer, I had exactly the same problem and I was just about to give up on it. Great help!
    – martin
    Apr 2, 2021 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.