Touch Rotating for Waveshare LCD (Modify libinput parameters )

This method only work for some Waveshare HDMI LCD. And we here take 7inch HDMI LCD (C) as example, use Rapsbian Stretch. The supports LCD are:
7inch HDMI LCD (B)
7inch HDMI LCD (C)
7inch HDMI LCD (H)
10.1inch HDMI LCD (B)
10.1inch HDMI LCD (D)
13.3inch HDMI LCD (H)
Some one said that this method also work for 5inch HDMI LCD (B).


   libinput is a library that handles input devices for display servers and other applications that need to directly deal with input devices. 
The simplified software stack for a system running X.Org is:
And on the Touchscreen page we can find the Calibration matrixs:
So we could get the matrix values for clockwise (for anticlockwise, just exchange the 90 degree and 270 degree):
[0, -1, 1, 1, 0, 0, 0, 0, 1] : 90 degree
[-1, 0, 1, 0, -1, 1, 0, 0, 1]: 180 degree
[0, 1, 0, -1, 0, 1, 0, 0, 1]: 270 degree

Display Rotation

 To rotate the display, you can just add the rotation statement to the config file.
Then reboot. The display will be rotated to 90 degree but the touch still the same.
#1: 90 degree
#2: 180 degree
#3: 270 degree

Touch Rotation

  1. Install libinput
    sudo apt-get install xserver-xorg-input-libinput
  2. create an xorg.conf.d folder
    sudo mkdir /etc/X11/xorg.conf.d
  3.  copy file 40-libinput-conf to the folder which we created
    sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
  4. Append a statement to touchscreen part of the file as below:
    sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
Note: According the rotation direction, you can use the corresponding values.
After setting, just reboot and the touch will rotate as well as the display.

Related Resources:


  1. When you blog about something that you are passionate of, the rest will just follow. You spend time on it because you love doing it, your contents are great because it is of interest to you, etc. The point is you blog for your own personal gratification.
    4 Wire Resistive Touch Screen

  2. 32 inch screen display, 32 inch display module, 32 inch replacement lcd tv screen

    Southern Stars Enterprises Co Ltd is the specialist manufacturer for commercial display since 1996. All our products are heavy-duty built to suit super long hour loop-playing 24/7/365.Our 32 inch lcd screen display uses professional industrial A+ LCD panel to make it durable.

    Visit here:- Touch screen display

  3. Thank you for making this article, we have so much to learn from this. Informative and knowledgeable. Meanwhile, If you are interested and looking for best Stretched LCD you may visit there. You can also check our available services to offer. Thank you and Godbless!

  4. Very informative and impressive post you have written, this is quite interesting and i have went through it completely, an upgraded information is shared, keep sharing such valuable information. Find the best stretched lcd.




Make a new larger font for Waveshare SPI e-Paper

Raspberry Pi drive 1.44inch LCD HAT with fbtft