RO1 : No software cursor displayed on fbcon

Has anyone figured out how to get the fbcon software cursor to display when logging in without starting X?

Ideally, it should display when apps like nano, vim, or emacs are launched and once they are closed. ANy kind of editing from the console is pretty much impossible until this is sorted.

R

2 Likes

you’re looking for “gpm”

I should clarify that I’m not referring to the mouse cursor but to the console mode command line cursor, often referred to these days as the insertion point.

2 Likes

you’re looking for fbcon "no cursor" - Google Search :sweat_smile:

it might need a kernel recompile if it’s a hardware graphics issue…

I have not worked this out yet, and it also affects gpm (which does not work by default on my R01, although I’ve updated my keyboard firmware, which may have affected the device tree for the mouse… I’ve tried to get it working by modifying the config). Without a cursor, there’s no “pointer” for gpm or related tools to move around the console.

I don’t see any cursor-related options in the kernel config file that’s in /boot, and simply changing /sys/class/graphics/fbcon/cursor_blink to 1 doesn’t seem to have an effect for me.

I had a quick skim through some of the resources that show up on a Google search, and I’ve seen a (unvalidated) comment that Allwinner SoC doesn’t have hardware cursor, I’m not able to confirm that. I’ve also tried a few other things to no avail so far. Will keep researching…

3 Likes

Thanks @andypiper for digging into this. Its nearly impossible to do anything useful without X if the console can’t show a cursor. It would be really nice to have even a non-blinking cursor. Its really weird counting keystrokes to guess where the cursor now is. :smiley:

3 Likes

I think my next step, which may take a while, is to try to follow the Debian installation notes and even do a kernel compile, so I can take more of a look at what options are available. It’s a bit frustrating that the kernel is ~2-3 years old, it would be great to have up-to-date sources to build from.

Wondering whether the Clockwork Pi staff folks have any ability to help, beyond the existing wiki information they shared?

2 Likes

I have no problem with an old kernel so long as it works. Unless there is a missing command line switch or some other trick to turn on the cursor in console mode it doesn’t work. So maybe a fresher kernel will have that fixed.

2 Likes

Indeed, lack of blinking cursor, or more any cursor somewhat tripped me up first and is quite annoying. I suspect this is because the code that runs the console, drivers/video/fbdev/subxi new. It’s not in mainline OR android (eg drivers/video/fbdev - kernel/common - Git at Google OR linux/drivers/video/fbdev at master · smaeul/linux · GitHub - which is seems to be the point in the tree that they forked to make the d1 sdk OR smaeul’s tree thats looking at d1 support for mainline). The issue is that smaeul is targetting the Nezha board which is similar but different to our r01 board. The actual fb code seems to be in the sdk mirror that ccu made with the added r01 patches: last_linux-5.4/drivers/video/fbdev/sunxi at master · cuu/last_linux-5.4 · GitHub. So compiling your own newer kernel will involve probably taking smaeul’s tree as a start fro d1, understanding whats missing given smaeul says don’t merge , adding in the r01 patches (DevTerm/Code/patch/d1 at main · clockworkpi/DevTerm · GitHub), which are mostly small fixes, but does include the backlight driver, which is not in mainline and adding the sunxi fbdev, which is large:

thomas ~/devterm/last_linux-5.4/drivers/video/fbdev/sunxi (master u=)$ cloc .
     655 text files.
     641 unique files.                                          
      16 files ignored.

