Re: [Spice-devel] [spice-gtk] [PATCH] Provide a method to check if a USB device matches a specific class, subclass and protocol

2014-11-11 Thread Cody Chan
Great!
Is there a good way to let it work for windows client?
libusb is not fully support for windows...
I tried to build libwdi with WDK, but I don't think it's a good way.

On Tue, Nov 11, 2014 at 10:29 PM, Fabiano Fidêncio 
wrote:

> As we only can filter USB devices by their Classes and sometimes it is
> not enough (eg: I do not want to have Keyboard and Mouse, but want to
> have have Joysticks, being all of them part of HID Class), provide to
> the applications a way match the device itself with the desired Class,
> SubClass and Protocol, so the applications refine the filter provided
> by usbredir.
> ---
> This patch was written based on
> https://bugzilla.gnome.org/show_bug.cgi?id=698430
> Any suggestion to have a shorter short-log is welcome :-)
> ---
>  gtk/map-file |  1 +
>  gtk/spice-glib-sym-file  |  1 +
>  gtk/usb-device-manager.c | 96
> 
>  gtk/usb-device-manager.h |  1 +
>  4 files changed, 99 insertions(+)
>
> diff --git a/gtk/map-file b/gtk/map-file
> index 9f8d04e..6bbf407 100644
> --- a/gtk/map-file
> +++ b/gtk/map-file
> @@ -124,6 +124,7 @@ spice_usb_device_manager_get_devices;
>  spice_usb_device_manager_get_devices_with_filter;
>  spice_usb_device_manager_get_type;
>  spice_usb_device_manager_is_device_connected;
> +spice_usb_device_matches_interface;
>  spice_usb_device_widget_get_type;
>  spice_usb_device_widget_new;
>  spice_usbredir_channel_get_type;
> diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
> index 2189fa5..83f7f18 100644
> --- a/gtk/spice-glib-sym-file
> +++ b/gtk/spice-glib-sym-file
> @@ -101,6 +101,7 @@ spice_usb_device_manager_get_devices
>  spice_usb_device_manager_get_devices_with_filter
>  spice_usb_device_manager_get_type
>  spice_usb_device_manager_is_device_connected
> +spice_usb_device_matches_interface
>  spice_usbredir_channel_get_type
>  spice_util_get_debug
>  spice_util_get_version_string
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index 5013b6c..6749b0d 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -706,6 +706,30 @@ static gboolean
> spice_usb_device_manager_get_device_descriptor(
>  return TRUE;
>  }
>
> +static gboolean spice_usb_device_manager_get_config_descriptor(
> +libusb_device *libdev,
> +struct libusb_config_descriptor **config)
> +{
> +int errcode;
> +const gchar *errstr;
> +
> +g_return_val_if_fail(libdev != NULL, FALSE);
> +g_return_val_if_fail(config != NULL, FALSE);
> +
> +errcode = libusb_get_active_config_descriptor(libdev, config);
> +if (errcode < 0) {
> +int bus, addr;
> +
> +bus = libusb_get_bus_number(libdev);
> +addr = libusb_get_device_address(libdev);
> +errstr = spice_usbutil_libusb_strerror(errcode);
> +g_warning("Cannot get config descriptor for (%p) %d.%d -- %s(%d)",
> +  libdev, bus, addr, errstr, errcode);
> +return FALSE;
> +}
> +return TRUE;
> +}
> +
>  static gboolean spice_usb_device_manager_get_libdev_vid_pid(
>  libusb_device *libdev, int *vid, int *pid)
>  {
> @@ -1726,7 +1750,79 @@ gchar
> *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *for
>  #endif
>  }
>
> +static guint8 spice_usb_device_get_interface_class(libusb_device *libdev)
> +{
> +struct libusb_config_descriptor *config;
> +guint8 interface_class;
> +
> +g_return_val_if_fail(libdev != NULL, 0);
> +
> +config = g_malloc(sizeof(*config));
> +spice_usb_device_manager_get_config_descriptor(libdev, &config);
> +interface_class = config->interface->altsetting->bInterfaceClass;
> +libusb_free_config_descriptor(config);
> +
> +return interface_class;
> +}
> +
> +static guint8 spice_usb_device_get_interface_subclass(libusb_device
> *libdev)
> +{
> +struct libusb_config_descriptor *config;
> +guint8 interface_subclass;
> +
> +g_return_val_if_fail(libdev != NULL, 0);
> +
> +config = g_malloc(sizeof(*config));
> +spice_usb_device_manager_get_config_descriptor(libdev, &config);
> +interface_subclass =
> config->interface->altsetting->bInterfaceSubClass;
> +libusb_free_config_descriptor(config);
> +
> +return interface_subclass;
> +}
> +
> +static guint8 spice_usb_device_get_interface_protocol(libusb_device
> *libdev)
> +{
> +struct libusb_config_descriptor *config;
> +guint8 interface_protocol;
> +
> +g_return_val_if_fail(libdev != NULL, 0);
> +
> +config = g_malloc(sizeof(*config));
> +spice_usb_device_manager_get_config_descriptor(libdev, &config);
> +interface_protocol =
> config->interface->altsetting->bInterfaceProtocol;
> +libusb_free_config_descriptor(config);
> +
> +return interface_protocol;
> +}
> +
> +/**
> + * spice_usb_device_matches_interface:
> + * @device: #SpiceUsbDevice to check if the interface info matches with
> + * @class: the interface class to be checked
> + * @subclass: the interface usbcl

Re: [Spice-devel] help, win 7 client, usb redirect failed

2014-09-15 Thread Cody Chan
There're some differences between win7 and winxp in drivers,
maybe mine can help you: http://qiniu-plupload.qiniudn.com/usbclerk4win7.zip
.

BTW, also as a Chinese, I strongly suggest that it's not a good idea
sending mails to this maillist with Chinese signature :)

Regards,
Cody

On Mon, Sep 15, 2014 at 3:48 PM, 陈晴  wrote:

> i installed usbclerk and virt-viewer 0.5.7 in my win7, but it doesn't work
> when select usb to redirect to guest
> (when in win xp client, it works fine)
> the error information is :
> USB redirection error: Could not auto-redirect Toshiba Corp. Kingston
> DataTraveler 2.0 Stick (2GB) [0930:6544] at 1-2: Could not open usb device:
> Operation not supported or unimplemented on this platform [-12]
>
>
>
>
>
> --
>
> 陈晴 浙江清华长三角研究院 信息技术研究所 云计算及分布式系统实验室 系统工程师
>
> 浙江闪龙科技有限公司 系统部经理
>
> 杭州闪龙信息科技有限公司 系统部经理
>
> 手机:15067300238
>
> 电话:0573-82286614
>
> 传真:0573-89896166
>
> 地址:浙江嘉兴市南湖区亚太路 705 号 314006
>
> 网址:www.tsinghua-zj.edu.cn
>
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
>


-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] What are these directories on virtio-win-0.1-81.iso?

2014-09-14 Thread Cody Chan
For WXP && XP directory, you can refer this:
http://www.ovirt.org/How_to_create_a_Windows_XP_Virtual_Machine#Post_Install_Additions

On Mon, Sep 15, 2014 at 4:52 AM, ToddAndMargo  wrote:

> Hi All
>
> I just downloaded virtio-win-0.1-81.iso from
>
> http://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers
>
> Looking through the ISO, I find two directories: WLH and WNET.
> What are they?
>
> Also, I find a WXP and and XP directory.  Why two of them?
>
> Many thanks,
> -T
>
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] The solution of usbredir display problems for windows, temporarily

2014-09-04 Thread Cody Chan
Ok, this's not a patch, for I don't think it's good enough to be applied to
upstream.
For windows client, it's really not friendly for usbredir:
1. We need usbclerk service to let it redirect automatically --> not stably
currently
2. The display of redir-list is ALL "USB DEVICE" -->  make users confused
maybe
3. Filtering by class doesn't work at all --> usually need to filter input
devices, etc.

The reason for all the above is that libusb supports windows poorly.
So here's the solution for problem 2 & 3,
this's a vs2010 project built with libwdi
, the output is usbutils.dll,
and I put the project in github 

After building libwdi, add LIBWDI_DIR=path\to\libwdi in environment
settings,
then build usbutils project

In gtk/usbutil.c or gtk/usb-device-manager.c ...
do something like this(just an example):
#define MAX_LEN_ 256
typedef struct{
char desc[MAX_LEN_];
int pid;
int vid;
int clas;
}UsbInfo;

//...
UsbInfo usbInfo[20];
typedef int (*fpFun)(UsbInfo[]);
HMODULE hDllLib = LoadLibraryA("usbutils.dll");
fpFun getUsbList = (fpFun)GetProcAddress(hDllLib,"getUsbList");
int num = getUsbList(usbInfo);
for(int i = 0; i < num; ++i){
if(usbInfo[i].pid == pid && usbInfo[i].vid == vid)
return g_strdup_printf("%s [%02X:%04X:%04X]", usbInfo[i].desc,
usbInfo[i].clas, usbInfo[i].vid, usbInfo[i].pid);
//...

​And at last, here's the effect:
http://int64ago.qiniudn.com/o_190vus62h3lh1pr81kf0be6v4b9.png​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-13 Thread Cody Chan
On Wed, Aug 13, 2014 at 11:13 PM, Christophe Fergeau 
wrote:

> On Wed, Aug 13, 2014 at 10:47:14PM +0800, Cody Chan wrote:
> > But you ACKed this:
> >
> http://lists.freedesktop.org/archives/spice-devel/2014-August/017209.html
> > and this's my final version,
> ​​
> doesn't it work?
>
 Since you said you tested this patch and it works for you, I'm trusting
> your tests, I haven't tried that code yet, but I feel comfortable enough
> to ACK it.

Christophe

​Of course, I test it ​carefully, "
​
doesn't it work?" I mean if it's ok to patch to upstream.
Any way, I gave the patch as attachment just now, and I'm so sorry for
my unskilled
work.
Thx you again, you've really encouraged me.

>  >
> >
> > On Wed, Aug 13, 2014 at 10:27 PM, Christophe Fergeau <
> cferg...@redhat.com>
> > wrote:
> >
> > > Hi Cody,
> > >
> > > On Tue, Aug 12, 2014 at 11:40:58AM +0200, Christophe Fergeau wrote:
> > > > On Mon, Aug 11, 2014 at 07:58:44PM +0800, Cody Chan wrote:
> > > > > ​
> > > > > I submitted a patch several months ago about this issue,
> > > > > here
> > > > >
> > >
> http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html
> > > > >
> > > > > I check it again, and find that the value of
> > > > > g_key_file_to_data(keyfile,...) is always utf-8,
> > > > > for the value of g_uri_list_extract_uris() is utf8 urlencode.
> > > > >
> > > > > So the display problem is caused by vd_agent, but how it displays
> > > depends
> > > > > on the
> > > > > language of system, the following two screenshots show the
> difference:
> > > > > http://int64ago-tmp.qiniudn.com/guest-Chinese.png
> > > > > http://int64ago-tmp.qiniudn.com/guest-English.png
> > >
> > > I've tried to apply your patches to the upstream git repository, but
> > > your mailer seems to have corrupted them. Could you try to send them
> > > using git send-email, or if this is not working for you, could you use
> > > git format-patch and send them as an attachment? This would be very
> > > helpful, thanks!
> > >
> > > Christophe
> > >
> >
> >
> >
> > --
> > QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
>
> > ___
> > Spice-devel mailing list
> > Spice-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
>


-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-13 Thread Cody Chan
The attach is the patch​.


On Wed, Aug 13, 2014 at 10:47 PM, Cody Chan  wrote:

> But you ACKed this:
> http://lists.freedesktop.org/archives/spice-devel/2014-August/017209.html
> and this's my final version, doesn't it work?
>
>
> On Wed, Aug 13, 2014 at 10:27 PM, Christophe Fergeau 
> wrote:
>
>> Hi Cody,
>>
>> On Tue, Aug 12, 2014 at 11:40:58AM +0200, Christophe Fergeau wrote:
>> > On Mon, Aug 11, 2014 at 07:58:44PM +0800, Cody Chan wrote:
>> > > ​
>> > > I submitted a patch several months ago about this issue,
>> > > here
>> > >
>> http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html
>> > >
>> > > I check it again, and find that the value of
>> > > g_key_file_to_data(keyfile,...) is always utf-8,
>> > > for the value of g_uri_list_extract_uris() is utf8 urlencode.
>> > >
>> > > So the display problem is caused by vd_agent, but how it displays
>> depends
>> > > on the
>> > > language of system, the following two screenshots show the difference:
>> > > http://int64ago-tmp.qiniudn.com/guest-Chinese.png
>> > > http://int64ago-tmp.qiniudn.com/guest-English.png
>>
>> I've tried to apply your patches to the upstream git repository, but
>> your mailer seems to have corrupted them. Could you try to send them
>> using git send-email, or if this is not working for you, could you use
>> git format-patch and send them as an attachment? This would be very
>> helpful, thanks!
>>
>> Christophe
>>
>
>
>
> --
> QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV


0001-fix-bug-display-error-when-dragging-file-with-CJK-ch.patch
Description: Binary data
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-13 Thread Cody Chan
But you ACKed this:
http://lists.freedesktop.org/archives/spice-devel/2014-August/017209.html
and this's my final version, doesn't it work?


On Wed, Aug 13, 2014 at 10:27 PM, Christophe Fergeau 
wrote:

> Hi Cody,
>
> On Tue, Aug 12, 2014 at 11:40:58AM +0200, Christophe Fergeau wrote:
> > On Mon, Aug 11, 2014 at 07:58:44PM +0800, Cody Chan wrote:
> > > ​
> > > I submitted a patch several months ago about this issue,
> > > here
> > >
> http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html
> > >
> > > I check it again, and find that the value of
> > > g_key_file_to_data(keyfile,...) is always utf-8,
> > > for the value of g_uri_list_extract_uris() is utf8 urlencode.
> > >
> > > So the display problem is caused by vd_agent, but how it displays
> depends
> > > on the
> > > language of system, the following two screenshots show the difference:
> > > http://int64ago-tmp.qiniudn.com/guest-Chinese.png
> > > http://int64ago-tmp.qiniudn.com/guest-English.png
>
> I've tried to apply your patches to the upstream git repository, but
> your mailer seems to have corrupted them. Could you try to send them
> using git send-email, or if this is not working for you, could you use
> git format-patch and send them as an attachment? This would be very
> helpful, thanks!
>
> Christophe
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [spice-gtk] keyboard: wrong defined macro for WIN32

2014-08-13 Thread Cody Chan
Yeah, I have tracked the commit log, and the reconstruction of this part is
a good job of Jonathon ^_^


On Wed, Aug 13, 2014 at 4:57 PM, Marc-André Lureau 
wrote:

> Hi
>
> - Original Message -
> > On windows client, there's no effect for guest when
> > enabling CAPS_LOCK/NUM_LOCK/SCROLL_LOCK on
> > (because of the delay, guest may take the effect for several seconds).
> > There's a wrong defined macro, then  is ALWAYS 0,
> > and the keyboard state of guest is synchronized with the state client
> > by spice_gtk_session_sync_keyboard_modifiers_for_channel(...).
> >
>
> This is a recent regression since v0.25-1-g9c75c7e (not yet released)
>
> Thanks for finding out! ack
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [spice-gtk] keyboard: wrong defined macro for WIN32

2014-08-13 Thread Cody Chan
On windows client, there's no effect for guest when
enabling CAPS_LOCK/NUM_LOCK/SCROLL_LOCK on
(because of the delay, guest may take the effect for several seconds).
There's a wrong defined macro, then  is ALWAYS 0,
and the keyboard state of guest is synchronized with the state client
by spice_gtk_session_sync_keyboard_modifiers_for_channel(...).

​
​
---
 gtk/spice-gtk-session.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index db5c53c..1905a25 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -140,7 +140,7 @@ static guint32 get_keyboard_lock_modifiers(void)
 if (keyboard_state.led_mask & 0x04) {
 modifiers |= SPICE_INPUTS_SCROLL_LOCK;
 }
-#elif defined(win32)
+#elif defined(WIN32)
 if (GetKeyState(VK_CAPITAL) & 1) {
 modifiers |= SPICE_INPUTS_CAPS_LOCK;
 }
--
1.9.3
​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters in name

2014-08-12 Thread Cody Chan
​
I submitted a patch several months ago about this issue,
here
http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html

I check it again, and find that the value of
g_key_file_to_data(keyfile,...) is always utf-8,
for the value of g_uri_list_extract_uris() is utf8 urlencode.

So the display problem is caused by vd_agent, but how it displays depends
on the
language of system, the following two screenshots show the difference:
http://int64ago-tmp.qiniudn.com/guest-Chinese.png
http://int64ago-tmp.qiniudn.com/guest-English.png

​
---
 vdagent/file_xfer.cpp | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..96b7394 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -46,6 +46,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,
 uint64_t file_size;
 HANDLE handle;
 AsUser as_user;
+int wlen;

 status->id = start->id;
 status->result = VD_AGENT_FILE_XFER_STATUS_ERROR;
@@ -81,7 +82,20 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,

 strcat(file_path, "\\");
 strcat(file_path, file_name);
-handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if((wlen = MultiByteToWideChar(CP_UTF8, 0, file_path, -1, NULL, 0)) ==
0){
+vd_printf("failed getting WideChar length of %s", file_path);
+return;
+}
+TCHAR *wfile_path = new TCHAR[wlen];
+if (MultiByteToWideChar(CP_UTF8, 0, file_path, -1, wfile_path, wlen)
== 0){
+vd_printf("failed converting file_path:%s to WindChar", file_path);
+if (wfile_path)
+delete[] wfile_path;
+return;
+}
+handle = CreateFile(wfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if (wfile_path)
+delete[] wfile_path;
 if (handle == INVALID_HANDLE_VALUE) {
 vd_printf("failed creating %s %lu", file_path, GetLastError());
 return;
--
1.9.3

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [spice-gtk] DND: fix special case that file size is 0

2014-08-11 Thread Cody Chan
On Tue, Aug 12, 2014 at 12:58 AM, Marc-André Lureau 
wrote:

>
>
> - Original Message -
> > On windows guest, after dra gging a zero-size file, the file will be
> occupied
> > by vdagent. For spice-gtk ignores this case, and stops sending data after
> > sending
> > a start message to agent, see here for more details:
> >
> http://lists.freedesktop.org/archives/spice-devel/2014-August/017184.html
> > I accept the suggestion of Christophe and fix the bug in spice-gtk.
> > Pay attention to the modification of
> > ​
> > agent_msg_queue_many, I think it's a small trick.
>
> Isn't this changing the protocol?
>
> We use to send xfer-start of data size 0 and then xfer-data of data size
> 0, and now we skip the second part.
>
> That's an an incompatible change. I would prefer if we keep sending the
> xfer-data message, even if it is of size 0.
>
> Or if you prefer don't initiate xfer at all if the file size is 0. But I
> don't think that's worth it, and it would be some "racy" code (check size
> before doing actual operation)

​You mean client shouldn't send a zero-size file?I think sending such file
is ​meaningless, too.
And I prefer this can be fixed through a more comfortable way.

> > ​
> > ​
> > ---
> > gtk/channel-main.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> > index 7a299a4..1e8e3f5 100644
> > --- a/gtk/channel-main.c
> > +++ b/gtk/channel-main.c
> > @@ -936,7 +936,7 @@ static void
> > ​​
> > agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
> > memcpy(payload, &msg, sizeof(VDAgentMessage));
> > payload += sizeof(VDAgentMessage);
> > paysize -= sizeof(VDAgentMessage);
> > - if (paysize == 0) {
> > + if (size != 0 && paysize == 0) {
> > g_queue_push_tail(c->agent_msg_queue, out);
> > out = NULL;
> > }
> > @@ -1637,7 +1637,7 @@ static void file_xfer_read_cb(GObject
> *source_object,
> > return;
> > }
> >
> > - if (count > 0) {
> > + if (count >= 0) {
> > task->read_bytes += count;
> > file_xfer_queue(task, count);
> > file_xfer_flush_async(channel, task->cancellable,
> > --
> > 1.9.3 ​
> >
> > --
> > Q S B D T 0 R F U i B G U k 9 N I F J J R V N U I E 9 G I E N U U 0V V
> >
> > ___
> > Spice-devel mailing list
> > Spice-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [spice-gtk] DND: fix special case that file size is 0

2014-08-11 Thread Cody Chan
On windows guest, after dragging a zero-size file, the file will be occupied
by vdagent. For spice-gtk ignores this case, and stops sending data after
sending
a start message to agent, see here for more details:
http://lists.freedesktop.org/archives/spice-devel/2014-August/017184.html
I accept the suggestion of Christophe and fix the bug in spice-gtk.
Pay attention to the modification of
​
agent_msg_queue_many,  I think it's a small trick.

​
​
---
 gtk/channel-main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7a299a4..1e8e3f5 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -936,7 +936,7 @@ static void
​​
agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
 memcpy(payload, &msg, sizeof(VDAgentMessage));
 payload += sizeof(VDAgentMessage);
 paysize -= sizeof(VDAgentMessage);
-if (paysize == 0) {
+if (size != 0 && paysize == 0) {
 g_queue_push_tail(c->agent_msg_queue, out);
 out = NULL;
 }
@@ -1637,7 +1637,7 @@ static void file_xfer_read_cb(GObject *source_object,
 return;
 }

-if (count > 0) {
+if (count >= 0) {
 task->read_bytes += count;
 file_xfer_queue(task, count);
 file_xfer_flush_async(channel, task->cancellable,
--
1.9.3​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] close the file handler if file_size = 0

2014-08-11 Thread Cody Chan
On Mon, Aug 11, 2014 at 7:04 PM, Christophe Fergeau 
wrote:

> On Sat, Aug 09, 2014 at 06:40:22PM +0800, Cody Chan wrote:
> > After dragging a zero-size file, then I open it in guest,
> > I get a warning message box which says:
> >  "the process cannot access the file because it is being used by another
> > process".
> > And I get to know the file is occupied by vdagent. Now we look back the
> > process:
> >
> > a) When dragging a zero-size file, spice-gtk gets the name and size, then
> > sends
> > the message to vd_agent with VD_AGENT_FILE_XFER_START
> > b) vd_agent receives and parsers the message, then gets file name and
> size,
> > creates(open)
> > the file and gets the handler, at last, sends
> > VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA
> > c) spice-gtk receives the VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA
> message,
> > the sends data with VD_AGENT_FILE_XFER_DATA
> > d) vd_agent receives and writes data to the file opened
> > e) After finishing the writing, vd_agent closes the handler
> >
> > But in step c, we take a look the code:
> > //spice-channel.c
> > >static void file_xfer_read_cb(...)
> > >{
> > >//...
> > >count =
> g_input_stream_read_finish(G_INPUT_STREAM(task->file_stream),
> > res, &error);
> > >if (count > 0) {
> > >task->read_bytes += count;
> > >file_xfer_queue(task, count);
> > >file_xfer_flush_async(channel, task->cancellable,
> > >  file_xfer_data_flushed_cb, task);
> > >task->pending = TRUE;
> > >} else if (error) {
> > >VDAgentFileXferStatusMessage msg = {
> > >.id = task->id,
> > >.result = VD_AGENT_FILE_XFER_STATUS_ERROR,
> > >};
> > >agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_STATUS,
> > > &msg, sizeof(msg), NULL);
> > >spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
> > >file_xfer_completed(task, error);
> > >}
> > >}
> >
> > If count == 0, then it does nothing!
> > Then vd_agent will receive nothing after opening a file, and always
> occupy
> > the file.
> > Here we close the file if file_size = 0, even though it doesn't make
> sense
> > to send
> > a zero-size file.
>
> Ah, good catch, from a quick look it seems the linux agent does not
> handle this case properly either. This can be fixed in both agents, or
> alternatively, this can also be fixed in spice-gtk in file_xfer_read_cb
> by sending a dummy empty data message when the file size is 0.
> Fixing it in the agents is probably less convoluted.
>

​As you've proposed​, I fix the bug in spice-gtk, and I'll send a new patch
after testing.

>
> >
> > ​
> > ---
> >  vdagent/file_xfer.cpp | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
> > index 34a9ee6..17d842e 100644
> > --- a/vdagent/file_xfer.cpp
> > +++ b/vdagent/file_xfer.cpp
> > @@ -89,6 +89,10 @@ void
> FileXfer::handle_start(VDAgentFileXferStartMessage*
> > start,
> >  vd_printf("failed creating %s %lu", file_path, GetLastError());
> >  return;
> >  }
> > +if (file_size == 0){
> > +CloseHandle(handle);
> > +return;
> > +}
>
> The agent should probably return VD_AGENT_FILE_XFER_STATUS_SUCCESS in
> this case to let the client know this is over.
>
> Christophe
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] fix bug: g_key_get_string() is failed when keystring contains '['

2014-08-11 Thread Cody Chan
In vd_agent/file_xfer.cpp, it implemented a simple g_key_get_string,
but  when dragging a file with a name containing '[' (like te[st.txt), it
will be failed.
>From source code,
>next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
>if (next_group_pos && key_pos > next_group_pos) return false;
we know that it tries to find the end of current group by '[' label,
if we drag a file like te[st.txt, the key_string many like:
[vdagent-file-xfer]
name=te[st.txt
size=10
so, it's failed when meta parsing and
returns VD_AGENT_FILE_XFER_STATUS_ERRO message.

Here's the elegant method Christophe proposed and test ok, thanks for him
again!

​
​
---
 vdagent/file_xfer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index 1108369..cec5579 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -205,7 +205,7 @@ bool FileXfer::g_key_get_string(char* data, const char*
group, const char* key,
 snprintf(key_pfx, sizeof(key_pfx), "\n%s=", key);
 if (!(key_pos = strstr(group_pos, key_pfx))) return false;

-next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
+next_group_pos = strstr(group_pos + strlen(group_pfx), "\n[");
 if (next_group_pos && key_pos > next_group_pos) return false;

 start = key_pos + strlen(key_pfx);
--
1.9.3​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-11 Thread Cody Chan
​
I submitted a patch several months ago about this issue,
here
http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html

I check it again, and find that the value of
g_key_file_to_data(keyfile,...) is always utf-8,
for the value of g_uri_list_extract_uris() is utf8 urlencode.

So the display problem is caused by vd_agent, but how it displays depends
on the
language of system, the following two screenshots show the difference:
http://int64ago-tmp.qiniudn.com/guest-Chinese.png
http://int64ago-tmp.qiniudn.com/guest-English.png


​
​
​
---
 vdagent/file_xfer.cpp | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..1108369 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -46,6 +46,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,
 uint64_t file_size;
 HANDLE handle;
 AsUser as_user;
+int wlen;

 status->id = start->id;
 status->result = VD_AGENT_FILE_XFER_STATUS_ERROR;
@@ -81,7 +82,17 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,

 strcat(file_path, "\\");
 strcat(file_path, file_name);
-handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if((wlen = MultiByteToWideChar(CP_UTF8, 0, file_path, -1, NULL, 0)) ==
0)
+return;
+TCHAR *wfile_path = (TCHAR*)malloc(sizeof(TCHAR) * (wlen + 1));
+if (MultiByteToWideChar(CP_UTF8, 0, file_path, -1, wfile_path, wlen)
== 0){
+if(wfile_path)
+free(wfile_path);
+return;
+}
+handle = CreateFile(wfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if (wfile_path)
+free(wfile_path);
 if (handle == INVALID_HANDLE_VALUE) {
 vd_printf("failed creating %s %lu", file_path, GetLastError());
 return;
--
1.9.3

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-11 Thread Cody Chan
Sorry, memory leaks..


On Mon, Aug 11, 2014 at 7:43 PM, Cody Chan  wrote:

> ​
> I submitted a patch several months ago about this issue,
> here
> http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html
>
> I check it again, and find that the value of
> g_key_file_to_data(keyfile,...) is always utf-8,
> for the value of g_uri_list_extract_uris() is utf8 urlencode.
>
> So the display problem is caused by vd_agent, but how it displays depends
> on the
> language of system, the following two screenshots show the difference:
> http://int64ago-tmp.qiniudn.com/guest-Chinese.png
> http://int64ago-tmp.qiniudn.com/guest-English.png
>
> ---
>  vdagent/file_xfer.cpp | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
> index e402eb2..6e70d63 100644
> --- a/vdagent/file_xfer.cpp
> +++ b/vdagent/file_xfer.cpp
> @@ -46,6 +46,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
> start,
>  uint64_t file_size;
>  HANDLE handle;
>  AsUser as_user;
> +int wlen;
>
>  status->id = start->id;
>  status->result = VD_AGENT_FILE_XFER_STATUS_ERROR;
> @@ -81,7 +82,14 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
> start,
>
>  strcat(file_path, "\\");
>  strcat(file_path, file_name);
> -handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW,
> 0, NULL);
> +if((wlen = MultiByteToWideChar(CP_UTF8, 0, file_path, -1, NULL, 0))
> == 0)
> +return;
> +TCHAR *wfile_path = (TCHAR*)malloc(sizeof(TCHAR) * (wlen + 1));
> +if (MultiByteToWideChar(CP_UTF8, 0, file_path, -1, wfile_path, wlen)
> == 0)
> +return;
> +handle = CreateFile(wfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW,
> 0, NULL);
> +if (wfile_path)
> +free(wfile_path);
>  if (handle == INVALID_HANDLE_VALUE) {
>  vd_printf("failed creating %s %lu", file_path, GetLastError());
>  return;
> --
> 1.9.3
>
> --
> QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] fix bug: display error when dragging file with CJK characters

2014-08-11 Thread Cody Chan
​
I submitted a patch several months ago about this issue,
here
http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html

I check it again, and find that the value of
g_key_file_to_data(keyfile,...) is always utf-8,
for the value of g_uri_list_extract_uris() is utf8 urlencode.

So the display problem is caused by vd_agent, but how it displays depends
on the
language of system, the following two screenshots show the difference:
http://int64ago-tmp.qiniudn.com/guest-Chinese.png
http://int64ago-tmp.qiniudn.com/guest-English.png

---
 vdagent/file_xfer.cpp | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..6e70d63 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -46,6 +46,7 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,
 uint64_t file_size;
 HANDLE handle;
 AsUser as_user;
+int wlen;

 status->id = start->id;
 status->result = VD_AGENT_FILE_XFER_STATUS_ERROR;
@@ -81,7 +82,14 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,

 strcat(file_path, "\\");
 strcat(file_path, file_name);
-handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if((wlen = MultiByteToWideChar(CP_UTF8, 0, file_path, -1, NULL, 0)) ==
0)
+return;
+TCHAR *wfile_path = (TCHAR*)malloc(sizeof(TCHAR) * (wlen + 1));
+if (MultiByteToWideChar(CP_UTF8, 0, file_path, -1, wfile_path, wlen)
== 0)
+return;
+handle = CreateFile(wfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+if (wfile_path)
+free(wfile_path);
 if (handle == INVALID_HANDLE_VALUE) {
 vd_printf("failed creating %s %lu", file_path, GetLastError());
 return;
--
1.9.3

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] [vd_agent] fix bug: g_key_get_string() of vd_agent failed when keystring contains '['

2014-08-11 Thread Cody Chan
Yeah!I think yours is elegant and simple!


On Mon, Aug 11, 2014 at 6:33 PM, Christophe Fergeau 
wrote:

> Hey,
>
> On Fri, Aug 08, 2014 at 08:33:59PM +0800, Cody Chan wrote:
> > Hi, as you can see, in vd_agent/file_xfer.cpp, it implemented
> > the g_key_get_string,
> > but I find a problem, when dragging a file with a name containing '['
> (like
> > te[st.txt), it will be failed.
> > From source code,
> > >next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> > >if (next_group_pos && key_pos > next_group_pos) return false;
> > we know that it tries to find the end of current group by '[' label,
> > if we drag a file like te[st.txt, the key_string many like:
> > [vdagent-file-xfer]
> > name=te[st.txt
> > size=10
> > so, it's failed when meta parsing and
> > returns VD_AGENT_FILE_XFER_STATUS_ERRO message.
> >
> > I find a way to fix it, just replace '[' ']' with '<' '>' between group
> > name,
> > for it's illegal for windows to create a file with a name containing
> > '<'/'>'.
>
> Unfortunately, I don't think we can change the file format at this
> point, especially as this format is based on the somehow standard 'ini'
> file format, and apart from the windows agent, we use glib
> GKeyFile parser to handle this format.
> From a quick look at the code, wouldn't the patch below avoid the issue
> you described?
>
> diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
> index c258926..17cdb3c 100644
> --- a/vdagent/file_xfer.cpp
> +++ b/vdagent/file_xfer.cpp
> @@ -203,7 +203,7 @@ bool FileXfer::g_key_get_string(char* data, const
> char* grou
>  sprintf_s(key_pfx, sizeof(key_pfx), "\n%s=", key);
>  if (!(key_pos = strstr(group_pos, key_pfx))) return false;
>
> -next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
> +next_group_pos = strstr(group_pos + strlen(group_pfx), "\n[");
>  if (next_group_pos && key_pos > next_group_pos) return false;
>
>  start = key_pos + strlen(key_pfx);
>
> Christophe
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Patches welcome??

2014-08-10 Thread Cody Chan
Here're four patches I've contributed, but no ACK && no challenge, any
reason?
http://lists.freedesktop.org/archives/spice-devel/2014-August/017184.html
http://lists.freedesktop.org/archives/spice-devel/2014-August/017181.html
http://lists.freedesktop.org/archives/spice-devel/2014-August/017180.html
http://lists.freedesktop.org/archives/spice-devel/2014-August/017179.html

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] close the file handler if file_size = 0

2014-08-09 Thread Cody Chan
After dragging a zero-size file, then I open it in guest,
I get a warning message box which says:
 "the process cannot access the file because it is being used by another
process".
And I get to know the file is occupied by vdagent. Now we look back the
process:

a) When dragging a zero-size file, spice-gtk gets the name and size, then
sends
the message to vd_agent with VD_AGENT_FILE_XFER_START
b) vd_agent receives and parsers the message, then gets file name and size,
creates(open)
the file and gets the handler, at last, sends
VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA
c) spice-gtk receives the VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA message,
the sends data with VD_AGENT_FILE_XFER_DATA
d) vd_agent receives and writes data to the file opened
e) After finishing the writing, vd_agent closes the handler

But in step c, we take a look the code:
//spice-channel.c
>static void file_xfer_read_cb(...)
>{
>//...
>count = g_input_stream_read_finish(G_INPUT_STREAM(task->file_stream),
res, &error);
>if (count > 0) {
>task->read_bytes += count;
>file_xfer_queue(task, count);
>file_xfer_flush_async(channel, task->cancellable,
>  file_xfer_data_flushed_cb, task);
>task->pending = TRUE;
>} else if (error) {
>VDAgentFileXferStatusMessage msg = {
>.id = task->id,
>.result = VD_AGENT_FILE_XFER_STATUS_ERROR,
>};
>agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_STATUS,
> &msg, sizeof(msg), NULL);
>spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
>file_xfer_completed(task, error);
>}
>}

If count == 0, then it does nothing!
Then vd_agent will receive nothing after opening a file, and always occupy
the file.
Here we close the file if file_size = 0, even though it doesn't make sense
to send
a zero-size file.

​
---
 vdagent/file_xfer.cpp | 4 
 1 file changed, 4 insertions(+)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index 34a9ee6..17d842e 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -89,6 +89,10 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,
 vd_printf("failed creating %s %lu", file_path, GetLastError());
 return;
 }
+if (file_size == 0){
+CloseHandle(handle);
+return;
+}
 task = new FileXferTask(handle, file_size, file_path);
 _tasks[start->id] = task;
 status->result = VD_AGENT_FILE_XFER_STATUS_CAN_SEND_DATA;
--
1.9.3

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [spice-gtk] fix bug: g_key_get_string() of vd_agent failed when keystring contains '['

2014-08-08 Thread Cody Chan
See here:
http://lists.freedesktop.org/archives/spice-devel/2014-August/017180.html

​---
 gtk/channel-main.c | 45 +++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 7a299a4..26dad7f 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -2656,6 +2656,43 @@ static void file_xfer_completed(SpiceFileXferTask
*task, GError *error)
 task->pending = TRUE;
 }

+/**
+ * g_string_replace:
+ * @src: original string
+ * @old_string: substring you want to replace
+ * @new_string: string you want to replace with
+ *
+ * Replace all @old_string with @new_string in @src.
+ *
+ * Returns: %NULL if any of @src/@old_string/@new_string is illegal
+ **/
+gchar *g_string_replace(const gchar *src, const gchar *old_string, const
gchar *new_string)
+{
+if (!src || !old_string || !new_string || !g_strcmp0(src, "") ||
+!g_strcmp0(old_string, ""))
+return NULL;
+gchar *retstr = NULL;
+gchar *srcstr = g_strdup(src);
+gchar *ptr = g_strstr_len(srcstr, strlen(srcstr), old_string);
+if (ptr != NULL){
+gchar *after = g_string_replace(ptr + strlen(old_string),
old_string, new_string);
+gchar *before = g_strndup(srcstr, ptr - srcstr);
+retstr = g_strconcat(before, new_string, after, NULL);
+g_free(after);
+g_free(before);
+g_free(srcstr);
+return retstr;
+}
+return g_strdup(src);
+}
+
+gchar *g_key_string_replace(const gchar *string, const gchar *group_name)
+{
+gchar *old_group_name = g_strconcat("[", group_name, "]", NULL);
+gchar *new_group_name = g_strconcat("<", group_name, ">", NULL);
+return g_string_replace(string, old_group_name, new_group_name);
+}
+
 static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res,
