Revision 5a49d3e9 spice-qemu-char.c
b/spice-qemu-char.c | ||
---|---|---|
3 | 3 |
#include "ui/qemu-spice.h" |
4 | 4 |
#include <spice.h> |
5 | 5 |
#include <spice-experimental.h> |
6 |
#include <spice/protocol.h> |
|
6 | 7 |
|
7 | 8 |
#include "osdep.h" |
8 | 9 |
|
... | ... | |
67 | 68 |
return bytes; |
68 | 69 |
} |
69 | 70 |
|
71 |
#if SPICE_SERVER_VERSION >= 0x000c02 |
|
72 |
static void vmc_event(SpiceCharDeviceInstance *sin, uint8_t event) |
|
73 |
{ |
|
74 |
SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); |
|
75 |
int chr_event; |
|
76 |
|
|
77 |
switch (event) { |
|
78 |
case SPICE_PORT_EVENT_BREAK: |
|
79 |
chr_event = CHR_EVENT_BREAK; |
|
80 |
break; |
|
81 |
default: |
|
82 |
dprintf(scd, 2, "%s: unknown %d\n", __func__, event); |
|
83 |
return; |
|
84 |
} |
|
85 |
|
|
86 |
dprintf(scd, 2, "%s: %d\n", __func__, event); |
|
87 |
trace_spice_vmc_event(chr_event); |
|
88 |
qemu_chr_be_event(scd->chr, chr_event); |
|
89 |
} |
|
90 |
#endif |
|
91 |
|
|
70 | 92 |
static void vmc_state(SpiceCharDeviceInstance *sin, int connected) |
71 | 93 |
{ |
72 | 94 |
SpiceCharDriver *scd = container_of(sin, SpiceCharDriver, sin); |
... | ... | |
103 | 125 |
.state = vmc_state, |
104 | 126 |
.write = vmc_write, |
105 | 127 |
.read = vmc_read, |
128 |
#if SPICE_SERVER_VERSION >= 0x000c02 |
|
129 |
.event = vmc_event, |
|
130 |
#endif |
|
106 | 131 |
}; |
107 | 132 |
|
108 | 133 |
|
... | ... | |
242 | 267 |
|
243 | 268 |
return chr; |
244 | 269 |
} |
270 |
|
|
271 |
#if SPICE_SERVER_VERSION >= 0x000c02 |
|
272 |
CharDriverState *qemu_chr_open_spice_port(QemuOpts *opts) |
|
273 |
{ |
|
274 |
CharDriverState *chr; |
|
275 |
SpiceCharDriver *s; |
|
276 |
const char *name = qemu_opt_get(opts, "name"); |
|
277 |
|
|
278 |
if (name == NULL) { |
|
279 |
fprintf(stderr, "spice-qemu-char: missing name parameter\n"); |
|
280 |
return NULL; |
|
281 |
} |
|
282 |
|
|
283 |
chr = chr_open(opts, "port"); |
|
284 |
s = chr->opaque; |
|
285 |
s->sin.portname = name; |
|
286 |
|
|
287 |
return chr; |
|
288 |
} |
|
289 |
#endif |
Also available in: Unified diff