github.com/AlDanial/cloc v 1.92  T=1.30 s (492.6 files/s, 349080.2 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              286          25993          18031         257268
C/C++ Header                   339           6121          12997         133352
make                            16             88             37            332
-------------------------------------------------------------------------------
SUM:                           641          32202          31065         390952
-------------------------------------------------------------------------------

So all in all getting a “new” linux is quite a task. Googling the config for it CONFIG_FB_CONSOLE_SUNXI shows not many hits, however there is a pine64 reference, so there is hope someone will pick that up. Looking at the actual code shows that this is not new, and some files date back more than 5 years ago. We seem to have the CONFIG_LCD_SUPPORT_TFT08006 set, so inside that: drivers/video/fbdev/sunxi/disp2/disp/lcd. Really it should Allwinner pushing this into mainline.

2 Likes

Unfortunately Allwinner is rather slothful at getting docs and drivers out to the Linux community. By the time they get the D1 fully supported they will likely have moved two generations from the D1 into whatever they call the future SOC. I don’t think the R8 would be as well supported if it weren’t for the efforts of NTC’s folk in producing the CHIP. And last I looked that was the best supported SOC Allwinner makes.

Thanks for the links I was looking to download kernel source last night… and ran out of time hunting for them.

I’ve found one way to get a cursor from the console. Try this from the shell, while in console mode:

printf '\033[?24;64c'

On my R-01 it gives me a full cell green block cursor. That’s not what its supposed to do. Its supposed to be red. Trying variations I get some really weird results. So I’m still trying to figure out what’s going on. I found this escape sequence here:

But this is helpful! I can now use editors and edit the command line!

3 Likes

For me the cursor disappears when I run nano or vim so not a complete solution from what I can tell. Good progress though.

Hah! joe wins again! It keeps the cursor. Yes, this solution is the digital equivalent of bubble gum & bailing wire. I imagine anything that resets the terminal will turn the cursor off. It might help to wrap this into a script that is easily called. I also added it to my .bash_profile.

A real solution will likely require a patch to the kernel. I ran into that page I linked to while trying to figure out what /sys/class/graphics/fb0/cursor does. Writing to it likes to hang the shell on either the DevTerm or my x86 laptop. I finally found something that described it as the X,Y of the cursor… So I’m assuming that has to do with position and not whether or not its turned on. I still need to find the kernel source.

WARN: Anyone brave enough to try out joe should be aware it defaults to mostly WordStar (WS) keystrokes. It does have other emulations. Check the man page. Since the first commercial screen oriented text editor I acquired was WordStar on CP/M-80 it works for me. :wink: Well that and the long association with Borland language tools… which also used keystrokes similar to WS.

2 Likes

It is amazing. A cursor has appeared! :smiley:

2 Likes
printf '\033[?24;64c'

I am editing with ed because the cursor disappears in vi. :smiley:

1 Like

Ow! Try Joe. For those not familiar with the WordStar keys you can install the joe package and call either jpico for Pine’s PICO emulation or jmacs for emacs emulation.

Anyhow it leaves the cursor on, on my R-01.

Thanks, I try this.

You can just apt-get install joe. :slight_smile:

1 Like
  1. sudo apt install fbterm
  2. backup x-starting .bash_profile and replace it with:
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]] && [[ -z $FBTERM ]]; then
    FBTERM=1 exec fbterm
fi
  1. Update .bashrc (around line 66):
# If this is an xterm set the title to user@host:dir                                                                                                   case "$TERM" in                                                                                                                                        xterm*|rxvt*)                                                                                                                                              PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"                                                                                       ;;                                                                                                                                                 linux)                                                                                                                                                     [ -n "$FBTERM" ] && export TERM=fbterm                                                                                                                 ;;                                                                                                                                                 *)                                                                                                                                                         ;;                                                                                                                                                 esac 
  1. Edit ~/.fbtermrc
# Configuration for FbTerm

# Lines starting with '#' are ignored.
# Note that end-of-line comments are NOT supported, comments must be on a line of their own.


# font family names/pixelsize used by fbterm, multiple font family names must be seperated by ','
# and using a fixed width font as the first is strongly recommended
font-names=mono
font-size=14

# force font width (and/or height), usually for non-fixed width fonts
# legal value format: n (fw_new = n), +n (fw_new = fw_old + n), -n (fw_new = fw_old - n)
#font-width=
#font-height=

# default color of foreground/background text
# available colors: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white
color-foreground=7
color-background=0

# max scroll-back history lines of every window, value must be [0 - 65535], 0 means disable it
history-lines=1000

# up to 5 additional text encodings, multiple encodings must be seperated by ','
# run 'iconv --list' to get available encodings.
text-encodings=

# cursor shape: 0 = underline, 1 = block
# cursor flash interval in milliseconds, 0 means disable flashing
cursor-shape=1
cursor-interval=500

# additional ascii chars considered as part of a word while auto-selecting text, except ' ', 0-9, a-z, A-Z
word-chars=._-

# change the clockwise orientation angle of screen display
# available values: 0 = 0 degree, 1 = 90 degrees, 2 = 180 degrees, 3 = 270 degrees
screen-rotate=1

# specify the favorite input method program to run
input-method=

# treat ambiguous width characters as wide
#ambiguous-wide=yes

Log out from tty1. If you (still) have auto-login, you will be dropped into fbterm directly.

2 Likes

Try adding this to your kernel cmdline, you’ll get a white, highlighted,full block, non blinking cursor:

vt.cur_default=0xF00058

Remember to reboot your device.

2 Likes