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

Categories
Brainwaves

secushareBox forked

I revisited secushareBox (AKA boxen), built it from source and tried to experiment with it.

Sadly it didn’t want to print out any logs. Which is a problem, considering it was just silently failing. After improving the logging mechanism (logging into a file is no good if the user doesn’t know about the file!) I successfully went through the device initialization and installed the service onto my PinePhone.

Right after that I looked around the code some more and found out that there is nothing more. The tool is in a VERY early stage and all it does is the VPN service initialization. You’re on your own when it comes to actually using the service.

I’m considering making this my GNUnet homework, i.e. to extend this tool and make it somewhat usable. Meanwhile, here is my secushare-box repository with the improved logging.

Categories
Brainwaves

WordPress CLI posting supports titles

After some Python taming I improved my wordpress-rest-curl tool. Now it has the ability to extract the post title.

If the first line begins with #, it uses the rest of the line as the post title and removes it from the post content. This way I can get rid of all the (no title) posts that had an embedded title that WordPress didn’t know about. Nice!