User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

5" touchscreen calibration troubles.

Thu Mar 23, 2017 8:49 pm

Screen = Makibes 5" resistive hdmi video, SPI touch, XPT2046 chipset. As far as I know its a Waveshare clone.
Pi Zero with Raspbian Jessie from 03/17 fully updated.
All working fine except the calibration file seem to have no real effect.

/boot/config.txt has SPI and I2C enabled. and:

Code: Select all

dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150
as advised by many sites.

/etc/X11/xorg.conf.d/99-calibration.conf

Code: Select all

Section "InputClass"
    Identifier      "calibration"
    MatchProduct    "ADS7846 Touchscreen"
    Option   "Calibration"   "36150 63589 2799 63419"
EndSection
Apparently that should work, but it dont.
Now, having a look at the xorg logs it does seem to see the file.
here is the tail end of Xorg.0.log
without 99-calibration.conf:

Code: Select all

[    20.659] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/event0)
[    20.659] (**) ADS7846 Touchscreen: Applying InputClass "libinput touchscreen catchall"
[    20.660] (II) LoadModule: "libinput"
[    20.662] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[    20.704] (II) Module libinput: vendor="X.Org Foundation"
[    20.704] 	compiled for 1.18.4, module version = 0.20.0
[    20.704] 	Module class: X.Org XInput Driver
[    20.704] 	ABI class: X.Org XInput driver, version 22.1
[    20.704] (II) Using input driver 'libinput' for 'ADS7846 Touchscreen'
[    20.704] (**) ADS7846 Touchscreen: always reports core events
[    20.705] (**) Option "Device" "/dev/input/event0"
[    20.706] (**) Option "_source" "server/udev"
[    20.709] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is tagged by udev as: Touchscreen
[    20.709] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is a touch device
[    20.711] (**) Option "config_info" "udev:/sys/devices/platform/soc/20204000.spi/spi_master/spi0/spi0.1/input/input0/event0"
[    20.711] (II) XINPUT: Adding extended input device "ADS7846 Touchscreen" (type: TOUCHSCREEN, id 6)
[    20.713] (**) Option "AccelerationScheme" "none"
[    20.713] (**) ADS7846 Touchscreen: (accel) selected scheme none/0
[    20.713] (**) ADS7846 Touchscreen: (accel) acceleration factor: 2.000
[    20.713] (**) ADS7846 Touchscreen: (accel) acceleration threshold: 4
[    20.716] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is tagged by udev as: Touchscreen
[    20.716] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is a touch device
[    20.719] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/mouse0)
[    20.719] (II) No input driver specified, ignoring this device.
[    20.719] (II) This device may have been added with another device file.
and with 99-calibration.conf

Code: Select all

