Revision 5a49d3e9

b/qemu-char.c
2762 2762
#endif
2763 2763
#ifdef CONFIG_SPICE
2764 2764
    { .name = "spicevmc",     .open = qemu_chr_open_spice },
2765
#if SPICE_SERVER_VERSION >= 0x000c02
2766
    { .name = "spiceport",    .open = qemu_chr_open_spice_port },
2767
#endif
2765 2768
#endif
2766 2769
};
2767 2770

  
b/qemu-options.hx
1749 1749
#endif
1750 1750
#if defined(CONFIG_SPICE)
1751 1751
    "-chardev spicevmc,id=id,name=name[,debug=debug]\n"
1752
    "-chardev spiceport,id=id,name=name[,debug=debug]\n"
1752 1753
#endif
1753 1754
    , QEMU_ARCH_ALL
1754 1755
)
......
1776 1777
@option{tty},
1777 1778
@option{parport},
1778 1779
@option{spicevmc}.
1780
@option{spiceport}.
1779 1781
The specific backend will determine the applicable options.
1780 1782

  
1781 1783
All devices must have an id, which can be any string up to 127 characters long.
......
1961 1963

  
1962 1964
Connect to a spice virtual machine channel, such as vdiport.
1963 1965

  
1966
@item -chardev spiceport ,id=@var{id} ,debug=@var{debug}, name=@var{name}
1967

  
1968
@option{spiceport} is only available when spice support is built in.
1969

  
1970
@option{debug} debug level for spicevmc
1971

  
1972
@option{name} name of spice port to connect to
1973

  
1974
Connect to a spice port, allowing a Spice client to handle the traffic
1975
identified by a name (preferably a fqdn).
1976

  
1964 1977
@end table
1965 1978
ETEXI
1966 1979

  
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
b/trace-events
535 535
spice_vmc_read(int bytes, int len) "spice read %d of requested %d"
536 536
spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
537 537
spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
538
spice_vmc_event(int event) "spice vmc event %d"
538 539

  
539 540
# hw/lm32_pic.c
540 541
lm32_pic_raise_irq(void) "Raise CPU interrupt"
b/ui/qemu-spice.h
46 46
void do_info_spice(Monitor *mon, QObject **ret_data);
47 47

  
48 48
CharDriverState *qemu_chr_open_spice(QemuOpts *opts);
49
#if SPICE_SERVER_VERSION >= 0x000c02
50
CharDriverState *qemu_chr_open_spice_port(QemuOpts *opts);
51
#endif
49 52

  
50 53
#else  /* CONFIG_SPICE */
51 54
#include "monitor.h"

Also available in: Unified diff