gpointer data)
 {
 GFileInfo *info;
@@ -2665,7 +2702,7 @@ static void file_xfer_info_async_cb(GObject *obj,
GAsyncResult *res, gpointer da
 gchar *basename = NULL;
 VDAgentFileXferStartMessage msg;
 gsize /*msg_size*/ data_len;
-gchar *string;
+gchar *string, *new_string;
 SpiceFileXferTask *task = (SpiceFileXferTask *)data;

 task->pending = FALSE;
@@ -2687,6 +2724,9 @@ static void file_xfer_info_async_cb(GObject *obj,
GAsyncResult *res, gpointer da
 /* Save keyfile content to memory. TODO: more file attributions
need to be sent to guest */
 string = g_key_file_to_data(keyfile, &data_len, &error);
+
+/* For each group_name do this */
+new_string = g_key_string_replace(string, "vdagent-file-xfer");
 g_key_file_free(keyfile);
 if (error)
 goto failed;
@@ -2695,8 +2735,9 @@ static void file_xfer_info_async_cb(GObject *obj,
GAsyncResult *res, gpointer da
 msg.id = task->id;
 agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_START,
  &msg, sizeof(msg),
- string, data_len + 1, NULL);
+ new_string, data_len + 1, NULL);
 g_free(string);
+g_free(new_string);
 spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);
 return;

-- ​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] [vd_agent] fix bug: g_key_get_string() of vd_agent failed when keystring contains '['