[    20.572] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/event0)
[    20.573] (**) ADS7846 Touchscreen: Applying InputClass "libinput touchscreen catchall"
[    20.573] (**) ADS7846 Touchscreen: Applying InputClass "calibration"                        #<------ difference
[    20.573] (II) LoadModule: "libinput"
[    20.574] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so
[    20.616] (II) Module libinput: vendor="X.Org Foundation"
[    20.616] 	compiled for 1.18.4, module version = 0.20.0
[    20.617] 	Module class: X.Org XInput Driver
[    20.617] 	ABI class: X.Org XInput driver, version 22.1
[    20.617] (II) Using input driver 'libinput' for 'ADS7846 Touchscreen'
[    20.617] (**) ADS7846 Touchscreen: always reports core events
[    20.617] (**) Option "Device" "/dev/input/event0"
[    20.618] (**) Option "_source" "server/udev"
[    20.621] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is tagged by udev as: Touchscreen
[    20.622] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is a touch device
[    20.624] (**) Option "config_info" "udev:/sys/devices/platform/soc/20204000.spi/spi_master/spi0/spi0.1/input/input0/event0"
[    20.624] (II) XINPUT: Adding extended input device "ADS7846 Touchscreen" (type: TOUCHSCREEN, id 6)
[    20.625] (**) Option "AccelerationScheme" "none"
[    20.625] (**) ADS7846 Touchscreen: (accel) selected scheme none/0
[    20.626] (**) ADS7846 Touchscreen: (accel) acceleration factor: 2.000
[    20.626] (**) ADS7846 Touchscreen: (accel) acceleration threshold: 4
[    20.628] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is tagged by udev as: Touchscreen
[    20.628] (II) input device 'ADS7846 Touchscreen', /dev/input/event0 is a touch device
[    20.631] (II) config/udev: Adding input device ADS7846 Touchscreen (/dev/input/mouse0)
[    20.632] (**) ADS7846 Touchscreen: Applying InputClass "calibration"
[    20.632] (II) No input driver specified, ignoring this device.
[    20.632] (II) This device may have been added with another device file.
Now then, do I see something lower down (last 7 lines of log file) overwriting the first instance and so the calibration is no longer applied.
If this is the case, what is doing it and can I either stop it or somehow calibrate that one?
>)))'><'(((<

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: 5" touchscreen calibration troubles.

Fri Mar 24, 2017 11:40 pm

Update...
Looking in /boot/overlays/README there are details of what parameters

Code: Select all

dtoverlay=ads7846
can take..and calibration is part of it, whoopie(ish)
Now, adding values for xmin,xmax,ymin,ymax does have some effect, but the results dont seem to relate too well to values obtained from the calibration utility....

Any ideas welcome, including syntax and value checking...

Code: Select all

dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150,xmin=10000,xmax=63202,ymin=3234,ymax=63498
y is nearly right, just fades a bit at top and bottom,but x is swapped....
>)))'><'(((<

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: 5" touchscreen calibration troubles.

Sat Mar 25, 2017 11:01 am

still confused....
in /boot/config.txt

Code: Select all

dtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=150,xmin=150,xmax=3800,ymin=200,ymax=3600
The first parameter after xohms works, but only the first, no matter which of xmin,xmax,ymin,ymax. The remainder are ignored.
>)))'><'(((<

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: 5" touchscreen calibration troubles.

Sun Mar 26, 2017 3:27 pm

RTFM
https://www.raspberrypi.org/documentati ... ce-tree.md

(Snarky enough? And yes, the answer is there... somewhere. ;))

Hint 2: Hint 1

Hint 3: Section 3.2

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: 5" touchscreen calibration troubles.

Sun Mar 26, 2017 4:15 pm

Nahh, it isnt.
(Snarky enough? And yes, the answer is there... somewhere. ;))
Thanks, plenty of snark, but.
Hint 2: Hint 1
Now, we are getting nowhere..
1st xmin=10000 barking value,, 150 is required but did have an effect:

Code: Select all

$sudo vcdbg log msg
...
001612.823: dtparam: xmin=150
001613.100: dtdebug: Found override xmin
001613.144: dtdebug:   override xmin: cell target ti,x-min @ offset 0 (size 2)
001613.918: dtparam: x=true
001614.236: dtdebug: /__overrides__ has no x property
001616.433: dtdebug: /__overrides__ has no x property
001616.447: Unknown dtparam 'x' - ignored
changed to

Code: Select all

$sudo vcdbg log msg
....
001612.509: dtparam: xmin=10000
001612.787: dtdebug: Found override xmin
001612.832: dtdebug:   override xmin: cell target ti,x-min @ offset 0 (size 2)
001613.597: dtparam: xmax=true
001613.892: dtdebug: Found override xmax
001613.936: dtdebug:   override xmax: cell target ti,x-max @ offset 0 (size 2)
xmax=-true????
Hint 3: Section 3.2
COAFB (thats rude btw)
Many thanks.

Now who the *&&^$^*(*&^% decide to hide a limit like that in what is best described as the small print.
*mutter mutter mutter*

Ahh, now I "see" the cut off in Hint2

Now, remind me, didnt we decide that character count limits were a bad idea, somewhere around the demise of DOS as a front end?????
>)))'><'(((<

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: 5" touchscreen calibration troubles.

Sun Mar 26, 2017 4:45 pm

First Law of System Programming: Never check for an error condition that you don't know how to handle.
Or in this case, don't bother reporting an error so deep in the pre-boot phase that nobody will ever see it. It might even only have the serial console available.

Variable size strings are always an issue in C, but I haven't seen an 80 character limit for ages. I haven't used less than 256 myself since VT100s died out and, without being able to report an error, I would probably rearrange the parser not to have a limit or rearrange the syntax to make it harder to construct a valid line that long.

If I was really obtuse I could have suggested setting speed to 9999. That would have given you one character for xmax. :D

User avatar
aTao
Posts: 1087
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: 5" touchscreen calibration troubles.

Sun Mar 26, 2017 5:00 pm

rurwin wrote:That would have given you one character for xmax. :D

Ohh, just what I always wanted, a character for Xmas..


Ok, so putting the excess in dtparam on the next line got me flying.

Is this a RaspberryPi thing, cant find any references to it in the rest of the world...
>)))'><'(((<

Return to “HATs and other add-ons”