Archive for the ‘Linux’ Category.

Create Watchface with Zepp Editor for Amazfit

How to prepare and test a Zepp watchface

Done with Amazfit GTR 2E

Before you start, you need a lot of files prepared:

  • A background image to be used as watchface
  • A hour, minute and second dial, if you create an analog watchface
  • Digits and symbols to be used, for example the digits 0-9, a period, a percent, a ‘°C’, a distance unit (km) and others as you like to place on your watch face.

The background watchface for the GTR2E is 454×454 pixels. You need to know, how to do precise pixel images. The hands have to be symmetric, so they can easily rotate.

The digits can be created one by one using your favorite painting tool (i.e. Paint.Net, Inkscape or Painter or even GIMP). Another option is to use fontforge or the fontimage tool (Linux only) or a fontforge python script. Imagemagick is also useful if you need to invert or make the images transparent.

Fontimage example

Create a small text in white with transparent (black) background from Comic Sans Bold Truetype font:

fontimage --pixelsize 22 --text "km" -o km_comicsans1.png ComicSansMSBold.ttf
-or-
fontimage --pixelsize 22 --text "°C" -o gradCelsius_comicsans1.png ComicSansMSBold.ttf

Then invert the image (using imagemagick convert):

convert km_comicsans1.png -negate km_comicsans_n.png
-or-
convert gradCelsius_comicsans1.png -negate gradCelsius_comicsans_n.png

Finally make the black background transparent:

convert km_comicsans_n.png -transparent black km_comicsans.png
-or-
convert gradCelsius_comicsans_n.png -transparent black gradCelsius_comicsans.png

Another example for a bash script to generate digits:

#!/bin/sh
for n in 0 1 2 3 4 5 6 7 8 9 '.' ':' '%' '°C' 'km'
do
  fontimage --pixelsize 22 --text $n -o $n_1.png "ComicSansMSBold.ttf"
  convert $n_1.png -negate $n_n.png
  convert $n_n.png -transparent black $n.png
done

In the above script 22 is the pixel size of the images and ComicSansMSBold.ttf is the font to be used.

If you need to create more, single bitmaps at once, you may use a fontforge python script. I used to first load the font to be used into Fontforge and change the Encoding to Latin-1, mark the first 127 chars, invert the selection and delete the rest. Then save this as a Fontforge font file for later use.

Now you can use a small python script and export the remaining glyphs to single bitmap files:

import os
from fontforge import *

font = open(os.sys.argv[1])
font.reencode("iso8859-1")
for glyph in font:
  if font[glyph].isWorthOutputting():
    if glyph.isupper():
      name = glyph + "_capital"
    else:
      name = font[glyph].glyphname
      # or name it with ' + "_" + str(font[glyph].unicode)' added
      print ("glyph: " + glyph + ", unicode: " + str(font[glyph].unicode) + ", name: " + name + "\n")
      font[glyph].export("c:/temp/" + name + ".png", 22)

If you do not want to start this from command line, you may replace ‘os.sys.argv[1]’ by the path and name of your saved Fontforge font file or a TrueType font file. Be warned that you get many bitmap files now. Possibly do that within an empty new directory.

Now that you have your images ready, go on and start a watchface.

Assemble the Watchface

Continue reading ‘Create Watchface with Zepp Editor for Amazfit’ »

OpenVPN hinter Fritzbox an Deutsche Glasfaser

Letzens hatten wir einen Stromausfall und danach war die SD Karte in meinem BananaPi M2 Zero defekt. Also alles neu aufsetzen, Armbian plus Dump1090-fa und fr24feed. Auf dem Ding läuft adsbox zum Flugzeug-Tracking. Über das Teil hatte ich auch eine OpenVPN Verbindung in mein Heimnetz. Also easy-rsa installiert, neue Zertifikate und Keys erstellt und OpenVPN Service mit sudo systemctl openvpn.service@server enabled und gestartet. Die VPN Verbindung im Heimnetz getestet, läuft. Meinen dynv6.net Account reaktiviert und mittels Script die IP6 für dynv6.net aktualisiert.

