Categories
Brainwaves

What is MPRIS?

This week I found out about MPRIS: Media Player Remote Interfacing Specification. It is a standardized D-Bus interface for exposing metadata and controlls from a music player. Thanks to MPRIS, other apps can integrate such a music player seamlessly, e.g. onto the computer lockscreen.

What else can you do with MPRIS? Stop or Snooze your alarm clock! That’s right, the alarm clock Birdie designed for Linux phones (PinePhone) now acts as a music player. Now you don’t have to unlock the phone to stop an alarm in the morning!

Categories
Brainwaves

Building AArch64 Arch Linux packages on a x86_64 host

I was looking for a convenient way of easily building AArch64 (ARM64 / ARMv8-A) packages for Arch Linux ARM, namely for the PinePhone. One option is to cross-compile the packages, but maintaining a cross-compilation toolchain is a pain. I wanted the experience of compiling natively without the need to heat up the weak ARM CPU these devices have.

QEMU to the rescue! It is possible to run an emulated Arch Linux ARM on a non-ARM device. This way you can compile natively. And with armutils this whole process of building packages can be automated. All you need is to install a few AUR packages, create an AArch64 chroot and start building!

Dependencies

You’ll need qemu-user-static-bin, binfmt-qemu-static-all-arch and finally armutils-git, installed from AUR (e.g. via yay).

Creating a chroot


mkarmroot -u http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz <YOUR-PATH>/aarch64/root base-devel

Building a package

Assuming <YOUR-PATH>/pkg contains the package PKGBUILD file:

cd <YOUR-PATH>/pkg
sudo makearmpkg -r ../aarch64 -- --noconfirm

Done!

Categories
Brainwaves

Video Terminal Revival

Don’t you love old video terminals? I know I do! That’s why I spent the few last weeks playing around with various terminal-related technologies: composite video, CRT monitors, old keyboards and the VT100 standard. The result is a working physical VT100 emulator, built around a CRT TV, LK201 terminal keyboard and an ESP32.

Source code, instructions and photos: video-terminal-revival repository

Categories
Brainwaves

Zbrojovka Brno Consul 262.9 adapted to USB

I obtained a vintage mechanical keyboard from 1988: Consul 262.9, made by Zbrojovka Brno. It features contactless Hall-effect switches (i.e. magnet sensors detect keypresses). It uses an XT protocol, so I had to create an adapter to make it usable for me. I could probably buy some cheap ready-made adapter, but where’s the fun in that?

Consul 262.9 contactless keyboard, Zbrojovka Brno k.p.

Time to bring out the Arduino Leonardo! This newer Arduino features a HID-USB support, so it acts as a keyboard when connected over USB. All that remains is to connect the Arduino’s GPIOs to the keyboard’s pins and write a mapping layer between the “XT-keys” and “USB-keys”. Fun fact: this actually makes the keyboard programmable!

Here is the repository with the source code: xt-keyboard-adapter

Categories
Brainwaves

Sway Stickynotes

I love using workspaces when working on a computer. It neatly organizes your windows; commonly used apps are easy to find and project-related apps are grouped together. Workspaces became a must-have for me and Sway is my long-time favourite solution for everything.

One thing that I was missing in Sway was a way to have a brief note on every workspace. When working on a project (however small), I keep things together on a dedicated workspace. But after some time I tend to forget what the idea of the workspace was. I then need to figure it out based on the content. And sometimes projects get lost this way. Thankfully there is an easy fix now: Sway Stickynotes

With this small (and dirty) tool I can assign a short note to every workspace and change it easily.

Categories
Brainwaves

NAS disk failure and lessons learned

I recently had a degraded RAID storage on my NAS. In other words, one of the disks failed and wouldn’t spin up again. Thankfully I am running a RAID1 configuration on two disks, so I only lost one copy of the data. After replacing the disk with a blank new one, the RAID was restored and once again my data is safe and happily redundant on the second disk.

The disk that failed on my was a Seagate NAS HDD 3TB and it lasted 5 years. Funny thing is that the SMART disk monitoring warned me of an imminent disk failure only after the disk had already failed. The NAS (Zyxel NAS542) was angrily beeping after detecting the RAID degradation.