2014-08-08 Thread Cody Chan
Hi, as you can see, in vd_agent/file_xfer.cpp, it implemented
the g_key_get_string,
but I find a problem, when dragging a file with a name containing '[' (like
te[st.txt), it will be failed.
>From source code,
>next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
>if (next_group_pos && key_pos > next_group_pos) return false;
we know that it tries to find the end of current group by '[' label,
if we drag a file like te[st.txt, the key_string many like:
[vdagent-file-xfer]
name=te[st.txt
size=10
so, it's failed when meta parsing and
returns VD_AGENT_FILE_XFER_STATUS_ERRO message.

I find a way to fix it, just replace '[' ']' with '<' '>' between group
name,
for it's illegal for windows to create a file with a name containing
'<'/'>'.

And of course, both vd_agent and spice-gtk should be patched.

---
 vdagent/file_xfer.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..6998901 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -188,13 +188,13 @@ bool FileXfer::g_key_get_string(char* data, const
char* group, const char* key,
 char *group_pos, *key_pos, *next_group_pos, *start, *end;
 unsigned len;

-snprintf(group_pfx, sizeof(group_pfx), "[%s]", group);
+snprintf(group_pfx, sizeof(group_pfx), "<%s>", group);
 if (!(group_pos = strstr((char*)data, group_pfx))) return false;

 snprintf(key_pfx, sizeof(key_pfx), "\n%s=", key);
 if (!(key_pos = strstr(group_pos, key_pfx))) return false;

-next_group_pos = strstr(group_pos + strlen(group_pfx), "[");
+next_group_pos = strstr(group_pos + strlen(group_pfx), "<");
 if (next_group_pos && key_pos > next_group_pos) return false;

 start = key_pos + strlen(key_pfx);
-- 

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] fix bug: display error when dragging file with CJK characters

2014-08-07 Thread Cody Chan
I submitted a patch several months ago about this issue,
here
http://lists.freedesktop.org/archives/spice-devel/2014-February/016158.html

I check it again, and find that the value of
g_key_file_to_data(keyfile,...) is always utf-8,
for the value of g_uri_list_extract_uris() is utf8 urlencode.

So the display problem is caused by vd_agent, but how it displays depends
on the
language of system, the following two screenshots show the difference:
http://int64ago-tmp.qiniudn.com/guest-Chinese.png
http://int64ago-tmp.qiniudn.com/guest-English.png

---
 vdagent/file_xfer.cpp | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index e402eb2..553a3f3 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -81,7 +81,10 @@ void FileXfer::handle_start(VDAgentFileXferStartMessage*
start,

 strcat(file_path, "\\");
 strcat(file_path, file_name);
-handle = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0,
NULL);
+int len = MultiByteToWideChar(CP_UTF8, 0, file_path, -1, NULL, 0);
+wchar_t wfile_path[MAX_PATH];
+MultiByteToWideChar(CP_UTF8, 0, file_path, -1, wfile_path, len);
+handle = CreateFileW(wfile_path, GENERIC_WRITE, 0, NULL, CREATE_NEW,
0, NULL);
 if (handle == INVALID_HANDLE_VALUE) {
 vd_printf("failed creating %s %lu", file_path, GetLastError());
 return;
-- 
1.9.3

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Program exit during DND(drag file from client to guest) when the network break for a 'long' time

2014-08-06 Thread Cody Chan
Hmm, it's a little difficult to describe the issue.

When connecting guest by virt-viewer(build with mingw32-spice-gtk) through
WAN and then
draging a large file(100+M maybe, it depends) from client to guest, the
main window  exit immediately.
BUT it's always ok if I don't drag a file.

I test the network with 3rd-part tools, and get the result is that the
connectivity
of network
 is not good.Sometimes, the network may break for a little time(about
600ms, not exactly).

​Then I cut down the network of virt-viewer and start the network immediately
by hand, and of course,
The program exit immediately if I'm dragging a file but looks ok if I'm
not.So I'm sure it's the
problem of network.

Now, my question is what makes the difference between two situations
in a bad network condition?
Is it possible to let main window of virt-viewer stay on during dragging
files even in
such network?

BTW, the main window may be freezing (NOT exited)forever if I cut down the
network
for a while during transferring files through  from a external
flash disk.


​Thx a lot!​

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Bad display of the download-section on gitweb

2014-08-06 Thread Cody Chan
Hi, I didn't  mean there's no place to download spice-gtk tarball,
I mean the gitweb page now is not what it should be displayed,
from the following two screenshots you can understand
http://int64ago-tmp.qiniudn.com/1.png
http://int64ago-tmp.qiniudn.com/2.png

Any way, the download here http://cgit.freedesktop.org/spice/spice-gtk/ is
different from
http://www.spice-space.org/download/gtk/, the former is just the snapshot
of git repository.


On Wed, Aug 6, 2014 at 5:05 PM, Christophe Fergeau 
wrote:

> Hey,
>
> For what it's worth, spice-gtk tarballs should be downloaded from
> http://www.spice-space.org/download/gtk/
>
> Christophe
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Bad display of the download-section on gitweb

2014-08-05 Thread Cody Chan
>From google cache:
http://webcache.googleusercontent.com/search?q=cache:y72C9Ob34aIJ:cgit.freedesktop.org/spice/spice-gtk+&cd=1&hl=en&ct=clnk&gl=us

Something like:
Tag Download
v0.25 spice-gtk-0.25.zip  spice-gtk-0.25.tar.gz
v0.24 spice-gtk-0.24.zip  spice-gtk-0.24.tar.gz
v0.23 spice-gtk-0.23.zip  spice-gtk-0.23.tar.gz
v0.22 spice-gtk-0.22.zip  spice-gtk-0.22.tar.gz
.

This's the normal display.


On Wed, Aug 6, 2014 at 2:04 PM, Alon Levy  wrote:

> On 08/06/2014 05:27 AM, Cody Chan wrote:
> > Bad display of the download-section,
> > http://cgit.freedesktop.org/spice/spice-gtk/
> > Tag Download
> > v0.25 commit 31c099c931...
> > v0.24 commit 6356941903...
> > v0.23 commit 75176968b0...
> > v0.22 commit 2e3aa29794...
> > v0.21 commit 632836ed77...
> > v0.20 commit 1d5717d8e2...
> > v0.19 commit a879fd5cc4...
> > v0.18 commit b63052b355...
> > v0.17 commit c91b0488f4...
> > v0.16 commit 4295363ccc...
> >
> > Actually, it's the the problem of the whole site.
>
> Can you try to explain what the exact problem is?
>
> >
> >
> >
> > ___
> > Spice-devel mailing list
> > Spice-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
>
>


-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Bad display of the download-section on gitweb

2014-08-05 Thread Cody Chan
Bad display of the download-section,
http://cgit.freedesktop.org/spice/spice-gtk/
Tag Download
v0.25 commit 31c099c931...
v0.24 commit 6356941903...
v0.23 commit 75176968b0...
v0.22 commit 2e3aa29794...
v0.21 commit 632836ed77...
v0.20 commit 1d5717d8e2...
v0.19 commit a879fd5cc4...
v0.18 commit b63052b355...
v0.17 commit c91b0488f4...
v0.16 commit 4295363ccc...

Actually, it's the the problem of the whole site.

-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] remote-viewer for windows

2014-07-28 Thread Cody Chan
On Mon, Jul 28, 2014 at 6:49 PM, 力波 王  wrote:

> Hi, Cody Chan:
>  Thanks for you reply.
>
> For the second question, it’s appear in the follow case:
> If I login into a client need a uKey, and login into the guest need
> The same uKey too, how could I let the uKey for them at the same
> Time.
>
​Yeah, it's really a problem,​ but you'd better think carefully if it's
necessary or not to verify twice .

 发件人: Cody Chan 
> 日期: Mon, 28 Jul 2014 18:40:31 +0800
> 至: 力波 王 
> 抄送: , "spice-devel@lists.freedesktop.org" <
> spice-devel@lists.freedesktop.org>
> 主题: Re: [Spice-devel] remote-viewer for windows
>
> Hi
>
> On Mon, Jul 28, 2014 at 5:58 PM, 力波 王  wrote:
>
>> Hi,Uril:
>> I had built spice-gtk with —enable-usb-redir is success.
>> And it works well on windows xp and windows 7 (both X86).
>> The error at last built is because of libusb, the libusb
>> I built is some error. I got the libsubx from git, the latest
>> Version is 1.0.18.
>>
>> The spice-gtk’s version I built is v0.22.
>> The usbredir’s version I built is usbredir-0.5.2
>>
>> So, thanks for your help.
>>
>>And here are two question again.^_^
>>
>>1. How to build a MSI file from the packages I Built.
>>
> If your host for building is fedora, running "​minw32/64-make nsis" in
> virt-viewer​, of course, you also need mingw32/64-nsis*
>
>>
>>2. Does spicy-gtk support a feature that let a uKey connected
>> To client and guest and the same time.
>>
> ​If it's readonly, I think it's possible to ​implement that, but it not
> worth to do that at present.
>
>>
>>
>>
>> ___
>> Spice-devel mailing list
>> Spice-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>
>
>
>
> --
> QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] remote-viewer for windows

2014-07-28 Thread Cody Chan
Hi

On Mon, Jul 28, 2014 at 5:58 PM, 力波 王  wrote:

> Hi,Uril:
> I had built spice-gtk with —enable-usb-redir is success.
> And it works well on windows xp and windows 7 (both X86).
> The error at last built is because of libusb, the libusb
> I built is some error. I got the libsubx from git, the latest
> Version is 1.0.18.
>
> The spice-gtk’s version I built is v0.22.
> The usbredir’s version I built is usbredir-0.5.2
>
> So, thanks for your help.
>
>And here are two question again.^_^
>
>1. How to build a MSI file from the packages I Built.
>
If your host for building is fedora, running "​minw32/64-make nsis" in
virt-viewer​, of course, you also need mingw32/64-nsis*

>
>2. Does spicy-gtk support a feature that let a uKey connected
> To client and guest and the same time.
>
​If it's readonly, I think it's possible to ​implement that, but it not
worth to do that at present.

>
>
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
QSBDT0RFUiBGUk9NIFJJRVNUIE9GIENUU0VV
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] video performance in rhel/centos 7 vs fedora 20

2014-07-15 Thread Cody Chan
On Tue, Jul 15, 2014 at 11:22 PM, Marc-André Lureau 
wrote:

> Hi
>
> - Original Message -
> > Hi All,
> >
> > We have been piloting deployments of VM using Fedora 20 host and guest
> > and have been very happy with performance and stability in almost every
> > respect, so a big thanks to all for this hard work. Things are looking
> > great.
> >
> > Now we have been testing deployments of these same VMs (F20 guests) on
> > rhel 7 (centos 7). We migrated one over and one of the issues seems to
> > be a severe degradation of video performance vis-a-vis the F20 host.
>
> The difference between rhel7 and f20 host is quite surprising. I get
> quite bad performance with f20 host as well (spice 0.12.4-3, qemu 2.0.0-5)

​Hi, I got confused long time ago, actually, the performance ​between
centos and fedora is quite different, as installing win7 guest for example,
10min for centos host, but 1h for fedora host!
Maybe the reason is the difference of IO behavior, but I'm not sure.

>
>
Are your host configured with the same spice settings (in particular
> streaming-video and other compression settings) ?
>
> > The setup is a C7 host, F20 guest and either C7 or F20 client, either
> > local to the host or on the LAN.
> >
> > In this setup, the video plays fine for a few seconds, but eventually
> > degrades to about 1fps with severe tearing of the video. Video does
> > remain in sync with audio and there are no audio breakups.
> >
> > Any pointers on things to try?
>
> I have been investigating some video rendering issues with rhel7 guest
> on rhel7 host, see https://bugzilla.redhat.com/show_bug.cgi?id=1030024
>
> However, even with the cogl fix and "PutImage BIG-REQUEST", the video
> regions seems to vary too much for the Spice video filter to perform
> well (using firefox/html5 video youtube). I believe it will need to be
> improved.
>
> (the cogl fix allows much more accurate region invalidation, the
> big-request allows to update whole region atomically and not by chunks)
>
> > I'm willing to rebuild some host components (e.g. spice-server or qemu
> > or whatever) or try some patches or configuration changes to address
> > this to track it down.
>
> Your help would be most welcome to investigate and improve this further.
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Spice-devel Digest, Vol 54, Issue 4

