ti_am335x_tsc.c driver

Hello all,

The TI touch screen driver does not work right with the libts-bin package
in the jessie image.

$ cat /etc/dogtag
BeagleBoard.org Debian Image 2018-01-01

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.10 (jessie)
Release: 8.10
Codename: jessie

$ dpkg -l | grep libts-bin
ii libts-bin 1.14-1rcnee0~jessie+20171122 armhf touch screen library utilities

$ sudo ts_calibrate
ts_setup: No such file or directory

It is possible to make it work by setting the TSLIB_TSDEVICE environment
variable:

$ sudo su

export TSLIB_TSDEVICE=/dev/input/event2

ts_calibrate

But, that’s a bit of a pain since the environment variable always needs to
be set in order to use the touchscreen.

It appears that this version of the utilities uses the INPUT_PROP_DIRECT
propbit to automatically detect which /dev/input/event device is the touchscreen.

It looks like the following is the only change needed to make it work.

Unfortunately, I don’t have currently have a way to build a custom kernel
for the BeagleBone in order to test it. If there is anyone that could I would
appreciate it.

Regards,
Hartley

Give this a test:

wget http://rcn-ee.online/builds/linux-image-4.4.91-ti-r141.1_1cross_armhf.deb

sudo dpkg -i linux-image-4.4.91-ti-r141.1_1cross_armhf.deb

src:
https://github.com/RobertCNelson/ti-linux-kernel-dev/commit/39cf0016bff73697ee59783e5747b49f128fea5b

Regards,

Hi Robert,

That appears to work.

With the 4.4.91-ti-r133 kernel I had to do this to run the libts-bin utilities:

$ sudo TSLIB_TSDEVICE=/dev/input/event2 ts_calibrate
$ sudo TSLIB_TSDEVICE=/dev/input/event2 ts_test

With the 4.4.91-ti-r141.1 kernel the utilities now work with just:

$ sudo ts_calibrate
$ sudo ts_test

Thanks!

Unfortunately, this didn’t fix the problems I see with SDL1.2 and pygame.

It appears the 1.2.15+dfsg1-4 version of libsdl1.2debian has support for tslib
removed since that package is not available in the “normal” jessie repos.

It looks like you are providing tslib from you repos:

$ dpkg -l | grep libts
ii libts-bin 1.14-1rcnee0~stretch+20171122 armhf touch screen library utilities
ii libts0:armhf 1.14-1rcnee0~stretch+20171122 armhf touch screen library

Any chance you could provide a libsdl1.2debian package that works with tslib?

I can go back to a wheezy image but I would rather use a newer one.

Thanks,
Hartley

Grrr… This is a bigger can of worms than I thought…

libsdl1.2debian is available in wheezy, jessie, stretch, buster, and sid but the
package is compiled differently on each system.

wheezy has:
libsdl1.2debian version 1.2.15-5 with libdirectfb-1.2.9 and libts-0.0-0
This version should work without X and provide working touchscreen support.

jessie has:
libsdl1.2debian version 1.2.15-10+b1 with libdirectfb-1.2-9
This version should work without X but the touchscreen support is broken.
libts is also not available.

stretch has:
libsdl1.2debian version 1.2.15+dfsg1-4
This version probably will not work without X.
libdirectfb-1.2-9 is available but libts is not.

buster has:
libsdl1.2debian version 1.2.15+dsfg2-0.1

This version probably will not work without X.
libdirectfb-1.2-9 is not avaialble but libts0 is.

sid has:
libsdl1.2debian version 1.2.15+dsfg2-0.1

This version probably will not work without X.

libdirectfb-1.2-9 is available but not for armhf, libts0 is.

So… It looks like the only version that will work with the touchscreen without X
is wheezy. Ugh…

Hartley

Grrr... This is a bigger can of worms than I thought...

libsdl1.2debian is available in wheezy, jessie, stretch, buster, and sid but
the
package is compiled differently on each system.

wheezy has:
libsdl1.2debian version 1.2.15-5 with libdirectfb-1.2.9 and libts-0.0-0
This version should work without X and provide working touchscreen support.

jessie has:
libsdl1.2debian version 1.2.15-10+b1 with libdirectfb-1.2-9
This version should work without X but the touchscreen support is broken.
libts is also not available.

I looked at this last night, it'll be pretty easy to re-add
libts-0.0-0 support..

stretch has:
libsdl1.2debian version 1.2.15+dfsg1-4
This version probably will not work without X.
libdirectfb-1.2-9 is available but libts is not.

haven't looked at this yet, but i'll fix it too...

buster has:
libsdl1.2debian version 1.2.15+dsfg2-0.1
This version probably will not work without X.
libdirectfb-1.2-9 is not avaialble but libts0 is.

sid has:
libsdl1.2debian version 1.2.15+dsfg2-0.1
This version probably will not work without X.
libdirectfb-1.2-9 is available but not for armhf, libts0 is.

So... It looks like the only version that will work with the touchscreen
without X
is wheezy. Ugh...

Regards,

Just as a follow up…

I tried an old wheezy image I had:
bone-debian-7.11-console-armhf-2016-06-15-2gb.img.xz

That image is pretty bare bones so I had to install a number of packags.
Just for completeness these are what I installed:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install locales

$ sudo dpkg-reconfigure locales ← set the correct locale to avoid other issues, I used en_US.UTF-8
$ sudo apt-get install git gcc g++ python libts-0.0-0 libts-bin python-pygame

This image has an old kernel:

$ uname -a
Linux beaglebone 3.8.13-bone80 #1 SMP Wed Jun 15 17:03:55 UTC 2016 armv7l GNU/Linux

So, now figure out what the touchscreen device node is:

$ ls /dev/input/by-path/ -la | grep tsc
lrwxrwxrwx 1 root root 9 Jan 1 2000 platform-tsc-event → …/event1

Now calibrate and test the touchscreen:

$ sudo TSLIB_TSDEVICE=/dev/input/event1 ts_calibrate
$ sudo TSLIB_TSDEVICE=/dev/input/event1 ts_test

Yeah! It appears to work (FYI, my screen is a 4DCAPE-70T).

I then tried this simple pygame python script:

$ cat test.py
#!/usr/bin/python
import pygame
import os

os.putenv(‘SDL_MOUSEDRV’, ‘TSLIB’)
os.putenv(‘SDL_MOUSEDEV’, ‘/dev/input/event1’)

pygame.init()
screen = pygame.display.set_mode((800, 480))
done = False

while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
done = True

pygame.display.flip()

$ sudo ./test.py

Success! (At least with wheezy…)

Note, this was done without any editing of the /boot/uEnv.txt so there are a number
of bone_capemgr issues in the dmesg output:

$ dmesg | grep bone
[ 0.000000] Linux version 3.8.13-bone80 (root@a3-imx6q-wandboard-2gb) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Wed Jun 15 17:03:55 UTC 2016
[ 0.545517] bone-capemgr bone_capemgr.9: Baseboard: ‘A335BNLT,00C0,5014BBBK0A84’
[ 0.545570] bone-capemgr bone_capemgr.9: compatible-baseboard=ti,beaglebone-black
[ 0.569663] bone-capemgr bone_capemgr.9: slot #0: ‘4D 7.0 LCD CAPE- 4DCAPE-70T ,00A3,4D SYSTEMS ,BB-BONE-LCD7-01’
[ 0.600250] bone-capemgr bone_capemgr.9: slot #1: No cape found
[ 0.637359] bone-capemgr bone_capemgr.9: slot #2: No cape found
[ 0.674468] bone-capemgr bone_capemgr.9: slot #3: No cape found
[ 0.680689] bone-capemgr bone_capemgr.9: slot #4: specific override
[ 0.680711] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 4
[ 0.680726] bone-capemgr bone_capemgr.9: slot #4: ‘Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G’
[ 0.680808] bone-capemgr bone_capemgr.9: slot #5: specific override
[ 0.680827] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 5
[ 0.680841] bone-capemgr bone_capemgr.9: slot #5: ‘Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI’
[ 0.680920] bone-capemgr bone_capemgr.9: slot #6: specific override
[ 0.680937] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 6
[ 0.680952] bone-capemgr bone_capemgr.9: slot #6: ‘Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN’
[ 0.681272] bone-capemgr bone_capemgr.9: loader: before slot-0 BB-BONE-LCD7-01:00A3 (prio 0)
[ 0.681287] bone-capemgr bone_capemgr.9: loader: check slot-0 BB-BONE-LCD7-01:00A3 (prio 0)
[ 0.681363] bone-capemgr bone_capemgr.9: loader: before slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.681376] bone-capemgr bone_capemgr.9: loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.681446] bone-capemgr bone_capemgr.9: loader: before slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.681458] bone-capemgr bone_capemgr.9: loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.681492] bone-capemgr bone_capemgr.9: initialized OK.
[ 0.681961] bone-capemgr bone_capemgr.9: loader: after slot-0 BB-BONE-LCD7-01:00A3 (prio 0)
[ 0.681981] bone-capemgr bone_capemgr.9: slot #0: Requesting part number/version based 'BB-BONE-LCD7-01-00A3.dtbo
[ 0.681996] bone-capemgr bone_capemgr.9: slot #0: Requesting firmware ‘BB-BONE-LCD7-01-00A3.dtbo’ for board-name '4D 7.0 LCD CAPE- 4DCAPE-70T ', version ‘00A3’
[ 0.682015] bone-capemgr bone_capemgr.9: slot #0: dtbo ‘BB-BONE-LCD7-01-00A3.dtbo’ loaded; converting to live tree
[ 0.682575] bone-capemgr bone_capemgr.9: slot #0: #4 overlays
[ 0.684401] bone-capemgr bone_capemgr.9: loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.686265] bone-capemgr bone_capemgr.9: loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.691385] bone-capemgr bone_capemgr.9: loader: before slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.691400] bone-capemgr bone_capemgr.9: loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.691417] bone-capemgr bone_capemgr.9: loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.692094] usb usb1: Manufacturer: Linux 3.8.13-bone80 musb-hcd
[ 0.693436] bone-capemgr bone_capemgr.9: slot #0: Applied #4 overlays.
[ 0.693452] bone-capemgr bone_capemgr.9: loader: done slot-0 BB-BONE-LCD7-01:00A3 (prio 0)
[ 0.693492] bone-capemgr bone_capemgr.9: loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.693518] bone-capemgr bone_capemgr.9: loader: check slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.693532] bone-capemgr bone_capemgr.9: loader: after slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.693555] bone-capemgr bone_capemgr.9: slot #5: Requesting firmware ‘cape-boneblack-hdmi-00A0.dtbo’ for board-name ‘Bone-Black-HDMI’, version ‘00A0’
[ 0.693586] bone-capemgr bone_capemgr.9: slot #5: dtbo ‘cape-boneblack-hdmi-00A0.dtbo’ loaded; converting to live tree
[ 0.694138] bone-capemgr bone_capemgr.9: slot #5: BB-BONELT-HDMI conflict P8.45 (#0:BB-BONE-LCD7-01)
[ 0.703711] bone-capemgr bone_capemgr.9: slot #5: Failed verification
[ 0.710451] bone-capemgr bone_capemgr.9: loader: failed to load slot-5 BB-BONELT-HDMI:00A0 (prio 1)
[ 0.719926] bone-capemgr bone_capemgr.9: loader: check slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.719940] bone-capemgr bone_capemgr.9: loader: after slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.719960] bone-capemgr bone_capemgr.9: slot #4: Requesting firmware ‘cape-bone-2g-emmc1.dtbo’ for board-name ‘Bone-LT-eMMC-2G’, version ‘00A0’
[ 0.719974] bone-capemgr bone_capemgr.9: slot #4: dtbo ‘cape-bone-2g-emmc1.dtbo’ loaded; converting to live tree
[ 0.720585] bone-capemgr bone_capemgr.9: slot #4: #2 overlays
[ 0.721154] bone-capemgr bone_capemgr.9: slot #4: Applied #2 overlays.
[ 0.721168] bone-capemgr bone_capemgr.9: loader: done slot-4 BB-BONE-EMMC-2G:00A0 (prio 1)
[ 0.721300] bone-capemgr bone_capemgr.9: loader: check slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.721384] bone-capemgr bone_capemgr.9: loader: after slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 0.721409] bone-capemgr bone_capemgr.9: slot #6: Requesting firmware ‘cape-boneblack-hdmin-00A0.dtbo’ for board-name ‘Bone-Black-HDMIN’, version ‘00A0’
[ 0.721434] bone-capemgr bone_capemgr.9: slot #6: dtbo ‘cape-boneblack-hdmin-00A0.dtbo’ loaded; converting to live tree
[ 0.721620] bone-capemgr bone_capemgr.9: slot #6: BB-BONELT-HDMIN conflict P8.45 (#0:BB-BONE-LCD7-01)
[ 0.731291] bone-capemgr bone_capemgr.9: slot #6: Failed verification
[ 0.738031] bone-capemgr bone_capemgr.9: loader: failed to load slot-6 BB-BONELT-HDMIN:00A0 (prio 2)
[ 48.826031] usb usb2: Manufacturer: Linux 3.8.13-bone80 musb-hcd

Also, one strange issue I had.

I previously updated the bootloader on the eMMC when I was testing with Debian 9. In order
to get the BeagleBone to boot from the SD-Card I had to hold in the button when it was powered
on. I never had to do this before.

This is the output of /opt/scripts/tools/versions.sh

$ cd /opt/scripts/tools
$ git pull

$ sudo ./version.sh | grep bootloader
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2016.03-00001-g148e520]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.01-rc3-00002-gb33224]

The next time I powered on the board I didn’t have to hold the button.

Strange…

Regards,

Hartley

Okay, this was just built and pushed out to the repo:

from the build log:

checking for OpenGL (GLX) support... yes
checking for Linux 2.4 unified input interface... yes
checking for Touchscreen library support... yes

If it works, i'll start hacking on stretch. :wink:

Regards,

I’m setting up a jessie system right now starting from this image:
bone-debian-8.6-console-armhf-2016-09-18-2gb.img.xz

I’m following the same steps I wen through for wheezy.

I assume the libsdl and libts packages will automatically come
from your repo, correct?

What versions should I expect to see?

Thanks,
Hartley

Uh… not sure if this is a problem…

On the initial ‘sudo apt-get upgrade’ with the 8.6-console image
I got this:

Processing triggers for libc-bin (2.19-18+deb8u10) …
Processing triggers for ca-certificates (20141019+deb8u3) …
Updating certificates in /etc/ssl/certs… 0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d…done.
Processing triggers for initramfs-tools (0.120+deb8u3-1rcnee0~bpo80+20170219) …

update-initramfs: Generating /boot/initrd.img-4.4.21-ti-r45
cp: cannot stat ‘/etc/modprobe.d/*’: No such file or directory

Another ‘sudo apt-get upgrade’ says that there is nothing to upgrade but I
don’t know if the cp issue above is going to be a problem.

Regards,
Hartley

Well, I must be doing something wrong…

When I installed libsdl1.2debian I ended up getting:

$ dpkg -l | grep libsdl1.2debian
ii libsdl1.2debian:armhf 1.2.15-10+b1 armhf Simple DirectMedia Layer

And that version did not have libts as a dependency.

If I understand the output of ‘apt-cache showpkg libsdl1.2debian’, there should
be a 1.2.15-10rcnee0~jessie+20180105 version available but i don’t know how
I get it to install.

I’m out for now. I’ll look into this more on Monday.

Thanks,
Hartley

Well, I must be doing something wrong..

When I installed libsdl1.2debian I ended up getting:
$ dpkg -l | grep libsdl1.2debian
ii libsdl1.2debian:armhf 1.2.15-10+b1

Oh i missed that "+b1" it was a rebuild, thus my version won't install
over debian's..

rebuilding now. :wink:

Regards,

and pushed out..

Regards,

Thanks! I’ll test it on Monday and let you know how it goes.

Hartley

Hi Robert,

Just upgraded the libsdl library on jessie:

$ dpkg -l | grep libsdl1.2
ii libsdl1.2debian:armhf 1.2.15-11rcnee0~jessie+20180105 armhf Simple DirectMedia Layer

$ dpkg -l | grep libts
ii libts-bin 1.14-1rcnee0~jessie+20171122 armhf touch screen library utilities
ii libts0:armhf 1.14-1rcnee0~jessie+20171122 armhf touch screen library

With this libts I can calibrate and test the 4DCAPE-70T touchscreen.
It’s not quite as stable as on wheezy. Occasionally I will be some bad touch samples but this is probably
related to the ti-tsc kernel driver not libts. I need to look into the driver differences between the kernel.

After calibration the sample pygame python script also works (with the occasional bad touch sample).

Thanks for doing this!

If you get these libraries working on stretch I’ll test those also.

On other question, how big of a deal would it be to get qt-embedded working on wheezy, jessie, or stretch?
As far as I can tell, that package was only available on the Angstrom images.

I can deal with using pygame for my console programs but Qt would be a lot nicer!

Thanks again!

Hartley

ubuntu@arm
   OS: Ubuntu 16.04 xenial
   Kernel: armv7l Linux 4.15.0-bone2.1
   Uptime: 56m
   Packages: 418
   Shell: 14888
   CPU: ARMv7 rev 2 (v7l) @ 1GHz
   RAM: 47MiB / 491MiB

uname -a
Linux arm 4.15.0-bone2.1 #1 Tue Jan 30 11:48:09 GMT 2018 armv7l armv7l armv7l GNU/Linux
ubuntu@arm:~$ ts_calibrate
ts_setup: No such file or directory