|
From: | Alex David |
Subject: | Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ? |
Date: | Mon, 17 Feb 2014 14:32:58 +0100 |
Il 17/02/2014 14:11, Alex David ha scritto:You mean crashes your host?
I've tried using tmp105. As my linux isn't 64bits, i'm using
qemu-system-i386... It crashes my computer when I use it with my linux
image (it's a debian .qcow2..., easy to do some tests...).
Depends on how much data. If it's just one or two ints, like tmp105, QOM would work too. qmp-shell talks to QEMU via a simple JSON protocol, and it has simple Python bindings too.
I will most probably need a chardev anyways, I will need to read/write
data when I want to.
Yes, using dc->props.
static const TypeInfo mydevice_i2c_type_info = {
.name = TYPE_MYDEVICE_I2C,
.parent = TYPE_I2C_SLAVE,
.instance_size = sizeof(MYDEVICEI2CState),
.instance_init = MYDEVICE_i2c_init,
.class_init = mydevice_i2c_class_init,
};
I will be able to add a chardev using the properties, right ?
Your device is not i2c-0. i2c-0 is provided by the PC board. Your device will get one address, e.g. 0x42, on the i2c bus. You'll be able to access it with i2cget and i2cset using "0" as the bus address (for i2c-0) and 0x42 as the device address on bus 0.
Does this seems ok for you ? So far, I understood the "props" are needed
for when I'm gonna declare the device at QEMU launch.
I am not sure if it's needed (my i2c-0 should be created anyways), but
in that case, how do I "plug" it on my socket on the host ?
So you'll indeed have to do something like "-chardev socket,id=foo -device myi2c,address=0x42,chr=foo" if you go for sockets, or just "-device myi2c,address=0x42" if you go for QOM. The "chr" property should go into dc->props, while "address" is provided by the abstract class TYPE_I2C_SLAVE.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |