====== TS050 Touchscreen ======
===== Introduction =====
This document mainly introduces the connection and usage of TS050. The first part of the document is about how to connect TS050, the second part is about some related operations under Ubuntu, and the third part is about some related operations under Android.
===== Hardware Connection =====
/*
{{gallery>products/sbc/common/accessories?*ts050*.png&lightbox}}
*/
==== VIM4 ====
{{gallery>products/sbc/common/accessories?vim4*ts050*.png&lightbox}}
/*
{{/products/sbc/common/accessories/vim4-ts050-front.png?500|VIM4 ts050 panel front connection}}
{{/products/sbc/common/accessories/vim4-ts050.png?500 |vim4-ts050}}
*/
==== VIM3 VIM3L ====
{{gallery>products/sbc/common/accessories?vim3*ts050*.png&lightbox}}
/*
{{/products/sbc/common/accessories/vim3-ts050-front.png?500|vim3-ts050-front}}
{{products:sbc:vim3:add-ons:vim3-ts050-back.png?500|vim3-ts050}}
*/
==== Edge1 ====
{{gallery>products/sbc/common/accessories?edge*ts050*.png&lightbox}}
/*
{{products:sbc:vim3:add-ons:edge-ts050.png?500|edgev-ts050}}
*/
===== Ubuntu =====
==== Rotate ====
Only suitable for ''VIM3/3L'', you can refer to the system settings to rotate the screen easily for ''VIM4''.
TS050 is portrait mode by default, here is a guide to rotate the screen to landscape mode.
These configurations will also effect the HDMI display, so if you want to use HDMI display, you need to remove them.
You need to create Xorg configuration file and autostart script for setting the resolution.
1. Create Xorg configuration file ''/etc/X11/xorg.conf.d/10-ts050-fbdev-rotate.conf''.
```txt
Section "Device"
Identifier "Configured Video Device"
# Rotate off
# Option "Rotate" "off"
# Rotate Right / clockwise, 90 degrees
Option "Rotate" "CW"
# Rotate upside down, 180 degrees
# Option "Rotate" "UD"
# Rotate counter clockwise, 270 degrees
# Option "Rotate" "CCW"
EndSection
Section "InputClass"
Identifier "Coordinate Transformation Matrix"
MatchIsTouchscreen "on"
MatchProduct "EP0000M09"
MatchDriver "libinput"
# Rotate Right / clockwise, 90 degrees
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
# Rotate upside down, 180 degrees
# Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
# otate counter clockwise, 270 degrees
# Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection
```
2. Create Resolution setting autostart file ''/etc/xdg/autostart/panel-setup.desktop''.
```txt
[Desktop Entry]
Version=1.0
Name=pixel
Exec=xrandr --output "default" --mode "1920x1088"
Terminal=false
Type=Application
Categories=
GenericName=
X-GNOME-Autostart-Phase=Initialization
X-KDE-autostart-phase=1
NoDisplay=true
```
Restart the system and the screen will automatically be configured as a landscape screen.
* The configuration above will rotate to landscape mode, you can also rotate to other modes, simply uncomment the mode you want.
* And please note the resolution for landscape mode is ''1920x1088'', for portrait mode is ''1088x1920''.
You can rotate the framebuffer console in two ways.
* System Node
* Configuration File
Framebuffer console rotation value:
* 0 - default value (landscape mode)
* 1 - rotate 90 degrees
* 2 - rotate 180 degrees
* 3 - rotate 270 degrees
1. Rotate via system node.
* Check the current configuration of the node. \\ ```sh
khadas@Khadas:~$ cat /sys/class/graphics/fbcon/rotate
0
```
* Modify the configuration to rotate the framebuffer(90 degrees). \\ ```sh
khadas@Khadas:~ $ echo 1 | sudo tee /sys/class/graphics/fbcon/rotate
khadas@Khadas:~ $ cat /sys/class/graphics/fbcon/rotate
1
```
* Restore framebuffer console to the default setting. \\ ```sh
khadas@Khadas:~ $ echo 0 | sudo tee /sys/class/graphics/fbcon/rotate
khadas@Khadas:~ $ cat /sys/class/graphics/fbcon/rotate
0
```
The modification will be lost after a power cycle, if you want to save it you can check the other way below.
2. Rotate via configuration file
* Check related configuration. \\ ```sh
khadas@Khadas:~$ cat /boot/env.txt | grep "fb_rotate"
fb_rotate=0
```
* Change setting(rotate 90 degrees): \\ ```sh
khadas@Khadas:~$ sudo vim /boot/env.txt
fb_rotate=0 change to fb_rotate=1
```
You need to save the file and reboot the board.
===== Android =====