Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to flip the display and touch of raspberry pie

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how raspberry pie realizes display flipping and touch flipping". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn the article "how raspberry pie realizes display flipping and touch flipping".

1 Flip display:

1.sudo nano / boot/config.txt

two。 Add at the end of the file

Display_rotate=0

Display_rotate=1 / / 90 °

Display_rotate=2 / 180 °

Display_rotate=3 / / 270 °

Ctrl + o Save the document and restart it.

2 flip touch

This needs xinput.

Note: the following operations are all SSH operations, so each instruction is preceded by DISPLAY=:0, if the local operation can be deleted.

2.1 View touchscreen information 2.1.1. Install xinput

Sudo apt-get install xinput

2.1.2. List all input device information

Xinput-list

If remote operation, remember to add DISPLAY=:0 before the command.

Get the following information:

Pi@raspberrypi:~ $xinput-- list

⎡ Virtual corepointer id=2 [masterpointer (3)]

⎜ ↳ Virtual core XTESTpointer id=4 [slave pointer (2)]

⎜ ↳ Silicon WorksMulti-touch SW4101C id=6 [slave pointer (2)]

⎣ Virtual corekeyboard id=3 [master keyboard (2)]

↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]

Pi@raspberrypi:~ $

2.1.3. List target device attribut

Pi@raspberrypi:~ $xinput-- list-props 6

Device 'Silicon Works Multi-touch SW4101C':

DeviceEnabled (114): 1

CoordinateTransformation Matrix 0.000000, 0.000000, 0.000000, 1.0000000.000000, 0.000000, 0.000000, 1.000000

LibinputCalibration Matrix:-1.0000000.000000, 1.0000000.000000,-1.000000, 1.0000000.000000, 0.000000, 1.000000

LibinputCalibration Matrix Default 0.000000, 0.000000, 0.000000, 1.0000000.000000, 0.000000, 0.000000, 1.000000

LibinputSend Events Modes Available (248): 1.

LibinputSend Events Mode Enabled: 0,0

LibinputSend Events Mode Enabled Default (250): 010

DeviceNode: "/ dev/input/event0"

DeviceProduct ID: 10685, 16641

Attention! If the touch screen information is the above, please refer to 2.2; if not, please refer to 2.32.2 to modify the configuration file 2.2.1 and install libinput

Check to see if the file 40-libinput.conf exists in the / usr/share/X11/xorg.conf.d/ directory.

If not, installation is required.

Sudo apt-get installxserver-xorg-input-libinput

2.2.2. Copy the file to the / etc/X11/xorg.conf.d/ directory.

At first, the xorg.conf.d directory may not be available in / etc/X11, so you need to create it yourself.

Sudo mkdirxorg.conf.d

Sudo cp/usr/share/X11/xorg.conf.d/40-libinput.conf / etc/X11/xorg.conf.d/

2.2.3. Modify the 40-libinput.conf file under the / etc/X11/xorg.conf.d/ directory

Cd/etc/X11/xorg.conf.d/

Sudo vim 40-libinput.conf

Find touchscreensection.

Section "InputClass"

Identifier "libinput touchscreencatchall"

MatchIsTouchscreen "on"

MatchDevicePath "/ dev/input/event*"

Driver "libinput"

EndSection

Add a line Option "CalibrationMatrix"- 1 0 10-1 100 1"

The result is

Section "InputClass"

Identifier "libinput touchscreencatchall"

Option "CalibrationMatrix"- 1 0 10-1 100 1"

MatchIsTouchscreen "on"

MatchDevicePath "/ dev/input/event*"

Driver "libinput"

EndSection

Complete the above steps to perform a 90degree rotation.

Note:

90 degree rotation:Option "CalibrationMatrix"0 10-1 0 01"

180 degree rotation:Option "CalibrationMatrix"-1 0 10-1 100 1 "

270,270 degree rotation:Option "CalibrationMatrix"0-11 1000 0 01"

2.3. Another touch screen processing method

Pi@NTGAGE:~ $DISPLAY=:0 xinput-- list-props 7

Device 'WaveShare WaveShare Touchscreen':

Device Enabled (115): 1

Coordinate Transformation Matrix: 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000

Device Accel Profile (240): 0

Device Accel Constant Deceleration (241): 1.000000

Device Accel Adaptive Deceleration (242): 1.000000

Device Accel Velocity Scaling: 10.000000

Device Product ID: 3823, 5

Device Node: "/ dev/input/event3"

Evdev Axis Inversion: 0,0

Evdev Axis Calibration 247:

Evdev Axes Swap (248): 0

Axis Labels: "Abs MT Position X", "Abs MT Position Y", "Abs MT Pressure", "None", "None", "None" (0)

Button Labels: "Button Unknown", "Button Wheel Up", "Button Wheel Down"

Evdev Scrolling Distance: 0,0,0

Evdev Middle Button Emulation: 0

Evdev Middle Button Timeout: 50

Evdev Third Button Emulation (254): 0

Evdev Third Button Emulation Timeout: 1000

Evdev Third Button Emulation Button (256): 3

Evdev Third Button Emulation Threshold: 20

Evdev Wheel Emulation (258): 0

Evdev Wheel Emulation Axes: 0,0,4,5

Evdev Wheel Emulation Inertia (260): 10

Evdev Wheel Emulation Timeout (261): 200

Evdev Wheel Emulation Button (262): 4

Evdev Drag Lock Buttons (263): 0

The normal display and touch information on this screen is as above.

If you go to this step and find that there are no properties such as Evdev above, jump to 2.2.

What needs to be achieved now is to flip the touch with the display while the screen is reversed.

The screen displays a flip of 90 degrees. / boot/config.txt is set to display_rotate=1

The Evdev Axis Inversion item in the above information is the rotation setting item for each axis, followed by the first parameter x and the second parameter y.

The Evdev Axes Swap item corresponds to the exchange of two axes.

0 is not flipped, 1 is flipped

For example. The x-axis is originally facing to the right, when the first parameter of Evdev Axis Inversion

Set to 1, that is, the x-axis faces to the left.

4. Rotate the axis of the touch

Now the aim is to touch and rotate 90 degrees and understand from the axis:

That is, the forward direction of the destination x-axis is the reverse of the initial y-axis. The positive direction of the y axis is the positive direction of the initial x axis.

1) so swap the x and y axes first

DISPLAY=:0 xinput-set-prop'7' Evdev Axes Swap' 1

2) then reverse the y-axis

DISPLAY=:0 xinput-- set-prop'7' Evdev Axis Inversion' 0 1

In this way, the touch can be rotated 90 degrees. To rotate another angle, you can reason.

Shows that a restart is required after the rotation modification. The touch rotation does not need to be restarted.

The above is all the content of the article "how to display flip and touch flip" in raspberry pie. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report