I was a bit afraid that getting an UMTS USB stick to work under Linux would be an impossible task. Turns out to be reasonably simple. These notes are for a Huawei K4505 HSPA+ USB stick, as provided by Proximus (Vodaphone group).

Continue reading ‘Mobile broadband USB stick on Linux’ »

Reset

Version 2.0 cards only!

$ gpg-connect-agent
> /hex
> scd serialno
S SERIALNO D0 0
OK
> /echo Lock the user PIN by trying 4 times with a wrong PIN
Lock the user PIN by trying 4 times with a wrong PIN
> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 81 08 40 40 40 40 40 40 40 40
D[0000]  69 83                                              i.
OK
> /echo Locked user PIN
Locked user PIN
> /echo Lock the admin PIN by trying 4 times with a wrong PIN
Lock the admin PIN by trying 4 times with a wrong PIN
> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
D[0000]  69 82                                              i.
OK
> scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
D[0000]  69 83                                              i.
OK
> /echo Locked admin PIN
Locked admin PIN
> /echo Terminate the application
Terminate the application
> scd apdu 00 44 00 00
D[0000] 90 00                                               ..
OK
> /echo Reactivate the application
Reactivate the application
> scd apdu 00 e6 00 00
D[0000] 90 00                                               ..
OK
> /echo card has been reset to factory defaults
card has been reset to factory defaults
> /bye

As already introduced in a previous post, OpenPGP keys have different uses. These uses are: certify other keys, sign data, encrypt communications or storage and authentication. To maximize security, I already have a master key which I only use to certify other keys, but the key flags don’t enforce this.

Continue reading ‘Generating a certify-only OpenPGP key’ »

I was very excited to get our new heating system which uses the OpenTherm protocol to communicate between the boiler and the thermostat. I found the electronic schematics, including PCB design and PIC firmware to make an OpenTherm gateway. This would allow me to plot the different temperatures and modes and learn from the statistics to fine-tune the heating! Only to find out that my, newer, version of the boiler doesn’t use OpenTherm anymore, but uses another type of bus… Back to square one. Here is my journey to reverse-engineer the protocol.

Continue reading ‘Reverse engineering the Elco heating protocol’ »

I needed an oscilloscope that is able to record minutes of signal and export that data to a computer. An oscilloscope is, in fact, nothing more than a analogue-to-digital convertor that samples the input signal fast enough. Exactly what a sound card’s recorder does!

The line-in of my MacBook Pro (6,2) has an input impedance of 28kΩ, and is AC-coupled. So it’s not possible to measure DC voltages. The DC-decoupling capacitor has a 30ms half-time (τ=43.3ms), which makes it capable of measuring down to 3.6 Hz (@-3dB).

Test measurements have shown that 350mV results in 0.115 full-scale deflection, yielding an approximate full-scale voltage of 3V (i.e. ~2.1Vrms).

The setup

The signal that I wanted to measure was 12Vdc, with pulses down to 0V. Putting a 330kΩ resistor in series with the input resulted in a voltage division of ~12.7, bringing the 12V safely below 1V and limiting the maximum current draw to 33µA.

Apparently, by default, Windows Server 2008R2 doesn’t accept Ctrl-Alt-Del keystrokes from the UltraVNC service. This website provided the solution:

  1. “Start menu” -> “Run…” – > gpedit.msc
  2. Navigate to “Computer Configuration” -> “Administrative Templates” -> “Windows Components” -> “Windows Logon Options”
  3. Double-click on the “Disable or enable software Secure Attention Sequence” parameter.
  4. Check “Enable”, then select “Services” in the combobox.
  5. Apply the modification

Trex600 time flown: 0h02 (cumulative model timer: 2h21)

Another try with the Trex 600, another crash… and again related to the rudder. Right after takeoff, the tail was oscillating heavily (yaw-wise, ~7cm amplitude, ~3Hz). I recognized this to be a gyro-issue so I landed and reduced the gyro gain from 30% to 20% (Futaba-scale). This settings still had oscillations, but they were slower and wider. Further reducing the gain (I went down to 5%) further reduced the frequency (down to ~1Hz), but didn’t stop the oscillation. Also, it became quite unstable as well.

Cyclic was still too sensitive, but I wanted to fix the rudder first; which turned out to be a wrong decision. Next thing I tried was switching to non-heading-hold mode. As soon as I switched heading-hold off, the heli started a pirouette and ascended. I managed to get it back to the ground, but with the sensitive cyclic I got myself a ground induced unscheduled maintanance.

Continue reading ‘Flight log 2012-07-28’ »

One of the common problems with ZFS-pools, is the inability to shrink a pool. This especially pops up when you try to replace a failing “1TB” disk with another “1TB” disk, and fail to do so:

# zpool create tank raidz /dev/da{1,2,3}
# zpool replace tank da1 da4
cannot replace da1 with da4: device is too small

Even if the drives are both “1TB”, they might differ a few sectors. The only solution for now is to make sure ZFS does not use the full disk when creating the pool, leaving some margin for “shrinking” if needed. One way to accomplish this is to use partitions (or slices) as ZFS vdev’s. This is not recommended, because ZFS can’t use the full disk cache.

Here is my solution: create your pool with sparse files that are just smaller than your disks. How much smaller is up to you, but this is the minimal disk size you will need to replace failing disks. Since the files are sparse, they don’t actually take up much space on the root disk. As soon as the pool is created, replace each sparse file with the corresponding real disk. Make sure autoexpand is set to off, otherwise the pool will be expanded to fill the entire disks, ruining our effort to keep the pool just slightly smaller.

# geom disk list
[...]
Geom name: da1
Providers:
1. Name: da1
   Mediasize: 1153433600 (1.1G)
   Sectorsize: 512
[...]
# foreach i ( 1 2 3 )
      dd if=/dev/zero of=sparse-file-$i.bin bs=512 count=1 seek=`echo 1000000000/512 - 1 | bc`
  end
1+0 records in
1+0 records out
512 bytes transferred in 0.000030 secs (17043521 bytes/sec)
1+0 records in
1+0 records out
512 bytes transferred in 0.000031 secs (16519105 bytes/sec)
1+0 records in
1+0 records out
512 bytes transferred in 0.000030 secs (17043521 bytes/sec)
#
# zpool create tank raidz /root/sparse-file-{1,2,3}.bin
# zpool set autoexpand=off tank
# for i (1 2 3)
      zpool replace tank sparse-file-$i.bin /dev/da$i
  end

 

I’ve been working on a web-interface for my Velbus home automation system for a while now.

Someone once told me: “If you aren’t ashamed of your first release, you waited too long”, so here it is: https://github.com/niobos/velbusd

Socat is the swiss army knife of networking. Getting it installed on dd-wrt took me some trail and error to find a compatible version. This version from OpenWRT seems to work, and requires the libssl and libcrypto library (which I already have installed).