[Spice-devel] [Qemu-devel] paravirtual mouse/tablet

Anthony Liguori anthony at codemonkey.ws
Thu Jan 13 07:52:03 PST 2011


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<inttypes.h>
>
> /* 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__ */
>    



More information about the Spice-devel mailing list