Friday, April 30, 2021

snap+wine+recycle bin

I have been using IrfanView for many years.  On Windows, it is a great lightweight viewer for viewing and organizing images.  I am delighted when I see it is available as a snap application.

It is made possible to run on Linux through WINE, and it works great.  The only issue or more precisely a question is where do these deleted files end up.  As it is kind of a WINE question, results I found online were referring how WINE maps recycle bin on Windows to its Linux equivalent.  However, when I deleted a file in IrfanView, I could not see it showing up in the trash can in Gnome.  Up until recently I thought this may be because I am using snap+wine+IrfanView rather than simple wine+IrfanView.  The recycle bin feature isn't working as it would normally do.  You can tell I am wrong otherwise, you won't see this post.

The recycle bin is indeed mapped to its Linux equivalent.  However, it isn't the one of in the OS, but instead the isolated version within snap, e.g.

 I guess you are reaching here because you have a similar question.  I hope this answers your question.

Friday, April 9, 2021

Using H96 Max X3 as a router

 

H96 Max X3 or any Amlogic S905x3 TV Boxes may not seem special at all.  However, they are actually very versatile.  Apart from using as a cheap emulator for classic game consoles such as SNES, Game Boy etc using Emuelec, it can also be made into decent OpenWRT router.  With its stronger encryption performance, it is actually a cheaper and a better alternative compared to Raspberry 4.


S905x3

aes-128-cbc 187342.31k 569070.57k 1097803.43k 1441047.89k 1590397.61k

aes-256-cbc 173451.30k 460776.90k 764922.79k 927822.85k 988708.86k   993421.99k

 

Raspberry Pi 4

aes-128-cbc 62939.79k 76141.21k 82262.20k 84452.51k 83872.20k 85103.02k

aes-256-cbc 50539.15k 59910.77k 62406.19k 64276.14k 64574.81k 64840.09k

(figures borrowed from https://www.reddit.com/r/raspberry_pi/comments/cf2c32/raspberry_pi_4_4gb_openvpn_performance_tested/ as I don't own a rpi 4)

 

Here is how I transform mine into an OpenWRT router.  Before, getting any further, it is important to note this tutorial uses software vlan to split the single LAN port for WAN and LAN.  Hence, you need a managed switch for this tutorial to work.

S905x3 is not officially supported by OpenWRT, hence you need to use a forked version such as https://github.com/ophub/amlogic-s9xxx-openwrt in this article.


1) Download a suitable image for S905x3 from https://github.com/ophub/amlogic-s9xxx-openwrt, such as 

openwrt_s905x3_v5.10.26.TF_2021.04.10.0350.img.gz (for running from an external drive)

or

openwrt_s905x3_v5.4.108_2021.04.11.0845.img.gz (if intended to install onto emmc)

2) Extract the image file and write this file either to a SD card or a USB 2 pen drive using an utility such as Rufus

 3)  Open the /boot/uEnv.txt file, and point the FDT to the dtb file for your hardware, e.g. meson-sm1-h96-max-x3.dtb for H96 Max x3.  Possible dtb files can be found in  /boot/dtb/amlogic

LINUX=/zImage
INITRD=/uInitrd

FDT=/dtb/amlogic/meson-sm1-h96-max-x3.dtb

APPEND=root=LABEL=ROOTFS console=ttyAML0,115200n8 console=tty0 no_console_suspen
d consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0 cgroup_enable=cpuset
 cgroup_memory=1 cgroup_enable=memory swapaccount=1


