+/* vdagent interface - to get mouse/clipboarde support */
+static int
+vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
+{
+ spiceTerm *vt = SPICE_CONTAINEROF(sin, spiceTerm, vdagent_sin);
+
+ VDIChunkHeader *hdr = (VDIChunkHeader *)buf;
+ VDAgentMessage *msg = (VDAgentMessage *)&hdr[1];
+
+ //g_assert(hdr->port == VDP_SERVER_PORT);
+ g_assert(msg->protocol == VD_AGENT_PROTOCOL);
+
+ DPRINTF(1, "%d %d %d %d", len, hdr->port, msg->protocol, msg->type);
+
+ if (msg->type == VD_AGENT_MOUSE_STATE) {
+ VDAgentMouseState *info = (VDAgentMouseState *)&msg[1];
+ spiceterm_motion_event(vt, info->x, info->y, info->buttons);
+ } else if (msg->type == VD_AGENT_ANNOUNCE_CAPABILITIES) {
+ /* ignore for now */
+ } else if (msg->type == VD_AGENT_MONITORS_CONFIG) {
+ /* ignore for now */
+ } else {
+ DPRINTF(0, "got uknown vdagent message type %d\n", msg->type);
+ }
+
+ return len;
+}
+
+static int
+vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
+{
+ DPRINTF(1, "%d", len);
+
+ return 0;
+}
+
+static void
+vmc_state(SpiceCharDeviceInstance *sin, int connected)
+{
+ /* IGNORE */
+}
+
+static SpiceCharDeviceInterface my_vdagent_sif = {
+ .base.type = SPICE_INTERFACE_CHAR_DEVICE,
+ .base.description = "spice virtual channel char device",
+ .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
+ .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
+ .state = vmc_state,
+ .write = vmc_write,
+ .read = vmc_read,
+};
+
+static spiceTerm *
+create_spiceterm(int argc, char** argv, int maxx, int maxy, guint timeout)