Touch Rotating for Waveshare LCD (Modify libinput parameters )

Note:
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

   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:
dot_libinput-stack-xorg.png
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.
display_rotate=1
#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. 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!

    回复删除
  2. 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