No Comments

How to fix the no header and footer showing in Woocommerce and WordPress 2024 child themes

August 3rd, 2024

Not really a surprise, we saw it coming for several years, and it’s not necessarily a bad thing lowering technology barriers for WordPress users, but in practice what is the gain of multiple inline CSS rules, instead of one properly made external CSS sheet.

Similarly, fixing the wrongly collapsing navigation menu on mobile is just a matter of adjusting a number in a media query, but there is no fucking way to do that in the UI.

What’s the gain of writing myriads of JavaScript rules to be able to change a CSS variable, which you could do by simply changing a variable in the CSS file. It’s a loss for the developers and a gain for the noobs, the marketeers and the trackers. It’s like taking your car the drive to your postbox to empty it.

But it’s an efficiency loss for the web in general. Pushing and forcing JavaScript for these things is simply wrong.

Anyhow when you develop a new site with the new 2024 theme, you can get far by clicking and dragging your mouse, but I can assure you, when you do that a couple of times and tried out several themes, headers, layout and patterns, there comes a moment headers and footers are lost or different on the WooCommerce pages.

Why and how you should fixed this with the UI/ Visual Editor, is quite obscure, but using the code editor, it’s a matter of fixing the first and last row in a WooCommerce page:

Do a site edit and not a page edit on a Woocommerce page and enable the code editor in the right top settings and change this

<!-- wp:template-part {"slug":"header","theme":"twentytwentyfour"} /--> to

<!-- wp:template-part {"slug":"header","theme":"<your_theme_name>"} /-->

Vice versa for the footer.

I don’t know why the checkout page in WooCommerce has a different header the the other shop pages, (and no footer by default) but simply change this

<!-- wp:template-part {"slug":"checkout-header","theme":"woocommerce/woocommerce","tagName":"header"} /-->

to

<!-- wp:template-part {"slug":"header","theme":"<your_theme_name>"} /-->

No Comments

Fixing No Audio on Kodi 21 Flatpak on Ubuntu 22.04 LTS

{}
April 17th, 2024

Somehow my new Flatpak Kodi 21 install stopped outputting any sound after an update.

As it seems the Flatpak update is now by default outputting only PipeWire sound, (or with higher priority than before) and that doesn’t work on Ubuntu 22.04 LTS

To fix it, simply run Kodi with --audio-backend=pulseaudio:

 flatpak run tv.kodi.Kodi --audio-backend=pulseaudio

That’s all. Sound is working again on Ubuntu 22.04.

I guess this will be fixed on another Kodi Flatpak update.

See the issue here:

https://github.com/xbmc/xbmc/issues/25006

No Comments

Fixing the annoying rsync auto-completion bug with path containing spaces

{}
December 5th, 2023

Experimenting with a Raspberry Pi 5, I tried to sync some files from the Pi to my Ubuntu 22.04 Desktop.

Once you have setup ssh-keys with ssh-copy-id, and added an entry to .ssh/config you can easily connect to your pi with

ssh pi

using rsync on the Raspberry Pi

Copying a file or directory can be done with rsync:

rsync pi:pathtofile/file.txt .

Now the file will be copied to your working directory (directory your running the command from)

rsync will magically autocomplete the path in the same way it does for local path by pressing tab.

I have a dir called `new map` on my pi. It contains a space.

When I type `rsync pi:new` and press TAB rsync will auto-complete it to `rsync pi:new\\\ map`

It will double-escape the path.

But executing the command after auto-completion does not work:

rsync pi:new\\\ map .
rsync: [sender] link_stat "/home/pi/new\ map" failed: No such file or directory (2) 
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1865) [Receiver=3.2.7] 
rsync: [Receiver] write error: Broken pipe (32)

Using spaces in maps of file-names is a nasty thing that should be avoided. Sooner or later it will give you troubles.

As it seems newer versions of rsync (> 3.2.4) do NOT require double escaping anymore, but the auto-completion still uses it.

This is clearly a bug:

https://github.com/scop/bash-completion/issues/848

Use the –old-args argument for rsync to fix auto-complete double escaping

The workaround is to use the –old-args argument for rsync

rsync --old-args pi:new\\\ map

Now it is working fine, I suppose this will be fixed in a newer version of rsync.

 

No Comments

Making screencasts on the Raspberry Pi 5 and Raspberry Pi OS Bookworm

{}
November 14th, 2023

Recording your desktop, or recording a part of your desktop, or piping your desktop to Zoom, or in general as a webcam input, it can all be done quite easily with the new Raspberry Pi 5.

The new version of Debian is using Wayland as a default, so it’s always a bit of a search how to do rather trivial things on a new device and a new environment.

Anyhow there is a versatile simple Wayland desktop recording program, wf-recorder, that can be installed with:

sudo apt install wf-recorder

You can find more info here:

https://github.com/ammen99/wf-recorder

Recording is a simple as running wf-recorder 🙂

That outputs a file recording.mp4 in the directory it’s run from, so to get it organized a bit it needs some cli parameters.

Furthermore the programs starts recording until you kill it, normally by CTRL C on the cli.

Let’s setup a keyboard shortcut that records the desktop and save it in the Video’s folder with a filename screencast-2023-11-14_12-20.mkv, so it’s includes date and time.

And because the Raspberry Pi 5 can drive two monitors you have to specify which screen the screencast should be made of.

So to add shortcuts to the Wayland environment, just open .config/wayfire.ini and add them there:

binding_screencast_hdmi_a_1 = <super> <ctrl> KEY_1
command_screencast_hdmi_a_1 = timeout 30s wf-recorder -p crf=28 -t -o HDMI-A-1 -f "/home/pi/Videos/screencast-$(date +%Y-%m-%d_%H-%M).mkv"
binding_screencast_hdmi_a_2 = <super> <ctrl> KEY_2
command_screencast_hdmi_a_2 = timeout 30s wf-recorder -p crf=28 -t -o HDMI-A-2 -f "/home/pi/Videos/screencast-$(date +%Y-%m-%d_%H-%M).mkv"
binding_screencast_hdmi_a_1_audio = <super> <alt> KEY_1
command_screencast_hdmi_a_1_audio = timeout 30s wf-recorder -a -p crf=28 -t -o HDMI-A-1 -f "/home/pi/Videos/screencast-$(date +%Y-%m-%d_%H-%M).mkv"
binding_screencast_hdmi_a_2_audio = <super> <alt> KEY_2
command_screencast_hdmi_a_2_audio = timeout 30s wf-recorder -a -p crf=28 -t -o HDMI-A-2 -f "/home/pi/Videos/screencast-$(date +%Y-%m-%d_%H-%M).mkv"

On the first line we define the shortcut, on the second line the command that should be executed.

I have setup 4 shortcuts to:

  1. record screen 1 by pressing SUPER + CTRL + 1
  2. record screen 1 with audio  by pressing SUPER + ALT + 1
  3. record screen 2 by pressing SUPER + CTRL + 2
  4. record screen 2 with audio by pressing SUPER + ALT + 2

Of course you can change the shortcuts to your liking.

I choose to record just 30 sec, it will stop automatically. In Linux you can do that simple with timeout 30s command

The moment I’m typing this blog-post, I realize it is probably better to add another 5th shortcut to kill/stop the recording, so you could make recordings with variable duration.

Well not that difficult, just bind a shortcut to

killall -s SIGINT wf-recorder

And remove the `timeout 30s` part.

wf-recorder only records screen updates by default, so recording a static desktop will output an empty file 😉 Nothing to record when nothing is happening, saving MB’s on file size. Add -D to record every frame.

No Comments

Controlling the Fan of the Raspberry Pi 5 in Ubuntu 23.10

{,}
November 9th, 2023

The new Raspberry Pi 5 is a really nice upgrade. Both RaspberryPiOS and Ubuntu 23.10 are really running much faster on the new model then on a RPI 4.

Booting RaspberryPiOS takes around 12sec on a ordinary SanDisk SD card. The fan is running full speed at boot, but is slowing down afterwards. And it has not started again during browsing a few websites.

Ubuntu boots a bit slower, but GNOME 3 is also running really fine. Ubuntu is visually more attractive, and it’s really running smooth.

There is a big annoyance for the moment and that is the fan. It is running full speed at boot and keeps running all the time full speed, making to much noise.

Fan control doesn’t seem to work yet, but controlling the fan can be done manually by writing a number in the range 0 (off) to 4 (full speed) to /sys/class/thermal/cooling_device0/cur_state

So I created a startup service that slows down the fan on Ubuntu after boot to speed setting 1, and that is inaudible.

[Unit]
Description=RPI-startup Fan Control service
After=multi-user.target
[Service]
User=root
Type=oneshot
ExecStart=/bin/bash -c "echo '1' | tee -a /sys/class/thermal/cooling_device0/cur_state" &
[Install]
WantedBy=multi-user.target

