qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex David <alex.daerf@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Fwd: Trying to write a new device / virtio-i2c ?
Date: Tue, 18 Feb 2014 14:44:49 +0100	[thread overview]
Message-ID: <CAA17Vo9HjDO2YGoa--A2zESOf6xEW4zddM4Wxhtx2MwBrDiM3g@mail.gmail.com> (raw)
In-Reply-To: <53035AAC.4030708@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3160 bytes --]

Ok, thank you very much for your help then. I'm gonna spend some time on
this.

If qemu-dev / you are interested in what I've done later, I'll send a new
mail.



2014-02-18 14:05 GMT+01:00 Paolo Bonzini <pbonzini@redhat.com>:

> Il 18/02/2014 13:48, Alex David ha scritto:
>
>>
>> 2014-02-17 17:11 GMT+01:00 Paolo Bonzini <pbonzini@redhat.com
>> <mailto:pbonzini@redhat.com>>:
>>
>>
>>     Il 17/02/2014 16:33, Alex David ha scritto:
>>
>>             If you need more than one bus, you need a new device
>>         exposing the
>>             I2C bus, besides the new sensor devices.  USB-I2C could be
>>         one such
>>             device.
>>
>>         So let me see if I understood well. USB-I2C (host QEMU device)
>>         seems a
>>         good idea, I could normally do : qemu-system-i386 -device
>>         usb-I2c,chardev=foo -device usb-i2c,chardev=bar -chardev
>>         socket,path=/tmp/test0,server,__nowait,id=foo -chardev
>>         socket,path=/tmp/test1,server,__nowait,id=bar.
>>
>>
>>
>>     Almost. For QOM:
>>
>>         -device usb-i2c,id=usb-i2c-0
>>         -device i2c-my-sensor,address=0x48,__bus=usb-i2c-0.0
>>
>>     For chardev:
>>
>>         -device usb-i2c,id=usb-i2c-0
>>         -chardev socket,path=/tmp/test0,server,__nowait,id=chr-foo-0
>>         -device
>>     i2c-my-sensor,address=0x48,__bus=usb-i2c-0.0,chardev=chr-__foo-0
>>
>>
>>     Repeat for the other buses, replacing -0 with -1 and -2.
>>
>>
>>         I need a "USB-I2C guest kernel driver" that would register a bus
>>         (i2c-1
>>         for chardev foo, i2c-2 for chardev bar etc...), I guess ?
>>
>>
>>     It exists already, drivers/i2c/busses/i2c-tiny-usb.c.
>>
>>
>> I'm now trying to write this new USB-I2C device, I look through some of
>> the code (dev-serial, dev-...), I used dev-serial code and removed the
>> code that wanted to declare a chardev (I don't need one to create my
>> bus, right ?).
>>
>> Now I'm wondering, how will be i2c-tiny-usb launched and declare a new
>> /dev/i2c-N, with my device. I found :
>>
>> static struct usb_device_id i2c_tiny_usb_table [] = {
>>     { USB_DEVICE(0x0403, 0xc631) },   /* FTDI */
>>     { USB_DEVICE(0x1c40, 0x0534) },   /* EZPrototypes */
>>     { }                               /* Terminating entry */
>> };
>>
>> So I figured my USB-I2C should register using these numbers ?
>>
>> static const USBDesc desc_i2c = {
>>     .id = {
>>         .idVendor          = 0x0403,
>>         .idProduct         = 0xc631,
>>         .bcdDevice         = 0x0400,
>>         .iManufacturer     = STR_MANUFACTURER,
>>         .iProduct          = STR_PRODUCT_I2C,
>>         .iSerialNumber     = STR_SERIALNUMBER,
>>     },
>>     .full = &desc_device,
>>     .str  = desc_strings,
>> };
>>
>> However, this doesn't work, after a $ qemu-system-i386
>> debian_wheezy_i386_standard.qcow2 -usb -device USB-I2C,id=usb-i2c-0, the
>> driver doesn't seem to be used (/sys/class/i2c-dev/i2c-0/name isn't for
>> it...), even if I modprobe i2c-tiny-usb...
>> The dmesg shows it doesn't go into the "probe" function.
>>
>> What did I miss ?
>>
>
> I honestly don't know, you'll have to debug it.
>
> Paolo
>

[-- Attachment #2: Type: text/html, Size: 4211 bytes --]

  reply	other threads:[~2014-02-18 13:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 13:26 [Qemu-devel] Trying to write a new device / virtio-i2c ? Alex David
2014-02-14 15:26 ` Stefan Hajnoczi
2014-02-14 15:58 ` Paolo Bonzini
2014-02-14 16:31   ` Andreas Färber
2014-02-14 16:45     ` Paolo Bonzini
2014-02-17  8:35       ` Alex David
2014-02-17  9:19         ` Paolo Bonzini
     [not found]           ` <CAA17Vo9E9D-jPa3gwhsui3i=APz1FM-41jbK+zpOm2tWf7swdw@mail.gmail.com>
2014-02-17  9:38             ` [Qemu-devel] Fwd: " Alex David
2014-02-17  9:55               ` Paolo Bonzini
     [not found]                 ` <CAA17Vo_cBCbKkqDu2zQ0DW2FoAyVqxVXGtNGArJ1tnk6N9AUqA@mail.gmail.com>
2014-02-17 10:38                   ` Paolo Bonzini
2014-02-17 12:23                     ` Alex David
2014-02-17 13:11                       ` Alex David
2014-02-17 13:19                         ` Paolo Bonzini
2014-02-17 13:32                           ` Alex David
2014-02-17 14:30                             ` Paolo Bonzini
2014-02-17 15:33                               ` Alex David
2014-02-17 16:11                                 ` Paolo Bonzini
2014-02-18 12:48                                   ` Alex David
2014-02-18 13:05                                     ` Paolo Bonzini
2014-02-18 13:44                                       ` Alex David [this message]
2014-02-18 13:47                                         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA17Vo9HjDO2YGoa--A2zESOf6xEW4zddM4Wxhtx2MwBrDiM3g@mail.gmail.com \
    --to=alex.daerf@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).