From: Gerd Hoffmann <kraxel@redhat.com>
To: Tim Sander <tim@krieglstein.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC] i2c-tiny-usb
Date: Fri, 27 Nov 2015 07:48:21 +0100 [thread overview]
Message-ID: <1448606901.8613.135.camel@redhat.com> (raw)
In-Reply-To: <1664220.kcr3K9QWbf@dabox>
On Do, 2015-11-26 at 17:35 +0100, Tim Sander wrote:
> Hi
>
> Below is a patch implementing the i2c-tiny-usb device.
Is there a specification for this kind of device?
Or does it mimic existing hardware?
Please add that into to the comment at the head of the file.
> +#ifdef DEBUG_USBI2C
> +#define DPRINTF(fmt, ...) \
> +do { printf("usb-i2c-tiny: " fmt , ## __VA_ARGS__); } while (0)
> +#else
> +#define DPRINTF(fmt, ...) do {} while (0)
> +#endif
Please consider turning them into trace points.
> +static const USBDescIface desc_iface0 = {
> + .bInterfaceNumber = 1,
> + .bNumEndpoints = 0,
> + .bInterfaceClass = 0xff,
> + .bInterfaceSubClass = 0xff,
> + .bInterfaceProtocol = 0xff,
> + .eps = (USBDescEndpoint[]) {
> + }
> +};
Hmm? No endpoints?
> +static void usb_i2c_handle_control(USBDevice *dev, USBPacket *p,
> + int request, int value, int index, int length, uint8_t *data)
> +{
> + case 0xc101:
> + {
> + /* thats what the real thing reports, FIXME: can we do better here? */
> + uint32_t func = htole32(I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL);
> + DPRINTF("got functionality read %x, value %x\n", request, value);
> + memcpy(data, &func, sizeof(func));
> + p->actual_length = sizeof(func);
> + }
> + break;
Ah, it all goes over the control pipe.
> +static USBDevice *usb_i2c_init(USBBus *bus, const char *filename)
Please drop this ...
> + usb_legacy_register("usb-i2c-tiny", "i2c-bus-tiny", usb_i2c_init);
... and this.
It's for backward compatibility with old qemu versions (-usbdevice ...),
and we don't need that for new devices.
cheers,
Gerd
next prev parent reply other threads:[~2015-11-27 6:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 16:35 [Qemu-devel] [PATCH RFC] i2c-tiny-usb Tim Sander
2015-11-26 18:07 ` Alex Bennée
2015-11-27 8:41 ` Tim Sander
2015-11-27 9:35 ` Markus Armbruster
2015-11-27 11:57 ` Alex Bennée
2015-11-27 6:48 ` Gerd Hoffmann [this message]
2015-11-27 10:59 ` Tim Sander
[not found] ` <56582329.5040304@redhat.com>
2015-11-27 12:39 ` Tim Sander
2015-11-27 12:53 ` Paolo Bonzini
2015-12-09 16:40 ` [Qemu-devel] i2c data address question was " Tim Sander
2015-12-09 17:04 ` Paolo Bonzini
2015-12-16 15:56 ` [Qemu-devel] [PATCH] i2c-tiny-usb: add new usb to i2c bridge Tim Sander
2015-12-17 16:15 ` Gerd Hoffmann
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=1448606901.8613.135.camel@redhat.com \
--to=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tim@krieglstein.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.