Copy above content to a file /etc/systemd/system/fan.service.

And enable it by:

sudo systemctl enable fan.service

That’s all, no reboot the Pi and Ubuntu will be silent.

Remember the Raspberry Pi willl automatically throttle when reaching a temperature of 85°. So there is no danger in letting the fan run on speed 1 continuously. Even when your compiling the Linux Kernel.

Off course you can always check the temperature with, and yes that works also in Ubuntu 23.10 on the Pi

sudo vcgencmd measure_temp

You can always bump up the speed to 3 by issuing this in the terminal

echo '3' | sudo tee -a /sys/class/thermal/cooling_device0/cur_state

 

No Comments

Raspberry Pi 5 FAQ

{}
October 4th, 2023

Can the RPI5 suspend to RAM?

Yes, but not yet. Here an RPI engineer states that a future firmware update could implement it. And in the new HAT+ spec for newer HAT+ introduced with the RPI5 that is confirmed. The older HAT was introduced in 2014, so nearly ten years later there is the preliminary HAT+ spec (PDF).

In the spec Chapter 3. Power States:

Raspberry Pi supports the following power states:

  • OFF
    No power connected to the board (the board unplugged).
  • WARM-STANDBY
    The Raspberry Pi is halted/off, but all of the power rails are still enabled. This is the default mode when doing a sudo
    halt or soft power-button-off operation.
  • STANDBY
    The Raspberry Pi has the 5V rail powered — so the power management chip is powered — but no other power
    supplies on the PMIC and board are enabled. You can configure sudo halt or power-button-off using the EEPROM to
    enter this mode instead of WARM-STANDBY.
  • SLEEP
    Some rails are off — notably the CPU core — and Linux is in suspend-to-RAM state. Pressing the power button will
    cause the system to move to the ACTIVE state.
  • ACTIVE
    All rails are up and everything is running, e.g. running desktop Linux.

NOTE: The SLEEP state is not currently supported on Raspberry Pi 5.

So sleep state AKA suspend-to-RAM is coming to the Raspberry Pi 5. Just wait for the future firmware update.

I hope WOL (WakeOnLan) is also coming, rumors (Jeff Geerling) are there, not confirmed yet.

What is the official name of the new RPI 5 device: Raspberry Pi 5 or Raspberry Pi 5 Model B?

That is unclear. 🙂 .

According to mother Lady Raspberry Pi Herself Liz Upton it’s  Raspberry Pi  5

According to father engineer James it does include B in the name: it’s Raspberry Pi 5 Model B

According to the Raspberry Pi 5 itself it’s: Raspberry Pi 5 Model B Rev 1.0

Rev here stands for revision and gives an indication that there has been a small update/patch to the hardware. Of course this name is partly depending of the software/firmware and hardware/revision.

Can I use the same camera cables as for the Raspberry Pi 4?

No, the Raspberry Pi 5 needs another type of cable. Because the connectors are smaller, it uses higher-density pinout variant of the camera cable.

In fact it uses the same cables as a Raspberry Pi Zero (2). So if you have a couple of them, you’re OK.

Does the Raspberry Pi 5 need a new Power Supply?

No, you can run the Raspberry Pi with the trusty Raspberry Pi 4 power supply. It will downstream USB current to 600mA. However, the Raspberry Pi 5 can be more power hungry, and if you really need more power on the USB ports, you better use the new Raspberry Pi 5 power supply. It will more than double the output to 1.6A.

All things considered the new Power Supply is not a bad deal. It will cost you 12 bucks, but it does support PD, and you can even charge your Apple MacBook Pro laptop or your phone.

What about the RPIBOOT mode of the Raspberry Pi 5

If you connect a laptop to the Raspberry Pi 5 USB-C port, so you’re powering the Raspberry Pi5 from your laptop instead of a power supply (yes, that also works on the Raspberry Pi 4), and you press and hold the new power button before connecting the USB-C cable, the Raspberry Pi 5 will boot into USB boot mode; this way the host machine can upload new firmware into the Raspberry Pi 5.

Why does the Raspberry Pi 5 not have an external WiFi Antenna Connector?

Space, and it would be more expensive because you’ll need to cover approval-costs for compliance.

How do I enable USB-boot when I’m using a Raspberry Pi 4 15w power supply instead of the 27w Raspberry Pi 5 power supply?

It will show a warning, stop booting, and you’ll need to press the power button before is continues booting.

Or add this to  `/boot/firmware/config.txt`

usb_max_current_enable=1

See the docs.