Merge some changes from setarcos' fork

… and then fix a few bits. Sadly, still not working with recent ec3
firmware.