uConsole - R-01 and RISC-V thread

A few quality of life items for true tty0 life.

Background: I took the full true ‘uConsole’ route where echo $TERM returns linux. No framebuffer, no TWM, no window manager. ( Well tmux but, a post on that later )

Truly drop any window manager and GUI


Per the excellent readme guidance:

  • I mv vs rm the cpi users .bash_profile
  • Dropped autologin ability by mv of the /etc/systemd/system/getty@tty1.service.d/ folder to a out of the way place /home/cpi/original/
  • enabled ssh
  • Took the liberty of adding my own user with ssh-keys and a password for actual interactive keyboard login

That said, I was having all sorts of issues seeing the text and the cursor was missing.

Overall here are a few quality of life tweaks that I applied and your experience may vary:

My eyes are not what they used to be!


I love the resolution and look of this display it is top notch. Yet my glasses or contacts just don’t correct my vision to experience the bash shell in its full glory on this excellent display. “computer zoom in, enhance”

vim /etc/default/console-setup

# CONFIGURATION FILE FOR SETUPCON

# Consult the console-setup(5) manual page.

ACTIVE_CONSOLES="/dev/tty[1-6]"

CHARMAP="UTF-8"

CODESET="Lat15"
FONTFACE="Fixed"
FONTSIZE="12x24"         ### <-- Magical setting for my eyes!

VIDEOMODE=

# The following is an example how to use a braille font
# FONT='lat9w-08.psf.gz brl-8x8.psf'

.bashrc add a prompt shape and color


echo `PROMPT_COMMAND='echo -e "\e[?16;0;16c"'` >> .bashrc

This will create a nice happy cyan block cursor with no blinks

Vim where is your cursor


create a .vimrc with the following

if &term =~ "linux"
  let &t_ve= "\e[?25h"
  let &t_vi= "\e[?25l"
  let &t_SI= "\e[?0c"
  let &t_EI= "\e[?16;143;255c"
endif

if &term =~ "xterm\\|rxvt"
  " use an orange cursor in insert mode
  let &t_SI = "\<Esc>]12;orange\x7"
  " use a red cursor otherwise
  let &t_EI = "\<Esc>]12;red\x7"
  silent !echo -ne "\033]12;red\007"
  " reset cursor when vim exits
  autocmd VimLeave * silent !echo -ne "\033]112\007"
  " use \003]12;gray\007 for gnome-terminal and rxvt up to version 9.21
endif

This does two things

  1. If you are using vim over SSH it will see your xterm or rxvt term and apply an nifty color scheme
  2. if you are on the local console you will have a nice visible cursor

OK I lied, I did try a window manager xfce4


There are myths on the internet that xfce4 can’t run in framebuffer only mode. Well that myth is solved in that xfce4 looks fantastic ( not speedy on a RISC-V with 1G RAM have you ) but, it ‘does’ work!!! :smiley:

startxfce4
2 Likes

Anyone having any luck with the fbturbo driver on uConsole?

I’ve been getting the following error in the journal & a completely garbled screen:

[G2D] (g2d_image_check) line:371: Invalid image parameter setting

@yatli is screen resolution is hard coded in fbturbo? uConsole’s screen resolution is diffrerent from DevTerm.

Yeah right… I hard coded the buffer sizes.
For anyone interested, here’s the hard coded values:

Also, we have to make sure 1280x720 is still within g2d image size limits.

2 Likes

Here is G2D Document (in Chinese), looks like they have example using 1920x1080…

1 Like

I’m definitely interested in trying alternatives to X but I did see a considerable performance boost after I created a 2Gb swap file on my SD card. It still takes forever to reboot because of the aforementioned issues with shutdown. I wonder if Armbian supports this CPU yet… has anyone looked? I have a star64 board in my lab but finding maintained OSes for it is a bit of a hassle.

For anyone who had a missing text cursor when booting without X, you can add this line to the end of the arguments in /boot/extlinux/extlinux.conf:
vt.cur_default=0xF00058

(mentioned in this DevTerm thread)

1 Like

I found OS image build instructions for the A06 and CM4 but not the R01. Does anyone know if/when these will be posted to the wiki? Also, am I right in understanding that the A06 image is based on Armbian?

So - I can get it working without rotating but can’t rotate for some reason. When I rotate it won’t initialize the framebuffer, seemingly.

Branch where I’m trying it.

2 Likes

Not sure, but try to swap xres/yres?
I vaguely remember that the source image is the shadow (“painting canvas”) and dst is the actual framebuffer that is displayed.
So if the screen is rotated, the shadow should have w=720,h=1280; but the actual framebuffer remains 1280x720.

1 Like

Yup, per the branch above I tried swapping them. I have tried a number of approaches, none of which end up showing the buffer correctly rotated.

Every time I try I just see the fbconsole again or nothing at all in some of the cases.

In dmesg I usually see [G2D] (g2d_image_check) line:371: Invalid imager parameter setting.

Interestingly, I even tried to NOT rotate by keeping everything the same with no rotation applied and still got the same behavior. I’m really not sure what layer the problem is at - the xorg driver or the kernel driver. Something seems to be really odd.

Also getting this in dmesg, probably related:

[ 4446.197091] [DISP] disp_ioctl,line:4027:
[ 4446.197095] incoming pointer of user is ERR or NULL
[ 4446.197106] [DISP] disp_ioctl,line:4031:
[ 4446.197111] layer number need to be set from 1 to 16
[ 4446.197116] [DISP] disp_ioctl,line:4031:
[ 4446.197119] layer number need to be set from 1 to 16
[ 4446.197124] [DISP] disp_ioctl,line:4031:
[ 4446.197127] layer number need to be set from 1 to 16

Where’s the sunxi g2d kernel driver?

1 Like

I’ve been having a ton of fun with my R01. I’ve switched from TWM to i3, and have also managed to compile Vim 9. :slight_smile:

I think the performance is absolutely fine for most things ‘dev’. Obviously graphic intensive applications will struggle, but I’ve found pretty much everything else to be satisfactory, given the circumstances. WIFI seems reliable, screen is great, keyboard is great, build is great. Can’t complain about the battery, either. Right now my uptime is 48 hours. It seems to do fine when idling, consuming very little power. I’ve only been plugging it in at night, before bed.

4 Likes

I get only a few hours, even idling. I’m using their default OS without X11, and I got these batteries. I’m guessing these batteries are just crap?

@aufdemrand - Hear here on i3, this inspired me to finally take the dive and learn i3 ( THANK YOU ). This combined with rxvt-unicode as the terminal and boo ya what a beast this little box is! TY again for posting about using i3 :+1:

1 Like

That seems likely. I definitely get 12+ hours of idling. As I’ve been playing with it more, I do plug it in at some points during the day, but If I grab it to go, I don’t worry about it running out of battery. If it helps, these are the batteries I got: Samsung 35E 18650 3500mAh 8A Battery

Heck yeah. I had to do some tweaking to get the battery to read, and the font sizes to be a bit bigger, but I’m completely happy with how it works. I’ve now dived into some bash scripting to open up terminals and open ssh connections to servers I need to log into regularly, then used i3 to bind some hotkeys to each of them. I also wrote a bash script that return some GPT3 chat from the console. I definitely can’t afford GPT4 :joy: :rofl: It makes up for the inability to quickly surf the web. Fun stuff!

1 Like

layer number need to be set from 1 to 16

Suspect there’s a mismatch between the G2D kernel module and the header (for describing the data structure passed to ioctl), which means that the DevTerm/uConsole are not using the same G2D kernel module?

@imnotjames try this first: https://github.com/yatli/xf86-video-fbturbo/tree/master/test-display2

There are a few if(0) branches that you can enable to test the basic functionalities like opening fd, writing data to it, and basic bitblt, then rotation.
I usually first work it out in this playground before moving to the DDX driver because it’s more controllable, can be launched over ssh.

2 Likes

Using the uConsole R01 in console mode (fbterm and tmux, no X), with the stock system image. I want to turn off the monitor after a couple minutes of inactivity.

How can I set the corresponding kernel parameter “consoleblank=”? The kernel’s command-line parameters — The Linux Kernel documentation

Any idea of how I should go about this?

1 Like

I’m curious on how to do this too! i3 + tmux is one heck of a win on these R01 units ( and became my personal favorite work around, so far… [ again i3 is a insanely low resource using tiling window manager ] ). i.e. - i3 was right up my alley for just the right learning curve and feature sets, same reasons I snagged a R01 and this unit.

All this being said, please do post if you can determine the proper kernel line that will power save / blank the main screen.

Side note: Bonus points if you or anyone else has a howto for compiling in on these R01 units additional kernel modules. I’ve a simple USB → GPS ( looks to be a serial adapter in lsusb with missing driver/kernel modules ) along with a simple USB → 10/100 adapter that again is seen with lsusb yet, no module or functionality.

(edit) - I3 for uConsole :point_left: ##Check out this cross post for i3 pointers

1 Like

Answering my own question here.

I created the “blank_screen” shell script below:

#!/bin/sh
if [ “$(whoami)” != “root” ]
then
sudo su -s “$0”
exit
fi
echo 1 > /sys/devices/platform/soc@3000000/5000000.disp/graphics/fb0/blank

And then I call it from tmux, by adding these lines in .tmux.conf:
set -g lock-after-time 180
set -g lock-command “blank_screen; vlock”

3 Likes