SegFault

How much memory is required for malloc(0) ?

Why doing nothing is inefficient.

Jan 30 2021

At first glance, the answer seems clear: A request to allocate no memory should not require any memory at all. However, it is easily possible to exhaust all available memory without ever allocating more than zero bytes. But before we take a look at malloc(0) lets first check the simpler case of malloc(1).

Milight Bridge problems and protocol

Jan 6 2021

While building my smart-home solution, one of the objectives was to integrate existing Milight lamps. Those lamps are similar to Philips Hue, however, those lamps are a lot cheaper and are available in a wider range of sockets. They are connected to the home wireless network using a bridge similar to hue bridge and can be controlled using an app on your smartphone after they are connected. The app uses a simple UDP protocol to connect to the bridge, which can be easily sniffed using Wireshark.

Reset a USB device on Linux

Dec 10 2020

In one of my projects, a USB Bluetooth stick was placed in a place that is not accessible anymore. However, after building it was found out that after changing into power saving mode the stick does not work correctly anymore, which was only solvable by disconnecting and reconnecting it to the port. However we do not have the possibility to do this anymore, so another solution had to be found. The result is a small c program that allows you to reset a USB port, which to the USB stick looks as if it was reconnected.