HaxoGreen 2016

HaxoGreen 2016 banner

HaxoGreen is just around the corner, taking place july 28th to july 31st. This years edition is already the fifth of this small but very cozy and nice hacker camp, and unfortunately there are no tickets left.

More info can be found on the Wiki, also there's @HaxoGreen and #haxogreen on Twitter as well as #haxogreen on IRC on Freenode. If you're an attendee and want to give a talk or hold a workshop there's still time! There are some slots just waiting for you. Contact Orga at hello[_at_]haxogreen.lu and go for it :)

I'll try to write some blog posts about stuff going on at the camp and preparations/build-up, let's see how this goes.

Beurer BM58

The Beurer BM58

Some years ago I bought a Beurer BM58 blood pressure meter to occasionally, well, measure blood pressure. (Though I can think of a lot of neat things to build out of it shall it break...) It came with a USB connection, has two users and can save up to 60 records (per user?). It also came with a Windows only software.

Being a Linux person I've asked the Internet if anybody else maybe has published something to read out data from it. I've come across two projects, none of which are compatible unfortunately. There are at least two versions of the Beurer BM58 out there:

  • Connected via some USB-Serial bridge (ttyUSB)
  • Connected as HID device, lsusb: "0c45:7406 Microdia"

I've got the latter one. The projects I've found are:

  • BPM can work with the usb-serial Beurer BM58
  • Atbrask has written something for another meter (Beurer BM65 via usb/serial)

Atbrask also has written up some information about the USB protocol that device uses, some parts are similar to what my device does.

So I needed to reverse the protocol and throw together some python. I've fired up a VirtualBox with M.S. Windows as well as Wireshark with the usbmon module. Never having done much lower level USB stuff this was all new for me, but it was fun and I learned something on the way yay!

You can find the code on GitHub. It uses PyUSB, you'll need a 1.x version. Debian Jessie comes with 0.4.3, but 1.0.0 is available in the backports.

What it does:

  • Read out all records of user 1 (U1), accessible as nested dict.
  • If run directly print out the records

What it currently does not:

  • Read out user 2 (U2) data. I've forgot this when making the USB dumps and didn't need it. I'll add it eventually.
  • Put the data into any kind of (csv maybe) file, database or anything like that.
  • Everything else. Actually, it doesn't do much at all.

Protocol and stuff

The protocol is straight forward. First the device wants to be initialized some bytes and send you its identifier. Every USB request is 8 bytes long, and usually only the first byte in the request changes while the rest is padded with 0xf4. For example to initialize you'd send:

0xaa 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa5 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa6 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa7 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4

The device will respond with the identifier "Andon Blood Pressure Meter KD"

Ol' Wireshark looking at USB

You can then ask it for the number of records in storage:

0xa2 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4

Which it will answer with, well, the number. Then you can download the records by incrementing the second byte, starting at 0x01. For example first three records:

0xa3 0x01 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa3 0x02 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xa3 0x03 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4

It'll answer with something like this, converted to decimal:

100 55 60 2 3 26 38 8

For some reason the systolic and diastolic values need to be incremented by 25. They are the first two, so incremented the record looks like this:

125 80 60 2 3 16 38 8

Device downloading records

Nr. Example Meaning
1 125 Diastolic
2 80 Systolic
3 60 Pulse
4 2 Month
5 3 Day
6 16 Hour
7 38 Minute
8 8 No Idea ;)

I don't know yet what the 8. byte is, the value was always 8. Maybe the year? I don't even know if you can set a year on the device, but most probably yes. My clock wasn't correct and I didn't bother to much so I can't correlate.

Then you can close the device cleanly:

0xf7 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4
0xf6 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4 0xf4

What's important is that de device only stays active for like 30 seconds after it's plugged in. I didn't realize this and it took me much time debugging why my USB connection wouldn't work. Always times out, but it also times out if you send the wrong stuff to it. Also if you don't terminate cleanly you can't requery the device without replugging.

Keep that in mind.

