Skip to content

Instantly share code, notes, and snippets.

View jonte's full-sized avatar
🍺
Cheers!

Jonatan Pålsson jonte

🍺
Cheers!
View GitHub Profile
GVariant *v = g_variant_dict_end(priv->prop_changed_dict);
GVariantBuilder *vb = g_variant_builder_new(g_variant_type_new("(sa{sv}as)"));
g_variant_builder_add(vb, "s", "Hello world");
g_variant_builder_add(vb, "a{sv}", v);
g_variant_builder_add(vb, "s", NULL);
@jonte
jonte / listfiles.py
Created January 20, 2013 10:43
Hack to parse FAT32
import struct
import sys
def getBytes(fs, pos, numBytes):
fs.seek(pos)
byte = fs.read(numBytes)
if (numBytes == 2):
formatString = "H"
elif (numBytes == 1):
formatString = "B"
@jonte
jonte / tmp105.md
Last active March 30, 2024 13:07
Emulating a tmp105 temperature sensor using QEMU and Linux

This will configure QEMU to expose a tmp105 temperature sensor on the i2c-0 bus on x86_64. The temterature sensor can have its temperature set from the host OS, and the temperature can be read from the Linux client OS using the lm75 kernel module.

Building QEMU

For convenience, we will be emulating an x86 system. The x86 configuations which QEMU ships with do not contain the tmp105 sensor we will be using, so first we need to enable it.

Assuming you have the qemu sources in the qemu directory:

# cd qemu

echo "CONFIG_TMP105=y" >> default-configs/i386-softmmu.mak