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

Alon Levy alevy at redhat.com
Mon Oct 22 01:53:00 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?

We could also use the existing SPICE_CLIENT_AGENT_DATA message, extending the ports to include an additional client port, keeping it compatible with multiple clients in the future. But otoh I like that your suggestion is simpler, I don't like that multiplexing that much.

> 
> --
> Best Regards,
> 
> Dunrong Huang
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list