Skip to content
flacoonb edited this page Aug 26, 2021 · 2 revisions

Raspberry Touchpanel DSI simultaneously with HDMI

When using a touchscreen on DSI and an HDMI screen simultaneously, the touch input is offset. This is because both monitors are recognized as one screen.

The remedy is the following:

xinput list

remember device id=Y of the touchscreen

xinput list-props "Device Name" 

Get device ID in brackets (X)

xinput set-prop [X] --type=float [Y] c0 0 c1 0 c2 c3 0 0 1

adjust the coding c0 0 c1 0 c2 c3 0 0 1 with your own data get the values of the screens with the following command

xrandr | grep \* # xrandr uses "*" 

to identify the screen being used

c0 = touch_area_width / total_width
(width of touch screen divided by width of both screens)
c2 = touch_area_height / total_height
(height touch screen divided by height of both screens)
c1 = touch_area_x_offset / total_width
c3 = touch_area_y_offset / total_height

and execute the above command again with your own coding, example:

xinput set-prop 6 --type=float 136 0.3478260869565217 0 0 0.55555555555556 0 0 0 1

Now unfortunately the settings are only valid for the current session. So create the following desktop startup file:

sudo nano ~/.config/autostart/touch.desktop

[Desktop Entry]
Name=TouchSettingsAutostart
Comment=Set up touch screen setting when starting desktop
Type=Application
Exec=xinput set-prop 6 --type=float 136 0.3478260869565217 0 0 0 0.55555555555556 0 0 0 1 ##Adapt command to own values
Terminal=false

Adjust rights and ownership:

sudo chmod +x ~/.config/autostart/touch.desktop
sudo chown pi:p ~/.config/autostart/touch.desktop

If you want to use the touchscreen as photobooth and the second monitor for the gallery, enter the following in the autostart file and adjust the value 1920 to your own resolution if necessary:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

@chromium-browser --new-window -start-fullscreen --kiosk http://localhost --window-position=1920,0 --user-data-dir=Default
@chromium-browser --new-window --start-fullscreen --kiosk http://localhost/slideshow/ --window-position=0,0 --user-data-dir='Profile 1'
Clone this wiki locally