Auf der Fritzbox TCP Freigaben für den BananaPi M2 Zero für Port 80 und 8754. Für OpenVPN auf der Banane UDP 1194 freigegeben. Bei feste-ip.net den dynv6.net Host hinter dem sich die Banana verbirgt verwendet, um Port Weiterleitungen vom ip4 Internet zur Banane einzustellen. Adsbox (Skyaware) und Fr24feed Webseite waren dann über die Feste-IP Adressen erreichbar. Nur Port 1194 geht nicht.

Feste-Ip.net unterstützt nur TCP Port-Weiterleitungen

Nach langem rumsuchen und kurz vorm Verzweifeln habe ich gelesen, dass Feste-Ip.net nur TCP Portweiterleitungen unterstützt. Dann habe ich noch eine alte server.conf von der Banane gefunden. Da steht als proto tcp6-server. Also schnell die server.conf von proto udp in proto tcp6-server geändert und danach gings auch aus dem Internet über die Feste-Ip.net Adresse.

FlightAware/SkyAware/dump1090-fa lighttp does not start after update to version 5

Today I updated my bananapi zero w running raspbian and the dump1090 flightaware software ADS-B monitor. Unfortunality the web server lighttp did not start any more after the update with an error about a line in 89-skyaware.conf. I did not accept the installer/update message to overwrite my custom files. But how can I get the maintainer versions of the conf files?

After some research I found them at https://github.com/flightaware/dump1090/tree/master/debian/lighttpd. So I used these files (89-skyaware.conf and 89-dump1090-fa.conf) instead and the web server started without error.

Finally I added my

server.use-ipv6 = "enable"

to the $SERVER[“socket”] of 89-skyaware.conf and my adsbox was reachable from internet again. I am at a FTTH network with global IPv6 only and use feste-ip.net to map ipv4 public IPs to my internal network.

How I run two openvpn server in same private network

I am running two openvpn servers in private network (192.168.0.0). Only in case one server stops working.

Network

default gateway internet router: 192.168.0.250
openvpn1: 192.168.0.137 10.8.0.0, debian, bananapi m2
openvpn2: 192.168.0.143 old=10.8.0.0 new=10.8.1.0, debian, bananapi B2
web server1:    192.168.0.40 (static ip), also running unbound dns and dnsmasq as DHCP server, debian
web server2:    192.168.0.50 (static ip), enigma2

Problem

First, both openvp servers where configured the same, using 10.8.0.0 for the remote clients. Do not forget to enable ip4 forwarding: sudo sysctl -w net.ipv4.ip_forward=1.

Unfortunately, some hosts did not respond, when connected to the second openvp server. Don’t know, why openvpn server1 works for remote connections connecting to private web servers. Internet browsing using default router worked with both opvpn connections.

When running a ssh session on .137 or .143, I was able to ping .40, but could not browse to the .40 web server from the remote connection. When connected to openvpn2, I could not open the web page of the 192.168.0.40 server.

How does a host know to use correct vpn network for sending back traffic and do not use the default router?

Solution

I changed the configuration to openvpn2 to use 10.8.1.0. Then I tested with static routes on 192.168.0.40:

For the static ip (/etc/network/interfaces):

  post-up route add -net 10.8.0.0/24 gw 192.168.0.137 dev eth1
  post-up route add -net 10.8.1.0/24 gw 192.168.0.143 dev eth1

After that temporary change on .40, I was able to to connect to openvpn2 and the web server on .40.

For dhcp clients in network (many esp8266, esp32 and esplink devices), I need to have an option for DHCP too.

On the dnsmasq dhcp server:

dhcp-option=option:classless-static-route,0.0.0.0/0,192.168.0.250,10.8.0.0/24,192.168.0.137,10.8.1.0/24,192.168.0.143

Note that the default router option (dhcp-option=option:router,192.168.0.250) may be ignored by dhcp clients

The dhcp options have been verified on a debian client:

aoa150:~$ ip r
default via 192.168.0.250 dev wlan2 proto static metric 600
10.8.0.0/24 via 192.168.0.143 dev wlan2 proto dhcp metric 600
10.8.1.0/24 via 192.168.0.137 dev wlan2 proto dhcp metric 600
192.168.0.0/24 dev wlan2 proto kernel scope link src 192.168.0.111 metric 600

Now I can connect from my mobile using OpenVPN to my network using openvpn1 and openvpn2 server.