2014-07-09 Thread Cody Chan
​How do you starting the vm?
qemu?libvirt?ovirt?...
If you have already builded spice-gtk with '--enable-usbredir', then check
the parameters of qemu,
xml of libvirt, or configuration of the vm in ovirt.


On Tue, Jul 8, 2014 at 5:10 PM, 力波 王  wrote:

> Hi,everyone:
>
> When I use virtviewer on windows to connect a VM(VM running in
> oVirt),
> “USB device selection” is disable. Is it support on windows?
> Or, how could I resolve it?
>
>
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [ovirt-users] USB redirection

2014-06-02 Thread Cody Chan
Hi,
you also need usbclerk/zadig in client if your client is windows,
and don't forget to choose "Native" for usb-redir in ovirt manager
before starting the vm

Regards
Cody


On Tue, Jun 3, 2014 at 4:37 AM, Itamar Heim  wrote:

> On 06/02/2014 03:57 PM, Jean-Pierre WEISS wrote:
>
>> Hi,
>>
>> I'm trying to redirect USB devices on a Windows 7 vm. But, after
>> searching the web, I didn't find any procedure to do this.
>>
>> Here is my configuration :
>>
>> Host : CentOS 6.5 with ovirt 3.4.0.1-el6
>>
>> vm : Windows 7 with the virtio drivers (virtio-win- 0.1.74) installed,
>> spice-guest-tools-0.74, and ovirt-guest-agent installed.
>>
>> All is working fine, except that I can see the USB devices connected to
>> the client.
>>
>> Any clue ?
>>
>> Thanks,
>>
>> Jean-Pierre WEISS
>> Administrateur Systèmes et Réseaux
>> Mairie de Saint-Ouen
>>
>>
>> ___
>> Users mailing list
>> us...@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>>
>>
> adding spice-devel list
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk 00/14] USB fail early on win32 without usbclerk v2