/boot/dtb/amlogic# ls
meson-a1-ad401.dtb                     meson-gxl-s905d-phicomm-n1-thresh.dtb
meson-axg-s400.dtb                     meson-gxl-s905d-phicomm-n1.dtb
meson-g12a-gt1-mini-a.dtb              meson-gxl-s905d-sml5442tw.dtb
meson-g12a-rockpi-w2.dtb               meson-gxl-s905w-p281.dtb
meson-g12a-sei510.dtb                  meson-gxl-s905w-tx3-mini.dtb
meson-g12a-tanix-tx5max.dtb            meson-gxl-s905x-hwacom-amazetv.dtb
meson-g12a-u200.dtb                    meson-gxl-s905x-khadas-vim.dtb
meson-g12a-x96-max-rmii.dtb            meson-gxl-s905x-libretech-cc-v2.dtb
meson-g12a-x96-max.dtb                 meson-gxl-s905x-libretech-cc.dtb
meson-g12b-a311d-khadas-vim3.dtb       meson-gxl-s905x-nexbox-a95x.dtb
meson-g12b-gtking-pro.dtb              meson-gxl-s905x-p212.dtb
meson-g12b-gtking.dtb                  meson-gxm-beelink-gt1.dtb
meson-g12b-odroid-n2-plus.dtb          meson-gxm-khadas-vim2.dtb
meson-g12b-odroid-n2.dtb               meson-gxm-nexbox-a1.dtb
meson-g12b-s922x-khadas-vim3.dtb       meson-gxm-octopus-planet.dtb
meson-g12b-ugoos-am6.dtb               meson-gxm-q200-n1.dtb
meson-gxbb-kii-pro.dtb                 meson-gxm-q200.dtb
meson-gxbb-mxq-pro-plus.dtb            meson-gxm-q201.dtb
meson-gxbb-nanopi-k2.dtb               meson-gxm-rbox-pro.dtb
meson-gxbb-nexbox-a95x.dtb             meson-gxm-s912-libretech-pc.dtb
meson-gxbb-odroidc2.dtb                meson-gxm-vega-s96.dtb
meson-gxbb-p200.dtb                    meson-gxm-wetek-core2.dtb
meson-gxbb-p201.dtb                    meson-sm1-h96-max-x3-oc.dtb
meson-gxbb-vega-s95-meta.dtb           meson-sm1-h96-max-x3.dtb
meson-gxbb-vega-s95-pro.dtb            meson-sm1-hk1box-vontar-x3-oc.dtb
meson-gxbb-vega-s95-telos.dtb          meson-sm1-hk1box-vontar-x3.dtb
meson-gxbb-wetek-hub.dtb               meson-sm1-khadas-vim3l.dtb
meson-gxbb-wetek-play2.dtb             meson-sm1-odroid-c4.dtb
meson-gxl-s805x-libretech-ac.dtb       meson-sm1-sei610.dtb
meson-gxl-s805x-p241.dtb               meson-sm1-x96-max-plus-100m.dtb
meson-gxl-s905d-libretech-pc.dtb       meson-sm1-x96-max-plus-oc.dtb
meson-gxl-s905d-p230.dtb               meson-sm1-x96-max-plus.dtb
meson-gxl-s905d-p231.dtb

 4) If it is a SD Card, insert it to the box's SD slot.  If it is an USB drive, plug the drive into the device USB 2 port.

5) Hold the rest button of the box while plugging in the power supply, the release the button after approximately 10 seconds.  With H96 Max X3, the reset button is locate inside the AV jack.

nummular mini h96 max x3 s905x3 tv box

6) The device should boot into OpenWRT from external storage rather than its internal emmc drive.


 

7) Once successfully boot into OpenWRT, edit its /etc/config/network file to split its eth0 interface into two vlan interfaces, e.g. vi /etc/config/network

config interface 'wan'
    option ifname 'eth0.5'
    option proto 'dhcp'
    option peerdns '0'
    list dns '9.9.9.9'
    list dns '8.8.8.8'

config interface 'lan '
    option type 'bridge'
    option ifname 'eth0.10'
    option proto 'static'
    option netmask '255.255.255.0'
    option ip6assign '60'
    option ipaddr '192.168.1.1'

8) Configure the managed switch as below:

port 1 => truck (for the TV Box LAN)

port 2 => Untag for VLAN ID 5 (for WAN)

port 3 => Untag for VLAN ID 10 (for LAN)


e.g.

 

 

9) Reboot the TV Box using instructions in (5)

10) Plug the TV box to port 1 (trunk), your WAN connection to port 2 (vlan 5) and your computer to port 3 (vlan 10).

11) The DHCP should be on by default, i.e. you computer should have assigned an IP within the 192.168.1.0/24 subnite.  However, if it didn't get an IP automatically, you need to manually give your computer a static IP within the 192.168.1.0/24 network, e.g. 192.168.1.50

12) Log onto the your TV Box/OpenWRT router by going to https://192.168.1.1 using your favorite browser.  The default username is root, and password is password.

13) Change language.  The default language is Chinese, and hence you may want to change it back to English.  You can find the option as shown below:-



14) If you are happy with the setup, you may want to make OpenWRT as your primary system.  You can install OpenWRT to the emmc drive of the box by running

openwrt-install