Categories
Brainwaves

Birdie: Alarm App for Linux Phones

Wouldn’t it be nice to have a way to be woken up by your phone in the morning? Well, any old Android phone can do that! That was not the case with Linux phones. Until Birdie came along. Let’s consider the options:

Gnome Clocks? Nope. The app needs to be running for the alarm to activate.

Cron? Nope. When the phone gets suspended to save power, it will miss the alarm.

Wake Mobile? Close, but nope. It has most of the technology that is needed, but the alarm sound is annoying and it is not convenient to use. To be fair, this was only a proof of concept app. Some people reportedly used it anyway.

Birdie? YES! This one brings the minimum of features that I consider are required for an alarm clock.

Birdie features

  • one recurring alarm for selected days
  • ON/OFF switch
  • pleasant alarm sound with gradually rising volume, starting from complete silence
  • stop / snooze buttons
  • configurable alarm sound
  • wakes the system from sleep
  • shows control buttons on the lock screen, without the need to log in

With this feature set, I can finally replace my Android phone as an alarm clock!

(4)

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!

(1)

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!

(2)

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

(5)

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

(8)

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.

(1)

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!

(2)

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!

(2)

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.

(77)

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

(21)