[Spice-devel] [RFC] Implement of file drag-and-drop between host and guest

Dunrong Huang riegamaths at gmail.com
Sat Oct 20 02:06:32 PDT 2012


Hi, all

I want to implement the feature: file drag-and-drop between the host and
guest. But i dont know whether someone is working on it, if this feature
has not been implemented, i want to implement it in my spare time.

Any suggestion is welcome.

My idea is:

0) Now i only consider file drag-n-drog from host to linux guest.

1) On QEMU side. virtserialport and spicevmc are used as communication
channel, e.g.
$ qemu -chardev spicevmc,id=charchannel0,name=filetrans -device
virtserialport,chardev=charchannel0,name=filetransfer

Because Hans has made spicevmc generic channel(commit c03038), we dont
need to change any code in QEMU for using spicevmc as backend of
virtualserialport.

2) On guest side. Use a simple daemon, or hack spice-agent to read/write
virtserialport mentioned above for receiving/sending file content.

Since we just want to receive/send file, the message protocol is simple.

3) On spice server side. Attach a new SpiceCharDevice for communication
with spice client and guset, rather than creating a new channel.
e.g.
static int spice_server_char_device_add_interface(SpiceServer *s,
                                           SpiceBaseInstance *sin)
{
    // [..snip..]
    if (strcmp(char_device->subtype, SUBTYPE_FILETRANSFER) == 0) {
        dev_state = attach_to_filetransfer(char_device);
    }
    // [..snip..]
}

The reason why i dont create a new channel is: a new channel wont
register util guest open the virtserialport. in this case, if spice client
connects to spice server, it can not receive any information about
the channel we created and will not create client channel for it.

4) On spice client. Spice client receives the message server passed to
it, handles the signal related "drag-n-drog", provide the callback for
handling it.


hans, Marc-André, any suggestion?

-- 
Best Regards,

Dunrong Huang


More information about the Spice-devel mailing list