2014-04-28 Thread Cody Chan
Hi, thx for your great work, I wonder when these patches will be in git
upstream?


On Thu, Apr 24, 2014 at 11:50 PM, Marc-André Lureau <
marcandre.lur...@gmail.com> wrote:

> Hi,
>
> Here is a small series, of little cleanups, and of goal to throw early
> an error when the win32 usbclerk can't be reached. In turn, the error
> can be catched by client code to show a useful dialog.
>
> In v2:
>  - fixes after Jonathon Jongsma review
>
> Marc-André Lureau (14):
>   usb: remove useless declaration
>   win-usb: introduce a spice_win_usb_driver_op_finish
>   win-usb: rename async functions
>   usb: use win-usb uninstall_finish()
>   win-usb: throw an error if reply.status == 0
>   win-usb: get rid of status code return in async ops
>   usb: remove useless device ref/unref
>   usb: remove useless assignment
>   usb: use SPICE_CLIENT_ERROR_ prefix
>   usb: call win_usb_driver_new() during initable_init()
>   usb: misc code formatting
>   win-usb: remove useless function
>   usb: do not return GError on programmer pre-condition checks
>   win-usb: try to connect to usbclerk during init
>
>  gtk/channel-usbredir.c   |   4 +-
>  gtk/spice-client.h   |  13 +++-
>  gtk/usb-device-manager.c | 127 ---
>  gtk/win-usb-driver-install.c | 140
> ++-
>  gtk/win-usb-driver-install.h |  28 +
>  5 files changed, 162 insertions(+), 150 deletions(-)
>
> --
> 1.8.5.3
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] (spicy.exe:10880): phodav-WARNING: Error opening file 'filename' Permission denied

