Quantcast
Channel: MobileRead Forums - Kobo Developer's Corner
Viewing all articles
Browse latest Browse all 1561

[HOWTO][WIP] Run Xorg on your Kobo + full-blown Firefox

$
0
0
This is meant to be a continuation of the previous thread, "Create your own native development environment for your Kobo". I decided to separate Xorg from it because the title was not reflective of the contents of the post. I'll post more tips on here, and all my new Xorg-on-Kobo updates will be there instead.

Hi,
So after a little bit of tinkering with Alpine Linux on my Kobo (https://www.mobileread.com/forums/sh...d.php?t=336175), I really wanted to get Xorg up and running. So I got down the rabbit hole of Xorg config and video drivers, and came up with a *kind of* working solution. I ended up with a working Xorg "display" (you'll see why below) on the eInk screen of the Kobo, with Fluxbox and a full-blown Firefox (which worked really well) + a x11vnc session that you can access with common VNC software on your main computer. No input for now, maybe it will come in the near future (especially touch), but there are two solutions:
1. Use xdotool to control mouse/keyboard from Linux CLI
2. Control the system from a VNC client.
I also tried to watch YouTube from a VNC client and it was kind of... well ugly (0.5 fps in fact).

Tested devices : Kobo Glo HD, Kobo Libra H2O
*If this works on your device, please let me know, and I'll add it on the list!*
Kobo Libra H2O Overall experience very good, Firefox is able to (slowly) play mobile YouTube videos! Tested Reddit, Old Reddit, Mobileread, I'd qualify it as usable.
Kobo Glo HD Overall experience pretty good, Firefox is slower comparatively to the Libra H2O. You may find useful installing Midori or Falkon instead.

How do I do this? :D
First, head over there and make your steps through, but don't install GCC/G++/Clang if you don't want to.
TL;DR: stop at step 13, then come back here again.
Note: You may want to enable Landscape mode system-wide for a better experience:
Code:

.kobo/Kobo/Kobo eReader.conf
----
[DeveloperSettings]
ForceAllowLandscape=true

Main setup
1. You're likely already in a SSH/Telnet session. Install the necessary packages:
Code:

apk add xorg-server xf86-video-dummy xvfb font-noto fluxbox xterm firefox-esr scrot imagemagick xdotool geany pcmanfm x11vnc
Firefox is not mandatory, but is very useful for browsing the Web. Geany & PCManFM are not required if you don't want to install them. Do a little thing for convenience :
Code:

mv /usr/share/fonts/noto/NotoSansMono*.ttf /usr/share/fonts/noto/NotoSerif*.ttf /home
2. Initiate an Xvfb session by typing this:
Code:

Xvfb :1 -screen 0 800x600x16 &
You could also replace 800x600 by your Kobo's native resolution, but it is not properly scaled and the text will be very, very small. Then, export the DISPLAY environment variable:
Code:

export DISPLAY=:1
This step here creates a "fake" display with the Xvfb dummy video driver. It allows us to run Xorg without using a proper display, because I didn't figure out how yet.

3. Launch Fluxbox by typing this:
Code:

fluxbox &
You could see a bunch of lines coming from your terminal, just hit Enter and the prompt will reappear.

4. (optional) Launch xterm or Firefox:
Code:

xterm &
5. Now, the fun part. Open a new shell in your host machine, then SSH/Telnet to the Kobo. *Don't* close the one you were using. Enter the chroot again by typing this:
Code:

chroot /mnt/user /bin/sh
Then, type in this (scrot is faster):
Code:

DISPLAY=:1 scrot --overwrite /run/screen.png
or
Code:

DISPLAY=:1 import -window root /run/screen.png
This will take a screenshot of the dummy X screen. If this finishes with a blank output and seems to create a non-empty file, then continue:
Code:

while true; do DISPLAY=:1 scrot --overwrite /run/screen.png ; done
or
Code:

while true; do DISPLAY=:1 import -window root /run/screen.png ; done
It stores it in /run which is a tmpfs so no write damage will be done to the eMMC/SD.

6. Open a third shell in SSH to your Kobo. *Don't* close the two others. Then, *don't* chroot, and do this instead:
Code:

while true; do fbink -g file=/mnt/user/run/screen.png,w="1680",h="1264" ; done
or
Code:

watch -n 0.5 "fbink -g file=/mnt/user/run/screen.png,w="1680",h="1264""
Replace the w/h values with the ones your Kobo uses. 1680x1264 is the native resolution of my Libra.

7. Something should happen. You should see a delightful thing on the screen of your Kobo; an X desktop! Now, there are no input functions (touch) at all for now.
What you can do is use xdotool:
Code:

xdotool type "test"
The above command types "test".
Code:

xdotool key Return
This hits the Enter key. Useful, isn't it? I'm working on an interactive version programmed in Python so you won't have to type "xdotool <something> <something>" each time to register inputs, you'll just have to type the letters on your keyboard and then it will register them as you go.

x11vnc
To start the VNC server, open a new prompt/window, SSH your Kobo again, *don't* close the other SSH sessions, then type:
Code:

x11vnc -display :1
After that, you'll want to install a VNC client on your main PC; I use https://tigervnc.org/ , cross-platform Windows/Mac/Linux, and it works very well.
Then ... experiment :):D

Here are some screenshots and I'll post a video soon.
Cheers! :)

Disclaimer: I am not responsible if you brick your Kobo with this technique, or if you lose files.

Attached Thumbnails
Click image for larger version

Name:	uname.png
Views:	N/A
Size:	14.5 KB
ID:	184496   Click image for larger version

Name:	firefox.png
Views:	N/A
Size:	192.9 KB
ID:	184497   Click image for larger version

Name:	htop.png
Views:	N/A
Size:	28.2 KB
ID:	184498   Click image for larger version

Name:	PXL_20210104_132957622.jpg
Views:	N/A
Size:	543.8 KB
ID:	184499  

Viewing all articles
Browse latest Browse all 1561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>