PINE64

Full Version: LCD Technical Documentation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For anyone fiddling with the LCD display, this is where the technical documentation will be sticked / bookmarked as it collected for reference. Please feel free to point out any good sources of information and I'll add them to this main post when I get time.


From the pine64 wiki:
Elsewhere:
(11-24-2016, 09:47 PM)pfeerick Wrote: [ -> ]

Hi pfeerick!
Many thanks for the info!
I guess any kind of touch screen with GT911 chip and proper 6pin connector can be used, right?
(12-16-2016, 04:58 AM)Workaholic Wrote: [ -> ]
(11-24-2016, 09:47 PM)pfeerick Wrote: [ -> ]

Hi pfeerick!
Many thanks for the info!
I guess any kind of touch screen with GT911 chip and proper 6pin connector can be used, right?

Well, I've just ordered the next capacitive touch screen (on my own risk!) to be used with 7" display matrix from a similar to "Explay Hit" tablet, which I have on hands. BTW, this display works just fine with the Android LCD version.
I'm going to report here how that touch screen will work (or won't) when I get it, if there is community interest of course.  

Andrey d;-)
(12-18-2016, 05:30 PM)Workaholic Wrote: [ -> ]
(12-16-2016, 04:58 AM)Workaholic Wrote: [ -> ]
(11-24-2016, 09:47 PM)pfeerick Wrote: [ -> ]

Hi pfeerick!
Many thanks for the info!
I guess any kind of touch screen with GT911 chip and proper 6pin connector can be used, right?

Well, I've just ordered the next capacitive touch screen (on my own risk!) to be used with 7" display matrix from a similar to "Explay Hit" tablet, which I have on hands. BTW, this display works just fine with the Android LCD version.
I'm going to report here how that touch screen will work (or won't) when I get it, if there is community interest of course.  

Andrey d;-)
Count me in, I am interested. Looking forward for different type of LCD panel support on Pine A64.
(12-18-2016, 11:15 PM)tllim Wrote: [ -> ]Count me in, I am interested. Looking forward for different type of LCD panel support on Pine A64.

Yesterday I've got the touchscreen, finally.
Well, first of all, it has different 6-pin connector pinouts, so I was forced to make h/w hack to launch it up today.  (see pics) 
(I had a good rest this night to do it with fresh head and without shaking of hands and so on  Dodgy
Also, it is 180° rotated relative to LCD, so shape of its black fields don't match to LCD shape and there is a little shift.
Anyway, I'll share all the pics that I did between stages, if it is still interesting.
Frankly saying, it works somehow, but I do not recommend to use this touchscreen.

Well, now I would really appreciate if somebody could hint me how to rotate LCD or TP orientation relative each other in software (if it is possible at all).  Huh
Nice job with the hardware hacking for the TP connector :-)
yeah , that is rather interesting work on connector. so, i guess you got to experience the china express option on your package?
(01-17-2017, 11:16 AM)dkryder Wrote: [ -> ]yeah , that is rather interesting work on connector. so, i guess you got to experience the china express option on your package?

Actually, fine soldering isn't big deal for me, but I have no idea how to rotate LCD against TP in software.  Blush
Unfortunately GT911 has no registers to configure it, so I guess it can be done somewhere in Android only.
So, I'm going to experiment with rooted version.
Guys, who knows, please advise me right way. 

Andrey d;-)
(01-17-2017, 02:47 PM)Workaholic Wrote: [ -> ]
(01-17-2017, 11:16 AM)dkryder Wrote: [ -> ]yeah , that is rather interesting work on connector. so, i guess you got to experience the china express option on your package?

Actually, fine soldering isn't big deal for me, but I have no idea how to rotate LCD against TP in software.  Blush
Unfortunately GT911 has no registers to configure it, so I guess it can be done somewhere in Android only.
So, I'm going to experiment with rooted version.
Guys, who knows, please advise me right way. 

Andrey d;-)

You could try the following:

Android does rotate the Screen and Touch by software (in Java, this is slow and it is compensated by the fast HW blitting), you could modify the touch part only and rebuild the Android.

You cannot rotate screen as we usually do it in Intel but you could cheat the TSLIB in doing a rotation against the screen.

Capacitive touch are in absolute coordinate so there is no need for calibration (most of the times), but you could
compile and use TSLIB driver just like the old days (used for resistive touch), it works i usually use this driver for my capacitive touch experiments.

This is not going to be easy if you use Ubuntu, they dropped support long ago but you can grab the Debian version or use Debian for this but i cannot guarantee this will work as you expect but worth a try.

a) Grab the xf86-input-tslib source package (from Debian or the one you can find, if i recall correctly the last version was xf86-input-tslib 0.0.6 for X11)

b) Compile the driver, you will get tslib_drv.so (install it)

c) You will need this patch to make it work for the X11 version, if i recall correctly.

--- src/tslib.c 2013-06-30 15:20:14.939201439 +0400
+++ src/tslib.c 2013-06-26 18:19:16.000000000 +0400
@@ -196,9 +196,9 @@
                         x = samp.x;
                         y = samp.y;
 
-                        xf86XInputSetScreen(local, priv->screen_num,
-                                        samp.x,
-                                        samp.y);
+                        //xf86XInputSetScreen(local, priv->screen_num,
+                        //                samp.x,
+                        //                samp.y);
 
                         xf86PostMotionEvent (local->dev, TRUE, 0, 2,
                                         x, y);



c) study the ReadInput and change/force rotation for the touch part only.

