From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=32962 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdPUJ-00012a-EB for qemu-devel@nongnu.org; Thu, 13 Jan 2011 10:53:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdPUI-00062F-83 for qemu-devel@nongnu.org; Thu, 13 Jan 2011 10:53:23 -0500 Received: from mail-qy0-f173.google.com ([209.85.216.173]:63530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdPUI-000629-4V for qemu-devel@nongnu.org; Thu, 13 Jan 2011 10:53:22 -0500 Received: by qyl38 with SMTP id 38so2851205qyl.4 for ; Thu, 13 Jan 2011 07:53:21 -0800 (PST) Message-ID: <4D2F1FA3.5030701@codemonkey.ws> Date: Thu, 13 Jan 2011 09:52:03 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] paravirtual mouse/tablet References: <4D2ED1C8.7070304@redhat.com> In-Reply-To: <4D2ED1C8.7070304@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: spice-devel , "qemu-devel@nongnu.org" On 01/13/2011 04:19 AM, Gerd Hoffmann wrote: > Hi, > > Just throwing a quick writeup into the ring to kickstart the design > discussion ;) > > cheers, > Gerd > #ifndef __QEMU_PVTABLET__ > #define __QEMU_PVTABLET__ 1 > > /* > * qemu patavirtual tablet interface > */ > > #include > > /* our virtio-serial channel */ > #define QEMU_PVTABLET_NAME "org.qemu.pvtablet.0" > > enum qemu_pvtablet_buttons { > QEMU_PVTABLET_BTN_LEFT, > QEMU_PVTABLET_BTN_RIGHT, > QEMU_PVTABLET_BTN_MIDDLE, > /* > * we can handle up to 32 buttons although > * not every has a individual name;) > */ > }; > > /* send button down+up events */ > typedef struct qemu_pvtablet_button { > uint32_t button; > uint32_t mask; > } qemu_pvtablet_button; > > /* send pointer move events */ > typedef struct qemu_pvtablet_position { > uint32_t pos_x; /* range: 0 -> 0xffff */ > uint32_t pos_y; /* range: 0 -> 0xffff */ > } qemu_pvtablet_position; > > Let's add feature negotiation and not hardcode the resolution. typedef enum qemu_pvtablet_features { /* None yet */ }; /* host->guest, sent before any other events */ typedef struct qemu_pvtablet_init { uint32_t res_x; /* x axis resolution */ uint32_t res_y; /* y axis resolution */ uint32_t features; /* qemu_pvtablet_features */ } qemu_pvtablet_init; /* guest->host, sent after pvtablet_init. host will not send additional messages until this is received */ typedef struct qemu_pvtablet_ack { uint32_t features; /* qemu_pvtable_features */ }; > enum qemu_pvtablet_type { > QEMU_PVTABLET_MSG_MOVE, /* qemu_pvtablet_position */ > QEMU_PVTABLET_MSG_BTN_DOWN, /* qemu_pvtablet_button */ > QEMU_PVTABLET_MSG_BTN_UP, /* qemu_pvtablet_button */ > QEMU_PVTABLET_MSG_INIT, /* qemu_pvtable_init */ QEMU_PVTABLE_MSG_ACK, /* qemu_pvtable_ack */ Regards, Anthony Liguori > }; > > typedef struct qemu_pvtablet_message { > uint32_t size; /* whole message size */ > uint32_t type; /* qemu_pvtablet_type */ > uint64_t tv_secs; > uint64_t tv_usecs; > union { > qemu_pvtablet_position position; > qemu_pvtablet_button button; > qemu_pvtablet_display display; > } m; > } qemu_pvtablet_message; > > #endif /* __QEMU_PVTABLET__ */ >