I have followed the steps in https://gist.github.com/jonte/b4bd83a5f2e8330418b1f3322bff74f2 to simulate a tmp105 temperature sensor with QEMU:
Assuming you have the qemu sources in the qemu directory:
cd qemu
echo "CONFIG_TMP105=y" >> default-configs/i386-softmmu.mak
./configure && make
then launching QEmu
build/qemu-system-x86_64 \
--enable-kvm \
-hda ~/Projects/qemu/virtualdebian.img \
-m 1G \
-device tmp105,id=sensor,address=0x50 \
-qmp unix:$HOME/qmp.sock,server,nowait \
-nic user
but afterwards, when I try to write the temperature it fails like this:
$ scripts/qmp/qom-get -s $HOME/qmp.sock sensor.temperature
0
$ scripts/qmp/qom-get -s $HOME/qmp.sock sensor.temperature
0
$ scripts/qmp/qom-set -s $HOME/qmp.sock sensor.temperature 1
Traceback (most recent call last):
File "scripts/qmp/qom-set", line 66, in <module>
print(srv.command('qom-set', path=path, property=prop, value=value))
File "scripts/qmp/../../python/qemu/qmp.py", line 274, in command
raise QMPResponseError(ret)
qemu.qmp.QMPResponseError: Invalid parameter type for 'temperature', expected: integer
In happens also with tmp421 temperature sensor.
Do you know how to fix this error? And why it happens?