static void ReadInput (InputInfoPtr local)
{
struct ts_priv *priv = (struct ts_priv *) (local->private);
struct ts_sample samp;
int ret;
int x,y;
ScrnInfoPtr pScrn = xf86Screens[priv->screen_num];
Rotation rotation = rrGetScrPriv (pScrn->pScreen) ? RRGetRotation(pScrn->pScreen) : RR_Rotate_0;
struct timeval now;

while((ret = ts_read(priv->ts, &samp, 1)) == 1) {
gettimeofday(&now, NULL);
struct timeval pressureTime = TimevalDiff(now,priv->button_down_start);

if(samp.pressure) {
int tmp_x = samp.x;

switch(priv->rotate) {
case TSLIB_ROTATE_CW: samp.x = samp.y;
samp.y = priv->width - tmp_x;
break;
case TSLIB_ROTATE_UD: samp.x = priv->width - samp.x;
samp.y = priv->height - samp.y;
break;
case TSLIB_ROTATE_CCW: samp.x = priv->height - samp.y;
samp.y = tmp_x;
break;
default: break;
}

tmp_x = samp.x;

switch(rotation) {
case RR_Rotate_90:
samp.x = (priv->height - samp.y - 1) * priv->width / priv->height;
samp.y = tmp_x * priv->height / priv->width;
break;
case RR_Rotate_180:
samp.x = priv->width - samp.x - 1;
samp.y = priv->height - samp.y - 1;
break;
case RR_Rotate_270:
samp.x = samp.y * priv->width / priv->height;
samp.y = (priv->width - tmp_x - 1) * priv->height / priv->width;
break;
}

priv->lastx = samp.x;
priv->lasty = samp.y;
x = samp.x;
y = samp.y;

xf86XInputSetScreen(local, priv->screen_num,
samp.x,
samp.y);

xf86PostMotionEvent (local->dev, TRUE, 0, 2,
x, y);

}

d) Change/add Xorg.conf to actually use the touch driver, see  "InputClass" section

# This is a minimal sample config file, which can be copied to
# /etc/X11/xorg.conf in order to make the Xorg server pick up
# and load xf86-video-fbturbo driver installed in the system.
#
# When troubleshooting, check /var/log/Xorg.0.log for the debugging
# output and error messages.
#
# Run "man fbturbo" to get additional information about the extra
# configuration options for tuning the driver.

Section "Device"
        Identifier      "A20 FBTURBO"
        Driver          "fbturbo"
        Option          "fbdev" "/dev/fb0"
        Option          "SwapbuffersWait" "true"
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection

Section "DRI"
Mode 0666
EndSection

Section "InputClass"
Identifier "Sunxi-Touchscreen"
MatchDevicePath "/dev/input/event*"
MatchProduct "sunxi-ts"
Driver "tslib"
EndSection

e) Reboot or re-start X11

e) Before you use the tslib driver we will need to calibrate it (yes, we know capacitive does not need calibration), the driver uses the file /etc/pointer and it need some calibration values.
This is done by the tslib-1.0. Grab the code and compile it.

For this you run ts_calibrate that will create /etc/pointer, but before you run ts_calibrate you have to identify which input is active for the touch, look in dmesg after you reboot.
After finding the correct input event used, export it to ts_calibrate get the events from the touch. 

export TSLIB_TSDEVICE=/dev/input/event4 (or you current input event number)
./ts_calibrate

Touch the points in screen, if everything is right you get /etc/pointer with some coordinates.
If ts_calibrate crashes you need to review the patch c) , if you touch the screen and you don't get anything, please check again the correct input event number.

I would advise you to make TSLIB driver works first as normal touch (not rotated) and then change the code to rotate against screen.

Hope this helps, good luck!

* Small update:

MatchProduct "gt911_DB" or "gt911_DBx" or "gt9xxf_ts"
(01-17-2017, 06:29 PM)@lex Wrote: [ -> ]
(01-17-2017, 02:47 PM)Workaholic Wrote: [ -> ]
(01-17-2017, 11:16 AM)dkryder Wrote: [ -> ]yeah , that is rather interesting work on connector. so, i guess you got to experience the china express option on your package?

Actually, fine soldering isn't big deal for me, but I have no idea how to rotate LCD against TP in software.  Blush
Unfortunately GT911 has no registers to configure it, so I guess it can be done somewhere in Android only.
So, I'm going to experiment with rooted version.
Guys, who knows, please advise me right way. 

Andrey d;-)

You could try the following:

Android does rotate the Screen and Touch by software (in Java, this is slow and it is compensated by the fast HW blitting), you could modify the touch part only and rebuild the Android.

You cannot rotate screen as we usually do it in Intel but you could cheat the TSLIB in doing a rotation against the screen.

Capacitive touch are in absolute coordinate so there is no need for calibration (most of the times), but you could
compile and use TSLIB driver just like the old days (used for resistive touch), it works i usually use this driver for my capacitive touch experiments.

This is not going to be easy if you use Ubuntu, they dropped support long ago but you can grab the Debian version or use Debian for this but i cannot guarantee this will work as you expect but worth a try.

#####################################
#####################################

Hope this helps, good luck!
Thanks a lot @lex for the detailed explanation, but this way seems to be too difficult for me.
I was under impression that could be a simpler way, something like it is for RPi:
http://raspberrypi.stackexchange.com/que...n-rotation
My skills yet too weak to make a fork of the Android kernel and compiling it with the modified drivers as you suggest.  Sad
This may just kill whole time that I have for the experiments now, so I'll try this way later, for sure.

P.S. seems it already becomes off topic for the LCD Technical Documentation subj, sorry...