So, what's left to do?

  • Add user 2 support
  • Write records to some file. CSV probably
  • Write records to DB? SQLite comes to mind
  • For me most important: Throw records at Graphite

Graph ALL the things!

OpenPGP Transition Statement

For a number of reasons, I've recently set up a new OpenPGP key, and will be transitioning away from my old one. Here's the transition statement, signed by both my old and my new key:

(Or download it here)

Hash: SHA1

Fri, 19 Feb 2016 21:43

I've recently created a new OpenPGP Key and will transition away from my old one.

The old key will continue to be valid for some time, but I prefer all future correspondence to come to the new one. This message is signed by both keys to certify the transition.

the old key was:

pub   4096R/95FC3745 2013-07-05 [expires: 2016-07-04]
      Key fingerprint = A705 94BE CF58 8F1D 2E26  DF1D 8EE8 3FC9 95FC 3745

The new key is:

pub   4096R/7A9C3BD7 2016-02-10 [expires: 2018-02-09]
      Key fingerprint = 2EEC EFE3 C2FC 5E65 FF11  8B88 6835 1706 7A9C 3BD7

To fetch the key from my web site and import it:

  wget -q -O- https://muling.lu/muling_gpg.asc | gpg --import -

Or fetch it from a public key server:

  gpg --recv-key 0x7A9C3BD7

If you already know my old key, you can now verify that the new key is
signed by the old one:

  gpg --check-sigs 0x7A9C3BD7

If you don't already know my old key, or you just want to be double
extra paranoid, you can check the fingerprint against the one above:

  gpg --fingerprint 7A9C3BD7

Please let me know if there is any trouble, and sorry for the inconvenience.

Version: GnuPG v1



When I first got into Graphite I was totally flashed by it. It seemed to be the holy grail in gathering all kinds of data about basically anything. Later when Grafana came along things got really nice looking too. Together these are incredibly powerful and gathering data was never easier, just send a data point with a name and timestamp and you're set. I use it for performance data of many systems as well as things like power usage, temperature, voltage, audio signal amplitude or RSSI of radio signals. Make sure to check them out if you've got some love for graphs and data.

As I've got an rTorrent instance (together with ruTorrent) why not push the data to Graphite too. I've written rTorrent-graphite (GitHub), a Python script which uses the XML-RPC API (_not_ SCGI, at least not yet) to extract some basic data such as:

  • Used bandwidth up/down, including set limits
  • Used memory, including set limits
  • Number of torrents total, complete & incomplete
  • Bytes remaining & done
  • Number of peers, seeds, accounted

I'll probably add some other metrics later, and/or switch from XML-RPC to WSGI since that's a more direct way to speak with rTorrent. The image below shows how it can look like in Grafana. Graph ALL the things!

Grafana showing rTorrent data pulled out of Graphite

Hello again, world!

8 years ago I've started blogging, not regularly or frequent or anything, but still.. Back then I opted for WordPress, it was fast to set up and I didn't know yet if I even liked blogging at all. Actually I only started because I had that server & domain anyway and wanted to throw something on the web server, not because I wanted to get into blogging...

I've wanted to switch to something static as well as start writing in English for years, but never got around to. So today is the day, yay! There are quite a few static blog engines out there to choose from, I took Pelican. Important for me were:

  • Static
  • Markdown or reStructuredText support
  • Content as flat files so I can write posts in vim
  • Git repo for content, theme and stuff
  • Easy templating - I don't like web design stuff (as you probably can see), so I want to do as little of that as possible
  • Optional dynamic commenting system
  • Atom or RSS feed

I may add some commenting system later though, unfortunately this means that the site won't be totally static anymore since it needs to store and read these comments somewhere. I don't want to use any third party system such as Disqus so there's no way around that, oh well.

Kay, technical stuff done. So this blog will be about nerdy things in general, a place where I can document projects I do and stuff like that. Definitely more technical oriented than my old German blog. The old WordPress based one is still online by the way, but I'll take it down (or export to something static) eventually.

Well then, hope I can fill this place with some life!