2014-04-10 Thread Cody Chan
Hi, here are more details:
The problem is caused by chezdav webdav server.
I test phodav project separately, here:
-build phodav by mingw32 for windows, and I get a chezdav.exe
-run chezdav.exe in win7_x86
-mount http://hostofserver:port in windows and fedora
-test delete/copyto/copyfrom/create/modify fuction
-it works fine in fedora
-in windows:
a)delete and copyto look fine
b)copyfrom get a error message and failed
(chezdav:xxx): GLib-GObject-CRITICAL **: g_object_unref: assertion
'G_IS_OBJECT(object)' failed
(chedav:xxx): phodav-WARNING **: error: Error opening file 'filename':
Permission denied
c)create/modify a file failed:
(chezdav:xxx): GLib-GObject-CRITICAL **: g_object_unref: assertion
'G_IS_OBJECT(object)' failed
(chezdav:xxx): phodav-WARNING **: failed to set property: Setting attribute
xattr::urn:schemas-microsoft-com:#Win32CreationTime not supported



On Fri, Apr 11, 2014 at 10:53 AM, Cody Chan  wrote:

> spicy is compiled with phodav, running in windows client,
> I get a warning message(fatal)  when I drag a file from guest(windows) to
> a shared folder:
> (spicy.exe:10880): phodav-WARNING **: error: Error opening file
> 'D:\test\spice-g
> uest-tools-0.74.exe': Permission denied
>
> And in guest, here is a message box says : can't read source file or disk,
> and of course failed to copy file
>
> BUT, in fedora client(test in the same guest), it works fine.
>
> I want to know where this warning/error message come from? Then I can
> debug it
>
> Thx
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] (spicy.exe:10880): phodav-WARNING: Error opening file 'filename' Permission denied

2014-04-10 Thread Cody Chan
spicy is compiled with phodav, running in windows client,
I get a warning message(fatal)  when I drag a file from guest(windows) to a
shared folder:
(spicy.exe:10880): phodav-WARNING **: error: Error opening file
'D:\test\spice-g
uest-tools-0.74.exe': Permission denied

And in guest, here is a message box says : can't read source file or disk,
and of course failed to copy file

BUT, in fedora client(test in the same guest), it works fine.

I want to know where this warning/error message come from? Then I can debug
it

Thx
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] can't download spice-guest-tools-0.74.exe...

2014-04-08 Thread Cody Chan
Hmm, it's likely the problem of your network
I download it from
http://www.spice-space.org/download/windows/spice-guest-tools/

You can then get it from here
https://drive.google.com/file/d/0B3iqyCdv2xWcSW5jbXktNVU5WGM/edit?usp=sharing

Here is the sign:
http://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-0.74.exe.sign




On Wed, Apr 9, 2014 at 12:07 AM, Sander Reds  wrote:

>
> Hello!
>
> I know I have a fairly slow internet connection, but I've been trying to
> download this file for at least two days and at different times. Is there
> any
> restrictions to download this file? I tested with Firefox, Chrome,
> Jdowloader... none of the downloads passes 15% (~ 1000kib). Is there any
> other
> way I can get spice-guest-tools-0.74 for Windows?
>
> Thanks and keep up the good work.
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Suggestions for Test-Shared-Folder based on webdav

2014-04-07 Thread Cody Chan
Thx for Marc-André's patient guidance :)
http://lists.freedesktop.org/archives/spice-devel/2014-February/016256.html
http://www.spinics.net/lists/spice-devel/msg07524.html

Shared Folder is a new feature of spice, need more geeks to  test and patch
Here're suggestions of a quick start to test it.

The preview: http://int64ago-temp.qiniudn.com/preview.png

The environment of my host : Fedora20_x86_64(Clean Install)

[0x01] Preinstall dependences:
$yum -y install git gcc gcc-c++ wget libusb-devel glib-devel autoconf
automake libtool glib2-devel pixman-devel celt051-devel usbredir-devel
 libcacard-devel  libpng-devel zlib-devel libogg-devel alsa-lib-devel
openssl-devel libXrandr-devel libXfixes-devel libjpeg-devel
cyrus-sasl-devel virt-install yajl-devel device-mapper-devel
libpciaccess-devel libnl-devel libxml2-devel python-devel
libfdt-devel python-devel gnulib-devel perl-podlators xhtml1-dtds
gtk+-devel gtk2-devel gtk3-devel intltool openssl-devel
pulseaudio-libs-devel  gobject-introspection-devel libjpeg-turbo-devel
zlib-devel cyrus-sasl-devel gtk-doc libsoup-devel gstreamer-devel
gstreamer-plugins-base-devel perl-CPAN vala-tools vala-devel
gnome-common

Install Text::CSV module for perl:
$perl -MCPAN -e shell
In the shell: install Text::CSV

Install pyparsing module for python:
$easy_install pyparsing

[0x02] Make CA
$mkdir -p /etc/pki/libvirt-spice
$cd /etc/pki/libvirt-spice
$openssl genrsa -des3 -out ca-key.pem 1024
$openssl req -new -x509 -days 1095 -key ca-key.pem -out ca-cert.pem
-utf8 -subj "/C=IL/L=Raanana/O=Red Hat/CN=my CA"
$openssl genrsa -out server-key.pem 1024
$openssl req -new -key server-key.pem -out server-key.csr -utf8 -subj
"/C=IL/L=Raanana/O=Red Hat/CN=my server"
$openssl x509 -req -days 1095 -in server-key.csr -CA ca-cert.pem
-CAkey ca-key.pem -set_serial 01 -out server-cert.pem
$openssl rsa -in server-key.pem -out server-key.pem.insecure
$mv server-key.pem server-key.pem.secure
$mv server-key.pem.insecure server-key.pem
$cp ca-cert.pem /etc/pki/CA/cacert.pem
$mkdir -p /etc/pki/libvirt/private
$cp server-cert.pem /etc/pki/libvirt/servercert.pem
$cp server-key.pem /etc/pki/libvirt/private/serverkey.pem

[0x03] NetWork(Not Necessary)
$cd /etc/sysconfig/network-scripts
$cat ifcfg-br0
TYPE=Bridge
NM_CONTROLLED="no"
BOOTPROTO=dhcp
DEVICE="br0"
ONBOOT=yes
$cat ifcfg-p33p1(Depends)
TYPE="Ethernet"
BRIDGE="br0"
DEVICE="p33p1"
ONBOOT="yes"
NM_CONTROLLED="no"

[0x04] Build from upstream
The followings from git upstream:
spice-protocol, spice, qemu, libvirt-python, libvirt, phodav, spice-gtk

spice-protocol:
$./autogen.sh
$make
$make install
$cp /usr/local/share/pkgconfig/spice-protocol.pc /usr/share/pkgconfig/

spice:
$./autogen.sh --enable-smartcard
$make
$make install
$cp /usr/local/lib/pkgconfig/spice-server.pc /usr/share/pkgconfig/
$ln -sf /usr/local/lib/libspice-server.so.1.8.0 /lib64/libspice-server.so.1

qemu:
$./configure --target-list=x86_64-softmmu --enable-spice
--enable-usb-redir --enable-vhost-net --enable-kvm --enable-vnc
$make
$make install
$ln -sf /usr/local/bin/qemu-system-x86_64 /usr/bin/qemu-kvm

libvirt:
$./autogen.sh --system
$make
$make install
if fail when do "virsh --version" and get error message about "not
found libvirt-sock",
find libvirt-sock and link to /var/run/libvirt/libvirt-sock
$ln -sf /path/of/libvirt-sock  /var/run/libvirt/libvirt-sock

libvirt-python:
python setup.py install

phodav:
$./autogen.sh
$make
$make install

spice-gtk:
$./autogen.sh
make sure phodav flag is 'yes' after autogen.sh:
PhoDAV:   yes
$make
$make install

[0x05] Create Guest
a)for windows guest(Depends):
$virt-install --connect qemu:///system -n vm_win7 -r 1024 --vcpus=1
--disk path=/var/lib/libvirt/images/vm_win7.img,size=15 -c ./win7.iso
--graphics spice,port=5930,listen=0.0.0.0 --noautoconsole --os-type
windows --accelerate --network=bridge:br0 --hvm
After installation:
$virsh destroy vm_win7
$virsh edit vm_win7
add the following section in ...:




$spicy -h  -p xxx --spice-shared-dir=/path/you/want/to/share
Install http://elmarco.fedorapeople.org/spice-webdavd-x86-0.1.24.msi for guest
And run map-drive.bat from Program Files/Spice webdav/

b)for linux guest(Depends):
It's similar with windows guest, but you should build webdav-agent by yourself:
git clone phodav from upstream
$yum -y install gnome-common  gcc gcc-c++ automake autoconf libtool
intltool gtk-doc glib2-devel libsoup-devel libxml-devel
$./autogen.sh
$make
$make install
After these:
$spice-webdavd -p 8000


After a) and b), you will see shared folder in nautilus network places

Enjoy and test
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk]channel-main.c: gssize type error with mingw32-gcc

2014-04-07 Thread Cody Chan
On Mon, Apr 7, 2014 at 3:50 PM, Christophe Fergeau  wrote:
> On Sun, Apr 06, 2014 at 02:03:10PM +0800, Cody Chan wrote:
>> Here ,
>> mingw32-configure --without-sasl --with-gtk=3.0 --with-audio=gstreamer
>> --without-python --enable-usbredir=yes --enable-smartcard=no
>> --enable-vala
>> mingw32-make
>>
>> There is a error:
>> ..
>>  CC   channel-webdav.lo
>> channel-webdav.c: In function 'demux_to_client':
>> channel-webdav.c:318:5: error: format '%ld' expects argument of type
>> 'long int', but argument 5 has type 'gssize' [-Werror=format=]
>>  CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
>>  ^
>> cc1: all warnings being treated as errors
>> make[4]: *** [channel-webdav.lo] Error 1
>
> Should be fixed by
> http://lists.freedesktop.org/archives/spice-devel/2014-April/016569.html
> (make CFLAGS="-Wno-error" will probably avoid this breaking the build)
>
>> ..
>> Doc says: typedef signed int gssize;
>> It's just a tiny bug, but it is strange that it's ok with gcc.
>
> This is a platform dependent typedef, on my linux x86_64 machine it's:
> typedef signed long gssize;

So that explains it!
Cheers

> Christophe
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk]channel-main.c: gssize type error with mingw32-gcc

2014-04-05 Thread Cody Chan
Here ,
mingw32-configure --without-sasl --with-gtk=3.0 --with-audio=gstreamer
--without-python --enable-usbredir=yes --enable-smartcard=no
--enable-vala
mingw32-make

There is a error:
..
 CC   channel-webdav.lo
channel-webdav.c: In function 'demux_to_client':
channel-webdav.c:318:5: error: format '%ld' expects argument of type
'long int', but argument 5 has type 'gssize' [-Werror=format=]
 CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
 ^
cc1: all warnings being treated as errors
make[4]: *** [channel-webdav.lo] Error 1
..
Doc says: typedef signed int gssize;
It's just a tiny bug, but it is strange that it's ok with gcc.


diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
index c619e48..1935aa3 100644
--- a/gtk/channel-webdav.c
+++ b/gtk/channel-webdav.c
@@ -315,7 +315,7 @@ static void demux_to_client(SpiceWebdavChannel *self,
 SpiceWebdavChannelPrivate *c = self->priv;
 gssize size = c->demux.size;

-CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
+CHANNEL_DEBUG(self, "pushing %d to client %p", size, client);

 if (size != 0) {
 output_queue_push(client->output, (guint8 *)c->demux.buf, size,
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk]channel-main.c: gssize type error with mingw32-gcc

2014-04-05 Thread Cody Chan
Sorry, it channel-webdav.c

On Sun, Apr 6, 2014 at 2:03 PM, Cody Chan  wrote:
> Here ,
> mingw32-configure --without-sasl --with-gtk=3.0 --with-audio=gstreamer
> --without-python --enable-usbredir=yes --enable-smartcard=no
> --enable-vala
> mingw32-make
>
> There is a error:
> ..
>  CC   channel-webdav.lo
> channel-webdav.c: In function 'demux_to_client':
> channel-webdav.c:318:5: error: format '%ld' expects argument of type
> 'long int', but argument 5 has type 'gssize' [-Werror=format=]
>  CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
>  ^
> cc1: all warnings being treated as errors
> make[4]: *** [channel-webdav.lo] Error 1
> ..
> Doc says: typedef signed int gssize;
> It's just a tiny bug, but it is strange that it's ok with gcc.
>
>
> diff --git a/gtk/channel-webdav.c b/gtk/channel-webdav.c
> index c619e48..1935aa3 100644
> --- a/gtk/channel-webdav.c
> +++ b/gtk/channel-webdav.c
> @@ -315,7 +315,7 @@ static void demux_to_client(SpiceWebdavChannel *self,
>  SpiceWebdavChannelPrivate *c = self->priv;
>  gssize size = c->demux.size;
>
> -CHANNEL_DEBUG(self, "pushing %ld to client %p", size, client);
> +CHANNEL_DEBUG(self, "pushing %d to client %p", size, client);
>
>  if (size != 0) {
>  output_queue_push(client->output, (guint8 *)c->demux.buf, size,
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] test shared folder error: spiceport not supported in this QEMU binary

2014-04-04 Thread Cody Chan
Hi,


On Sat, Apr 5, 2014 at 12:23 AM, Marc-André Lureau  wrote:
>
>
> - Original Message -
>> sorry, I come for help again ==
>>
>> fedora 19 x64
>> qemu from upstrem(2.0.0-rc1)
>> libvirt 1.2.3
>> spice-server 0.12.4
>
> You'll also need spice-server from upstream git.
Yes, I rebuilt again from upstream
>> spice-protocol 0.12.6
>>
>> According to http://elmarco.fedorapeople.org/manual.html#_configuration_7,
>> I configured xml with the following section:
>> 
>> 
>> 
>> 
>>
>> but when I run: virsh start vm_win7, I get a error:
>> error: Failed to start domain vm_win7
>> error: unsupported configuration: spiceport not supported in this QEMU binary
>
> Are you sure libvirt is running qemu from upstream? What does qemu-kvm 
> --version gives you?
I'm sure, but after rebuilding, the qemu-system-x86_64(link of
qemu-kvm?) --version is 1.7.91! Is it normal?
qemu with version 2.0.0 generates qemu-system-x86_64 with version 1.7.91?

>> so, I use qemu-kvm instead of libvirt with the parameters told by
>> _configuration_7:
>> qemu-kvm -m 1024 -drive file=/var/lib/libvirt/images/vm_win7.img
>> -device virtserialport,bus=virtio-
>> serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0
>> -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1
>>
>> still, get a error:
>> qemu-system-x86_64: -device
>> virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0:
>> Bus 'virtio-serial0.0' not found
>>
>
> Hmm, you could try without specifying the bus, or adding this device:
>
> -device virtio-serial-pci,id=virtio-serial0
>
>> if I remove the configure section in xml of libvirt, it works fine, so
>> does qemu-kvm
>>
>> now, any one gives me some idea to continue?
>> ___
>> Spice-devel mailing list
>> Spice-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] test shared folder error: spiceport not supported in this QEMU binary

2014-04-04 Thread Cody Chan
sorry, I come for help again ==

fedora 19 x64
qemu from upstrem(2.0.0-rc1)
libvirt 1.2.3
spice-server 0.12.4
spice-protocol 0.12.6

According to http://elmarco.fedorapeople.org/manual.html#_configuration_7,
I configured xml with the following section:





but when I run: virsh start vm_win7, I get a error:
error: Failed to start domain vm_win7
error: unsupported configuration: spiceport not supported in this QEMU binary

so, I use qemu-kvm instead of libvirt with the parameters told by
_configuration_7:
qemu-kvm -m 1024 -drive file=/var/lib/libvirt/images/vm_win7.img
-device virtserialport,bus=virtio-
serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0
-chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1

still, get a error:
qemu-system-x86_64: -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0:
Bus 'virtio-serial0.0' not found

if I remove the configure section in xml of libvirt, it works fine, so
does qemu-kvm

now, any one gives me some idea to continue?
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Fwd: [PATCH spice-gtk 0/2] WebDAV channel

2014-04-02 Thread Cody Chan
On Thu, Apr 3, 2014 at 12:47 AM, Marc-André Lureau
 wrote:
> Hi Cody,
>
> Do you have the webdav virtio/port configured for your guest?
I'm not familiar with webdav , so I install it directly, I'll configure it first
>Afaik, the  spice server isn't released yet for this to work. You are perhaps 
>best to
> wait a few more weeks until it's all released? With Spice server from
> upstream, and recent qemu/libvirt, you can use these instructions:
upstream?you mean git://anongit.freedesktop.org/spice/spice ?

> http://elmarco.fedorapeople.org/manual.html#_configuration_7
>
> On Wed, Apr 2, 2014 at 6:38 PM, Cody Chan  wrote:
>>
>> Oh , sorry for sending mail to only Marc-André
>> -
>> Hi all, I want to test shared folder , but there is a error during
>> installing spice-webdavd-x86-0.1.24.msi,
>> the error message box is here: http://dwz.cn/fO6Um
>> and I try it in win7_x86 and win8_x64,both the same error
>> Is there someone can give me some advices ?
>> Thx a lot!
>>
>> On Fri, Feb 28, 2014 at 8:16 PM, Marc-André Lureau
>>  wrote:
>> > From: Marc-André Lureau 
>> >
>> > Hi,
>> >
>> > This is the client bits to get folder sharing capability using the
>> > WebDAV channel.
>> >
>> > How to test it?
>> >
>> > You'll need spice-server with this patch:
>> > http://patchwork.freedesktop.org/patch/17802/
>> >
>> > Then using qemu master, use the following port redirection:
>> >
>> >  -device
>> > virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0
>> > -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1
>> >
>> > In a Windows guest, you must then install
>> > http://elmarco.fedorapeople.org/spice-webdavd-x86-0.1.24.msi, and
>> > register the drive (by running map-drive.bat from Program Files/Spice
>> > webdav). By default, the "public share" directory is used. You may
>> > specify a different folder with --spice-share-dir option.
>> >
>> > With a Linux guest, atm, you must compile phodav (form git.gnome.org)
>> > and run spice-webdavd -p 8000 as root. The folder will show up in
>> > nautilus network places. It can then be mounted and browsed in
>> > traditional apps thanks to gvfs-fuse.
>> >
>> >
>> > Marc-André Lureau (2):
>> >   Add webdav channel
>> >   session: add shared-dir property and option
>> >
>> >  .gitmodules  |   3 +
>> >  autogen.sh   |   2 +-
>> >  configure.ac |   4 +
>> >  doc/reference/spice-gtk-docs.xml |   1 +
>> >  doc/reference/spice-gtk-sections.txt |  17 +
>> >  doc/reference/spice-gtk.types|   4 +-
>> >  gtk/Makefile.am  |   9 +-
>> >  gtk/channel-webdav.c | 737
>> > +++
>> >  gtk/channel-webdav.h |  68 
>> >  gtk/map-file |   1 +
>> >  gtk/phodav   |   1 +
>> >  gtk/spice-channel.c  |   6 +
>> >  gtk/spice-client.h   |   1 +
>> >  gtk/spice-glib-sym-file  |   1 +
>> >  gtk/spice-option.c   |   5 +
>> >  gtk/spice-session-priv.h |   6 +
>> >  gtk/spice-session.c  |  50 ++-
>> >  spice-common |   2 +-
>> >  18 files changed, 912 insertions(+), 6 deletions(-)
>> >  create mode 100644 gtk/channel-webdav.c
>> >  create mode 100644 gtk/channel-webdav.h
>> >  create mode 16 gtk/phodav
>> >
>> > --
>> > 1.8.5.3
>> >
>> ___
>> Spice-devel mailing list
>> Spice-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
>
>
>
> --
> Marc-André Lureau
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Fwd: [PATCH spice-gtk 0/2] WebDAV channel

2014-04-02 Thread Cody Chan
Oh , sorry for sending mail to only Marc-André
-
Hi all, I want to test shared folder , but there is a error during
installing spice-webdavd-x86-0.1.24.msi,
the error message box is here: http://dwz.cn/fO6Um
and I try it in win7_x86 and win8_x64,both the same error
Is there someone can give me some advices ?
Thx a lot!

On Fri, Feb 28, 2014 at 8:16 PM, Marc-André Lureau
 wrote:
> From: Marc-André Lureau 
>
> Hi,
>
> This is the client bits to get folder sharing capability using the
> WebDAV channel.
>
> How to test it?
>
> You'll need spice-server with this patch:
> http://patchwork.freedesktop.org/patch/17802/
>
> Then using qemu master, use the following port redirection:
>
>  -device 
> virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0
>  -chardev spiceport,name=org.spice-space.webdav.0,id=charchannel1
>
> In a Windows guest, you must then install
> http://elmarco.fedorapeople.org/spice-webdavd-x86-0.1.24.msi, and
> register the drive (by running map-drive.bat from Program Files/Spice
> webdav). By default, the "public share" directory is used. You may
> specify a different folder with --spice-share-dir option.
>
> With a Linux guest, atm, you must compile phodav (form git.gnome.org)
> and run spice-webdavd -p 8000 as root. The folder will show up in
> nautilus network places. It can then be mounted and browsed in
> traditional apps thanks to gvfs-fuse.
>
>
> Marc-André Lureau (2):
>   Add webdav channel
>   session: add shared-dir property and option
>
>  .gitmodules  |   3 +
>  autogen.sh   |   2 +-
>  configure.ac |   4 +
>  doc/reference/spice-gtk-docs.xml |   1 +
>  doc/reference/spice-gtk-sections.txt |  17 +
>  doc/reference/spice-gtk.types|   4 +-
>  gtk/Makefile.am  |   9 +-
>  gtk/channel-webdav.c | 737 
> +++
>  gtk/channel-webdav.h |  68 
>  gtk/map-file |   1 +
>  gtk/phodav   |   1 +
>  gtk/spice-channel.c  |   6 +
>  gtk/spice-client.h   |   1 +
>  gtk/spice-glib-sym-file  |   1 +
>  gtk/spice-option.c   |   5 +
>  gtk/spice-session-priv.h |   6 +
>  gtk/spice-session.c  |  50 ++-
>  spice-common |   2 +-
>  18 files changed, 912 insertions(+), 6 deletions(-)
>  create mode 100644 gtk/channel-webdav.c
>  create mode 100644 gtk/channel-webdav.h
>  create mode 16 gtk/phodav
>
> --
> 1.8.5.3
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Compiling Spice client on Windows

2014-03-07 Thread Cody Chan
Hi, if you just want to get exe file, it's not recommended to build in windows!
Cross compiling in linux(fedora/centos/rhel is better) works fine, and
is recommended by document ,
please read mingw-spec* file in source code for dependence
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Spice Downloads

2014-03-04 Thread Cody Chan
On Tue, Mar 4, 2014 at 6:23 PM, Uri Lublin  wrote:
> On 03/04/2014 11:04 AM, Cody Chan wrote:
>>
>> Hi, I met this problem, and I solved by using ie instead of chrome
>> Maybe your situation is different, may help you
>>
>> On Tue, Mar 4, 2014 at 4:16 AM, Joe Butler 
>> wrote:
>>>
>>> Hello, the spice download section does not seem to link to a download
>>> page,
>>> it just downloads a download.htm file.
>>>
>>> Can this be fixed so I can download the client?
>
>
>
>
> Accessing the download page works for me, on a WinXP VM with all of
> IE, FF, and Chrome.
>
> The download page is download.html (not download.htm).
>
> Please try going directly to this page
> http://www.pice-space.org/download.html

I think his/her problem is getting a download.html file, such as:

virt-viewer Windows installer - 32 bit - virt-viewer-x86.msi
virt-viewer Windows installer - 64 bit - virt-viewer-x64.msi

I watch the elements of this page in detail, here may be a problem,
you see the following is element of virt-viewer-x86.msi
http://virt-manager.org/download/";
download="">virt-viewer-x86.msi

but for chrome , it may not explain "application/octet-stream" correctly
see this for details:
http://webmasters.stackexchange.com/questions/21658/what-could-keep-chrome-from-downloading-files

> If there are still problems, please provide more information about the steps
> you
> take and the environment you use.
>
> Hope that helps,
>Uri.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Spice Downloads

2014-03-04 Thread Cody Chan
Hi, I met this problem, and I solved by using ie instead of chrome
Maybe your situation is different, may help you

On Tue, Mar 4, 2014 at 4:16 AM, Joe Butler  wrote:
> Hello, the spice download section does not seem to link to a download page,
> it just downloads a download.htm file.
>
> Can this be fixed so I can download the client?
>
> Many Thanks.
>
> Sent from Windows Mail
>
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] How to drag a folder from client to guest?

2014-02-25 Thread Cody Chan
On Tue, Feb 25, 2014 at 6:15 PM, Marc-André Lureau  wrote:
>
>
> - Original Message -
>> On Tue, Feb 25, 2014 at 6:03 AM, Marc-André Lureau 
>> wrote:
>> > Hi
>> >
>> > - Original Message -
>> >> Probably the function of copying has three defects:
>> >>
>> >> i)For some languages,there is a mis-encoding of file name
>> >> I have solved by myself...(under some circumstance)
>> >>
>> >
>> > Yeah, I remember your patch, but you didn't follow up, right? Are you still
>> > working on this?
>> Aha:) I have followed your advices, but the effect is the same with I
>> have patched
>> I don't have good environment to do more test...So I still need to
>> read source code deeply!
>>
>> >> ii)Can't drag multi-files
>> >> I'm glad to see the following in source code:
>> >>  /* At the moment, the copy() method is limited to a single file,
>> >>support for copying multi-files will be implemented later. */
>> >> g_return_if_fail(sources[1] == NULL);
>> >>
>> >> iii)But, it doesn't support for drag folder
>> >> Is there TODO I don't find? Or any ideas about solution?
>> >
>> >
>> > Imho, dragging files/folder shouldn't be done via a Spice "copy" protocol.
>> > Instead, Spice should learn to implement drag and drop. Afaik this should
>> > be doable, but nobody worked on it.
>>
>> Actually, I'm always curious if copying muti-files/folder can be done
>> by compressing to a zip/... before transfering ..of course, it's not a
>> cool solution...
>
> Compression can be handled by a remote filesystem protocol. Imho, we 
> shouldn't reimplement something like scp/rsync in Spice.