Initially I chose RAID1 for exactly this scenario – when one of the disks fails, I can just buy a new one. No risk of data loss, because it is unlikely that both of the disks would fail at the same time. The second disk is even a different brand (Western Digital Red Plus (EFRX) 3TB), just to make sure. Also, with RAID1 I just need two disks, which is way cheaper than going for the more advanced RAID configurations which need at least 4 disks.

So after the Seagate disk failed, did I go and buy a Western Digital one, since that disk didn’t fail? No. I went for a new 3TB Seagate NAS disk instead. I don’t think there is anything wrong with the brand and I like the benefit of being able to reference the disks by the maker. It helps with identifying them, lowering the chance I accidentally wipe or throw away the wrong one.

In summary: RAID1 is great. Automatic redundancy is important. Keep your data safe!

Categories
Brainwaves

Error mounting a CIFS storage

I was trying to mount several folders from my LAN NAS (Zyxel NAS542) to build an automated backup server and I kept bumping into this error:

$ sudo mount /mnt/nas/bagr
mount error(5): Input/output error
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

$ dmesg | tail
[426845.904201] CIFS: Attempting to mount //192.168.1.10/bagr
[426845.914365] CIFS: VFS: \\192.168.1.10\bagr validate protocol negotiate failed: -13
[426845.915581] CIFS: VFS: cifs_mount failed w/return code = -5

The other folders from the same server mounted just fine. Just this one kept failing.

Then when I ssh-ed into the NAS I found out that the directory had incorrectly set permissions:

# ls -all
drwxrwxr-x   15 works    works         4096 Jan  9 16:12 works
drwxrwx---   15 bagr     bagr          4096 Jan  9 16:12 bagr

For some reason the directory needs to have the “others” permissions set to read and execute so that the CIFS (SMB/Samba) may access that.

To fix this, I just did:

# chmod o+rx bagr

Done! Now the storage mounts successfully!

Categories
Brainwaves

Exploring Desktop Notifications in Linux

I was looking into the realm of desktop notifications in Linux. How do I show custom notifications on my desktop? Will the same code work on my PinePhone?

Yes! Thanks to standardization, D-Bus, libnotify etc. this can be done. You need a server which shows the notifications and a client which submits the notifications. Naturally, ArchLinux Wiki has a great entry on this: Desktop notifications. It even provides example client source code for various languages.

Notifications Server

Some desktop environments provide their own server built-in, some do not. Luckily there are a bunch of standalone solutions available. Plus you can customize these to your liking.

I’m running SwayWM on my desktop, so I needed to install a standalone server. Dunst is a nice and minimalistic solution, though currently just for X11 (e.g. dwm). Finally, I chose mako – a Wayland-native daemon built for Sway. Fun sidenote: mako started as a “Gah! This is too hard to port” response to this Dunst issue to support Wayland.

On the PinePhone this was simple – Phosh already provides a notifications server. It shows notifications in the top pull-down panel, just like in other phone UIs.

Notifications Client

Running e.g. this Python code from the ArchLinux wiki is all you need!

#!/usr/bin/python
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
Notify.init("Hello world")
Hello = Notify.Notification.new("Hello world", "This is an example notification.", "dialog-information")
Hello.show()

Sharing the same tools, code and APIs between a desktop and a phone is just awesome.

Categories
Brainwaves

How to create a tray icon notification app in Linux

I was looking into creating a GNUnet system monitoring widget. Something that would show you the status of the network at a glance. My first idea was to create a simple tray icon.

Here is a quick and easy starting point for creating such a tray icon app using Python and the AppIndicator3 library: snippets/example-tray-icon

Categories
Brainwaves

How to disable Software Updates in Phosh

I like to manually update my OS packages through the command line. Mostly because I know the timing is right and I can restart afterwards. I also want to know which packages changed, where to expect improvements or potentially some breakage. None of this is fulfilled with the Gnome Software UI tool. It just makes my PinePhone user experience worse. So here is a way to just disable it:

mkdir -pv ~/.config/autostart && cp /etc/xdg/autostart/gnome-software-service.desktop ~/.config/autostart/
echo "X-GNOME-Autostart-enabled=false" >> ~/.config/autostart/gnome-software-service.desktop
dconf write /org/gnome/desktop/search-providers/disabled "['org.gnome.Software.desktop']"
dconf write /org/gnome/software/allow-updates false
dconf write /org/gnome/software/download-updates false

Kudos goes to this guide: How to disable Gnome Software autostart