This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Writing text to a graphical console device

We have a custom AM335x board. I want to write text to the LCD screen, e.g.
echo "text" > /dev/tty0

During kernel boot-up I see the message:
Console: switching to colour frame buffer device 100x37


So presumably with a frambuffer device configured for a particular font it should be possible to display text to the LCD.
However, I don't know where my LCD text-device is mapped in the /dev folder. I have a frambuffer device at /dev/fb0, but it doesn't display text directly if I echo to it. I can just display images to it using the fbv program.
I've tried most of the nodes in /dev/, e.g. tty0-6, ttyO0-6 (0 is my serial console), vcs, vcsa...


I was told to check for an fbcon device. There's no node called fbcon, but I found it here:
bash-4.2# ls /sys/class/graphics/
fb0  fbcon
bash-4.2# ls /sys/class/graphics/fbcon
cursor_blink  power  rotate  rotate_all  subsystem  uevent
I set cursor_blink to 1, to see if I'd get a cursor displayed, but there's none visible. I've built U-Boot with splash screen support and it's able to display console messages to the LCD, so I know it works and should be possible. However, I can't figure out how to do it from Linux.
I also had a look at the virtual console devices:
bash-4.2# ls /sys/class/vtconsole/vtcon0/
bind  name  power  subsystem  uevent
bash-4.2# cat  /sys/class/vtconsole/vtcon0/name
(S) dummy device
bash-4.2#
bash-4.2# cat  /sys/class/vtconsole/vtcon1/name
(M) frame buffer device
but that's not given me anymore clues... and I'm not sure that doing bind/unbind is going to give me somewhere to write text to.

Is there a default graphical console device that AM335x writes to?

  • Hi Adri,

    Yes, It is possible.

    Please refer the following thread. May be you have look into linux menuconfig to enable appropriate options.

    http://e2e.ti.com/support/embedded/linux/f/354/t/324198.aspx

  • I did do that, enabled that in the kernel and also tried passing in fbcon=map:0. I didn't want main console redirected to fb0 though.

    Turned out that Xfbdev that we were starting in systemd was taking control of /dev/fb0. When I disabled that process, I was able to type to the LCD console using /dev/tty0 and /dev/tty1.

    The problem now though is that since the touchscreen was being controlled by Xfbdev, that the screen backlight times out, but there's no process there to enable the screen again.

    Any ideas how to turn on the screen again after it blanks out?

    I've tried:

    echo "1" > /sys/class/graphics/fb0/blank

    and the brightness is still set to max:

    bash-4.2# cat  /sys/class/backlight/pwm-backlight/brightness                                                                                   
    100

  • Hi Adri,

    Are you running X server on your board ?

    If you are running X sever then you can't write text to LCD.

    Turned out that Xfbdev that we were starting in systemd was taking control of /dev/fb0. When I disabled that process, I was able to type to the LCD console using /dev/tty0 and /dev/tty1.

    Why don't you try to restart the process.

    try to restart the X sever if any.

    Have you tried the below command ever ?

    Xfbdev -screen 800x480x60 -ac -mouse tslib,,device=/dev/input/event0 -mouse mouse -keybd keyboard &

  • Hi, yes I believe that xserver command is what was running in the systemd process:

    ExecStart=/usr/bin/Xfbdev -nolisten tcp -noreset -nocursor -screen 800x600x16 -dpi 95 -fb /dev/fb0 -mouse tslib

    I have that disabled now. As I don't need anything to display to the Xserver for this.

    I've noticed that I don't need fbcon=map:0 option in bootargs, as long as the xserver is not running, both /dev/tty0 and /dev/tty1 are able to write text to the LCD.

    I'm using setterm -blank 0 > /dev/tty0 < /dev/tty0 to stop the screen timeout. I'm not going to bother with trying to read the touchscreen input for that, as I'm doing this for the test-team so they're able to see that the display screen is operational all the time they're performing other tests.