Updating OpenBSD

August 12, 2019

OpenBSD has a few different mechanism to update, depending on what the update is for.

For packages:
pkg_add -u

For the kernel and base system:
syspatch

For firmware:
fw_update

All of these need to get run with doas if you’re not root.

Finally, if you’re moving from one version to another:
sysupgrade
sysmerge
pkg_add -u


Using an esp32 as an iBeacon

August 4, 2019

I recently discovered the esp32, which is an interesting device that has Bluetooth as well as wifi built in. That got me thinking about setting one up as an iBeacon.

First, I added my board in the File->Preferences->Additional Boards Manager URLs: https://dl.espressif.com/dl/package_esp32_index.json was what I needed.

My next move was to install the 1.0.1 version of ESP32 BLE Arduino by Neil Kolban. Tools->Manage Libraries-> Select 1.0.1 and click Install.

From there, the BLE iBeacon example should be available. Under “Examples from Custom Libraries” you’llĀ  File->Examples and under “Examples from Custom Libraries” you’ll see ESP32 BLE Arduino->BLE_iBeacon.

Strangely, this example gets the BLE ID backwards according to my scanner app. It looks as if there might be a fix in the latest (1.0.1-dev) source, but for now I just enter my UUID backwards. On the line

#define BEACON_UUID "00112233-4455-6677-8899-aabbccddeeff" // UUID 1 128-Bit

I use instead:

#define BEACON_UUID "ffeeccdd-bbaa-9988-7766-554433221100" // UUID 1 128-Bit

Thanks to C, I didn’t need to do the two’s complement of the signal power myself:

  oBeacon.setSignalPower(-58);

Finally, I was getting advertising packets for multiple things (including an old test I’d tried). I had to erase the flash:

esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash

and then re-download in order to have only my iBeacon transmitting.