yeah, BTW, in spice-gtk-0.23/gtk/channel-main.c, if I change it like
the following, then muti-files copying works!

---g_return_if_fail(sources[1] == NULL);

if (!c->agent_connected) {
g_simple_async_report_error_in_idle(G_OBJECT(channel),
callback,
user_data,
SPICE_CLIENT_ERROR,
SPICE_CLIENT_ERROR_FAILED,
"The agent is not connected");
return;
}
+++ int cnt = 0;
+++ while(NULL != sources[cnt]){
file_xfer_send_start_msg_async(channel,
 ---  sources[0],
+++sources[cnt],
   flags,
   cancellable,
   progress_callback,
   progress_callback_data,
   callback,
   user_data);
+++   ++cnt;
+++}

I think it over, and don't the reason RedHat doesn't support
muti-files copying...
Further, if g_file_get_path(sources[cnt]) is a folder, I can copy all
files by DFS/BFS, then  folder copying also can be supported
Any idea?

>> > Otoh, you might be interested in the sharing folder functionality. It
>> > allows you to have a folder on the client mounted/visible directly in the
>> > guest. From there copy will work like a regular guest operation, with
>> > guest UI etc.
>>
>> Here's a  particular requirement that files can ONLY be draged from
>> local to guest..
>
> You mean currently? Yes, it's a known limitation. However, with the shared 
> folder, you can copy to and from the client folder.
I mean this's my requirement, so the shared folder is not adaptable for me
>
>>
>> >This function is mostly ready, and I will submit a new patch this week (I'll
>> >add you in CC).
>>
>> I'm really appreciate to hear that, thx a lot:)
>> ___
>> Spice-devel mailing list
>> Spice-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>>
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] How to drag a folder from client to guest?

2014-02-24 Thread Cody Chan
On Tue, Feb 25, 2014 at 6:03 AM, Marc-André Lureau  wrote:
> Hi
>
> - Original Message -
>> Probably the function of copying has three defects:
>>
>> i)For some languages,there is a mis-encoding of file name
>> I have solved by myself...(under some circumstance)
>>
>
> Yeah, I remember your patch, but you didn't follow up, right? Are you still 
> working on this?
Aha:) I have followed your advices, but the effect is the same with I
have patched
I don't have good environment to do more test...So I still need to
read source code deeply!

>> ii)Can't drag multi-files
>> I'm glad to see the following in source code:
>>  /* At the moment, the copy() method is limited to a single file,
>>support for copying multi-files will be implemented later. */
>> g_return_if_fail(sources[1] == NULL);
>>
>> iii)But, it doesn't support for drag folder
>> Is there TODO I don't find? Or any ideas about solution?
>
>
> Imho, dragging files/folder shouldn't be done via a Spice "copy" protocol. 
> Instead, Spice should learn to implement drag and drop. Afaik this should be 
> doable, but nobody worked on it.

Actually, I'm always curious if copying muti-files/folder can be done
by compressing to a zip/... before transfering ..of course, it's not a
cool solution...

> Otoh, you might be interested in the sharing folder functionality. It allows 
> you to have a folder on the client mounted/visible directly in the guest. 
> From there copy will work like a regular guest operation, with guest UI etc.

Here's a  particular requirement that files can ONLY be draged from
local to guest..

>This function is mostly ready, and I will submit a new patch this week (I'll 
>add you in CC).

I'm really appreciate to hear that, thx a lot:)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] How to drag a folder from client to guest?

2014-02-24 Thread Cody Chan
Probably the function of copying has three defects:

i)For some languages,there is a mis-encoding of file name
I have solved by myself...(under some circumstance)

ii)Can't drag multi-files
I'm glad to see the following in source code:
 /* At the moment, the copy() method is limited to a single file,
   support for copying multi-files will be implemented later. */
g_return_if_fail(sources[1] == NULL);

iii)But, it doesn't support for drag folder
Is there TODO I don't find? Or any ideas about solution?

Thx in advance :)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [patch]spice-gtk: encoding problem when drag a file from client to guest

2014-02-17 Thread Cody Chan
On Mon, Feb 17, 2014 at 8:47 PM, Marc-André Lureau  wrote:
> Hi
>
> - Original Message -
>> hi, here's my environment:
>> client: win7(default encoding is GBK)
>> guest the same with client
>> spice-gtk-0.23d
>>
>> a file in guest with a name of Chinese
>> the file name is wrong when drag it to guest desktop
>> (I think Japanese and Korean have the same problem )
>>
>> the following is my patch to " spice-gtk-0.23/gtk/channel-main.c"
>>
>> Regards
>>
>> --- spice-gtk-0.23/gtk/channel-main.c 2014-02-06 19:08:07.0 +0800
>> +++ spice-gtk-0.23_modified/gtk/channel-main.c 2014-02-17 20:12:55.037816310
>> +0800
>> @@ -2786,8 +2786,10 @@
>>
>> /* File name */
>> basename = g_file_get_basename(file);
>> - g_key_file_set_string(keyfile, "vdagent-file-xfer", "name", basename);
>
> From glib API reference, I understand basename is a byte string of 
> unspecified encoding.
>
unspecified encoding == "utf-8" or unspecified encoding  == locale encoding?
do you mean locale encoding?
>> + gchar *basename_loc = g_locale_from_utf8(basename, -1, NULL, NULL, NULL);
>
> So this is probably wrong. You should also check for errors.

yeah, actually, i use g_convert(basename, -1, "gbk", "utf-8", ...) to
get a right result
but I don't think it's a general case, so patch it with g_locale_from_utf8(...)
I'll keep testing to Confirm the problem

> Instead, I think we should use g_file_info_get_display_name()
thx, I'd try
>> + g_key_file_set_string(keyfile, "vdagent-file-xfer", "name", basename_loc);
>> g_free(basename);
>> + g_free(basename_loc);
>> /* File size */
>> g_key_file_set_uint64(keyfile, "vdagent-file-xfer", "size", task->file_size);
>>
>
> Can you send patches using git-send-email (inline by default) or as 
> attachments?

sorry, it's my first time to send a patch in mail list, thank you for Remind :)
> thanks
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [patch]spice-gtk: encoding problem when drag a file from client to guest

2014-02-17 Thread Cody Chan
hi, here's my environment:
client: win7(default encoding is GBK)
guest the same with client
spice-gtk-0.23d

a file in guest with a name of Chinese
the file name is wrong when drag it to guest desktop
(I think Japanese and Korean have the same problem)

the following is my patch to "spice-gtk-0.23/gtk/channel-main.c"

Regards

--- spice-gtk-0.23/gtk/channel-main.c   2014-02-06 19:08:07.0 +0800
+++ spice-gtk-0.23_modified/gtk/channel-main.c  2014-02-17
20:12:55.037816310 +0800
@@ -2786,8 +2786,10 @@

 /* File name */
 basename = g_file_get_basename(file);
-g_key_file_set_string(keyfile, "vdagent-file-xfer", "name", basename);
+gchar *basename_loc = g_locale_from_utf8(basename, -1, NULL, NULL,
NULL);
+g_key_file_set_string(keyfile, "vdagent-file-xfer", "name",
basename_loc);
 g_free(basename);
+g_free(basename_loc);
 /* File size */
 g_key_file_set_uint64(keyfile, "vdagent-file-xfer", "size",
task->file_size);
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel