terminal+touch input without X

Moderators: mdrjr, odroid

terminal+touch input without X

Unread postby fvolk » Sun Dec 10, 2017 3:12 am

The Wiki shows how to redirect a text terminal and how to do X.

I would like to have a simple text terminal (with selectable monospace font) and touch input (reporting of cell touched with stylus).

Is this possible with a minimal server configuration, and without installing all the X packages and dependencies?
It seems according to the Wiki xinput_calibrator is required to enable touch input...
fvolk
 
Posts: 181
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, HC1

Re: terminal+touch input without X

Unread postby mad_ady » Sun Dec 10, 2017 4:02 am

The input registers as a /dev/input device and you can find it with evtest:
Code: Select all
sudo evtest
No device specified, trying to scan all of /dev/input/event
Available devices:
/dev/input/event0:      C-Media USB Headphone Set
/dev/input/event1:      cec_input
/dev/input/event2:      vt-input
/dev/input/event3:      SX865X Touchscreen
/dev/input/event4:      USB 2.0 Camera
/dev/input/event5:      meson-ir


Back in the day there was a thing called gpm which would provide a console mouse for things like mc: https://wiki.archlinux.org/index.php/co ... se_support
See if it does the job for you.
User avatar
mad_ady
 
Posts: 4710
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: terminal+touch input without X

Unread postby fvolk » Mon Jul 02, 2018 3:58 am

ok, with 18.04 out, let's try this again.

What I've figured out so far:
1) boot.ini: nographics 1 -> disables X, gives a textconsole
2) load LCD kernel modules
3) switch on LCD
4) chvt 1 -> switch from log to console 1
5) setfont /usr/share/consolefonts/Uni2-Terminus12x6.psf.gz
6) systemctl restart getty@tty1
7) login by USB keyboard
8) start a program manually

What is still missing, I only want a minimal server with a touch/status display for some interaction.
* Does this also work with the minimal image?
* do all the necessary init above on boot automatically
* instead of text console that waits for user login start automatically a program of my choosing on the terminal
* allow my program touch interaction, the 4 buttons are not enough (only use one button for display on/off)
* touches on display border/corners are enough, doesn't have to be cell accurate
* switch USB keyboard to different layout than US (if USB keyboard connected on rare occasions)

...anyone with experiences? :-)
Attachments
lcd_mc.jpg
lcd_mc.jpg (104.87 KiB) Viewed 374 times
fvolk
 
Posts: 181
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, HC1

Re: terminal+touch input without X

Unread postby mad_ady » Mon Jul 02, 2018 4:51 am

fvolk wrote:ok, with 18.04 out, let's try this again.

What I've figured out so far:
1) boot.ini: nographics 1 -> disables X, gives a textconsole
2) load LCD kernel modules

You can place the modules in /etc/modules-load.d/modules.conf
3) switch on LCD
4) chvt 1 -> switch from log to console 1
5) setfont /usr/share/consolefonts/Uni2-Terminus12x6.psf.gz
6) systemctl restart getty@tty1
7) login by USB keyboard
8) start a program manually

What is still missing, I only want a minimal server with a touch/status display for some interaction.
* Does this also work with the minimal image?

It should work, yes.
* do all the necessary init above on boot automatically

You can create a systemd service that runs the commands for you
* instead of text console that waits for user login start automatically a program of my choosing on the terminal

You will need to edit the getty service for vty 1 to log you in and run a program. This might help, though it's not for systemd: https://askubuntu.com/questions/175248/ ... -text-mode
* allow my program touch interaction, the 4 buttons are not enough (only use one button for display on/off)
* touches on display border/corners are enough, doesn't have to be cell accurate

You can extend the functions of the buttons to support double/triple click or key combinations, longpress with this script: https://github.com/mad-ady/multibutton
For touch support, enable gpm: https://wiki.archlinux.org/index.php/Ge ... pose_mouse
* switch USB keyboard to different layout than US (if USB keyboard connected on rare occasions)

...anyone with experiences? :-)


Try this: https://askubuntu.com/questions/342066/ ... e-keyboard
User avatar
mad_ady
 
Posts: 4710
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: terminal+touch input without X

Unread postby fvolk » Sun Jul 08, 2018 5:21 am

Thank you for your suggestions. Insights so far:

The minimal image works for the LCD fine.

Changing console fonts in '/etc/default/console-setup' and then run 'setupcon' once works.

Changing '/etc/default/keyboard' and then run 'dpkg-reconfigure keyboard-configuration' once works.

Install of gpm -> I do get a mouse-like interaction in 'mc', but it seems to be very coarse and/or not calibrated, so not very reliable - I have to test this some more.

If I login via SSH and load the LCD kernel modules manually and enable them, I get a login screen - see picture.

If I put the modules in /etc/modules-load.d/modules.conf for autoload I get... a shutdown/reboot screen? - see picture.
Attaching keyboard does not seem to do anything, no usable console.
Attachments
lcd_auto.png
lcd_auto.png (122.61 KiB) Viewed 315 times
lcd_noauto.png
lcd_noauto.png (39.93 KiB) Viewed 315 times
fvolk
 
Posts: 181
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, HC1

Re: terminal+touch input without X

Unread postby mad_ady » Sun Jul 08, 2018 1:48 pm

Very strange. Can you try @fourdee's install script for the screen?
User avatar
mad_ady
 
Posts: 4710
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1

Re: terminal+touch input without X

Unread postby fvolk » Sun Jul 08, 2018 5:08 pm

Fourdee's script is outdated as the path for the controls have changed and I have no X.
But looking what's done there:

Only the modules go into /etc/modules:
Code: Select all
aml_i2c
pwm-meson
pwm-ctrl
fbtft_device
flexfb
sx865x

but the module parameters are in /etc/modprobe.d/odroid-lcd35.conf
Code: Select all
options fbtft_device name=flexpfb rotate=270
options flexfb chip=ili9488


The fixed /etc/systemd/system/odroid-lcd35.service is:
Code: Select all
[Unit]
Description=Odroid LCD 3.5

[Path]
PathExists=/dev/fb2

[Service]
Type=oneshot
RemainAfterExit=yes
StandardOutput=tty
ExecStart=/bin/bash -c 'echo 500000 > /sys/devices/pwm-ctrl/freq0'
ExecStart=/bin/bash -c 'echo 1 > /sys/devices/pwm-ctrl/enable0'
ExecStart=/bin/bash -c 'echo 1023 > /sys/devices/pwm-ctrl/duty0'
ExecStart=/usr/bin/setterm -blank 0
# -powersave off
#ExecStart=/bin/con2fbmap 1 2
ExecStop=/bin/bash -c 'echo 0 > /sys/devices/pwm-ctrl/duty0'

[Install]
WantedBy=multi-user.target


Note that I had to comment out some things, otherwise - see screenshot. What does -powersave additionally do, blank 0 seems to be enough to prevent sleep without input? con2fbmap does not seem to be needed because I have no X?

Remaining challenges:
* Sometimes I get additional log output on console (from systemd?)
* Autostart my program instead of login console.
* Some way to calibrate the LCD without X, mouse provided by gpm seems to be several cells off - however for human finger in LCD corner/edge detection it is probably good enough...

FYI, C2 idle with LCD on -> 2.6W, LCD off -> 2.35W
Attachments
lcd_con2fbmap.png
lcd_con2fbmap.png (54.67 KiB) Viewed 288 times
fvolk
 
Posts: 181
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, HC1

Re: terminal+touch input without X

Unread postby mad_ady » Sun Jul 08, 2018 6:29 pm

I haven't tried fourdee's script on 18.04. You should also post the fix to fourdee's thread.

Regarding suppressing log messages - you need to change in boot.ini and point console from setenv condev "console=ttyS0,115200n8 console=tty0" to setenv condev "console=ttyS0,115200n8 console=tty4" instead.

Regarding starting a program instead of login - try this:
https://lists.debian.org/debian-user/20 ... 01026.html
User avatar
mad_ady
 
Posts: 4710
Joined: Wed Jul 15, 2015 5:00 pm
Location: Bucharest, Romania
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1


Return to 3.5inch LCD Shield

Who is online

Users browsing this forum: No registered users and 1 guest