summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-04-18Send Hangul key in KR keyboardHEADmasterTakao Fujiwara1-0/+9
Korean keyboard assigns Hangul key on the position of Right Alt and Left Alt and Hangul keys have the different scancodes but MapVirtualKey() returned the same scancode and could not use Hangul key on Linux desktop. The fix is to send the right scancode of VK_HANGUL.
2016-04-18Send key release event for some keys in JP keyboardTakao Fujiwara1-0/+48
With the previous fix, WM_KEYDOWN of Alt+Zenkaku_Hankaku (VK_KANJI) can be sent with spice-gtk but Alt+Zenkaku_Hankaku does not send the WM_KEYUP event in Windows and it caused Linux desktop freeze with unlimited key press events. The proposed fix is to send the key release event in spice-gtk. VK_DBE_ALPHANUMERIC, VK_DBE_HIRAGANA, VK_DBE_ROMAN are applied the similar fixes.
2016-04-18Send Zenkaku_Hankaku key in JP keyboardTakao Fujiwara1-2/+40
Zenkaku_Hankaku key has the different virtual-key codes between WM_KEYDOWN and WM_KEYUP and MapVirtualKey() cannot get the scancode from virtual-key code of WM_KEYDOWN (VK_DBE_DBCSCHAR) and spice-gtk didn't send the key press events and caused the desktop freeze with unlimited key release events. The fix is to get the scancode from virtual-key code of WM_KEYUP (VK_DBE_SBCSCHAR) and Zenkaku_Hankaku key works fine. Alt + Zenkaku_Hankaku key also has the different virtual-key code and MapVirtualKey() cannot get the scancode from the virtual-key and spice-gtk didn't send the key press events and Alt+Zenkaku_Hankaku could not be used. The fix is to get the scancode from virtual-key code of Zenkaku_Hankaku key (VK_DBE_SBCSCHAR). VK_CAPITAL, VK_DBE_ROMAN are also applied the similar fixes.
2016-04-15channel-main: Move variable to block where is neededPavel Grunt1-4/+1
2016-04-15channel-main: Add helper function for getting audioPavel Grunt1-8/+9
Avoid repeating the same code and having a SpiceSession variable defined when is not really needed. Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-08Ensure that file transfers get cancelledJonathon Jongsma1-7/+10
When canceling a file transfer task in spicy, the client would often stop sending additional data, but it would not send a "CANCELLED" message to the guest. Because of this, the partial file would remain in the guest's downloads folder until the spice client disconnected, at which point the vdagent would remove the unfinshed file. This CANCELLED status message was only being sent if the task was canceled during the async file read operation. If you cancel a task, it's quite likely that it will happen during other operations (e.g. file_xfer_flush_async(), etc). In order to handle these scenarios (and make sure that the file gets canceled properly), send the FILE_XFER_STATUS message in spice_file_transfer_task_completed().
2016-04-07Do not call spice_egl_cursor_set when egl is disabledPavel Grunt2-1/+4
Fix memory leaks of cursor: 240 bytes in 1 blocks are possibly lost in loss record 10,786 of 12,521 at 0x4C2FA60: calloc (vg_replace_malloc.c:711) by 0x3700F861: ralloc_size (ralloc.c:113) by 0x36FD2D68: UnknownInlinedFun (list.h:83) by 0x36FD2D68: (anonymous namespace)::builtin_variable_generator::add_const(char const*, int) (builtin_variables.cpp:578) by 0x36FD4775: generate_constants (builtin_variables.cpp:725) by 0x36FD4775: _mesa_glsl_initialize_variables(exec_list*, _mesa_glsl_parse_state*) (builtin_variables.cpp:1303) by 0x36E03D26: create_new_program (ff_fragment_shader.cpp:1225) by 0x36E03D26: _mesa_get_fixed_func_fragment_program (ff_fragment_shader.cpp:1295) by 0x36E9A577: update_program (state.c:157) by 0x36E9A577: _mesa_update_state_locked (state.c:473) by 0x36E9A6A0: _mesa_update_state (state.c:504) by 0x36EB05E4: teximage (teximage.c:2947) by 0x36EB211F: _mesa_TexImage2D (teximage.c:3009) by 0x4E5024F: spice_egl_cursor_set (spice-widget-egl.c:497) by 0x4E4BFD7: cursor_set (spice-widget.c:2346) by 0x50D6245: g_cclosure_user_marshal_VOID__INT_INT_INT_INT_POINTER (spice-marshal.c:245)
2016-04-07Use g_clear_pointer if possiblePavel Grunt21-188/+70
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-04-07Use g_clear_object if possiblePavel Grunt3-29/+7
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-04-07Use g_object_unref instead of gdk_cursor_unrefPavel Grunt1-6/+6
GdkCursor is GObject and gdk_cursor_unref has been deprecated since 3.0 Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-04-07Use GMutex instead of GStaticMutexPavel Grunt4-15/+15
Since GLib 2.32 GMutex can be statically allocated, so GStaticMutex has been deprecated. Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-07Use GDK_VERSION_MAX_ALLOWEDPavel Grunt1-1/+4
In order to avoid using a too new Gtk API. Taken from virt-viewer 4c4a43c61db60ac815c0bc66730fa0a9a1571103 Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-04-07Use GLIB_VERSION_MAX_ALLOWEDPavel Grunt1-1/+7
In order to avoid using a too new GLib API. Taken from virt-viewer 96d120903f0b95d49642e58d4f796b4f62aa8b20 Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-04-01widget-egl: Define label only if can be usedPavel Grunt1-0/+3
The label can be used only with GDK_WINDOWING_WAYLAND Silence -Wunused-label
2016-03-30doc: Add description for spice_display_get_gl_scanout()Pavel Grunt1-0/+2
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30doc: Ignore spicy-connectPavel Grunt1-0/+1
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30spice-file-transfer-task: Fix docstringPavel Grunt1-1/+1
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30doc: channel stability should be StablePavel Grunt2-2/+2
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30doc: Remove private structsPavel Grunt1-7/+0
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30usb-device-manager: Fix docstringPavel Grunt2-5/+10
Add description, "Since" and change the parameter name in the docstring to match parameter name in the function definition. Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-30build-sys: Update symbol filesChristophe Fergeau3-5/+4
The OSX-specific symbol files were not updated after the recent API additions/removals, and some removed symbols were still listed in map-file.
2016-03-29egl: fix leak when display is unrealizeVictor Toso1-0/+1
eglTerminate should be called on unrealize. This not yet fix all the leaks but reduces it significantly from 318kb to 74kb as definitely lost and around 1mb to 8kb as indirectly lost. 4,096 bytes in 1 blocks are definitely lost in loss record 9,762 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x35688320: can_write_oacontrol (intel_extensions.c:121) by 0x35688320: intelInitExtensions (intel_extensions.c:279) by 0x35651380: brwCreateContext (brw_context.c:875) by 0x35602720: driCreateContextAttribs (dri_util.c:426) by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) by 0xF0BE727: eglCreateContext (eglapi.c:638) by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) by 0xB44CC51: g_signal_emit (gsignal.c:3441) 4,856 (32 direct, 4,824 indirect) bytes in 1 blocks are definitely lost in loss record 9,779 of 9,882 at 0x4C2A988: calloc (vg_replace_malloc.c:711) by 0xF0BEEF7: _eglCreateArray (eglarray.c:71) by 0xF0BF420: _eglLinkConfig (eglconfig.c:90) by 0xF0C4F8D: dri2_add_config (egl_dri2.c:307) by 0xF0C66EE: dri2_x11_add_configs_for_visuals (platform_x11.c:766) by 0xF0C80EC: dri2_initialize_x11_dri3 (platform_x11.c:1319) by 0xF0C80EC: dri2_initialize_x11 (platform_x11.c:1464) by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) by 0xF0C19B8: _eglMatchDriver (egldriver.c:292) by 0xF0BDD31: eglInitialize (eglapi.c:482) by 0x5461A76: spice_egl_init (spice-widget-egl.c:226) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) 5,921 (472 direct, 5,449 indirect) bytes in 1 blocks are definitely lost in loss record 9,794 of 9,882 at 0x4C2A988: calloc (vg_replace_malloc.c:711) by 0xF0C7E0E: dri2_initialize_x11_dri3 (platform_x11.c:1267) by 0xF0C7E0E: dri2_initialize_x11 (platform_x11.c:1464) by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) by 0xF0C19B8: _eglMatchDriver (egldriver.c:292) by 0xF0BDD31: eglInitialize (eglapi.c:482) by 0x5461A76: spice_egl_init (spice-widget-egl.c:226) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) by 0xB44CC51: g_signal_emit (gsignal.c:3441) by 0x5D2C9DB: gtk_widget_realize (gtkwidget.c:5454) 16,384 bytes in 4 blocks are definitely lost in loss record 9,854 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x3568AB30: intel_miptree_map_raw (intel_mipmap_tree.c:2149) by 0x3568CEE6: intel_miptree_map_gtt (intel_mipmap_tree.c:2182) by 0x3568CEE6: intel_miptree_map (intel_mipmap_tree.c:2774) by 0x35692851: intel_map_texture_image (intel_tex.c:227) by 0x35447C3B: store_texsubimage (texstore.c:1069) by 0x35447E9F: _mesa_store_teximage (texstore.c:1125) by 0x3543D9BA: _mesa_get_fallback_texture (texobj.c:1056) by 0x35443E1E: UnknownInlinedFun (texstate.c:562) by 0x35443E1E: update_program_texture_state (texstate.c:587) by 0x35443E1E: UnknownInlinedFun (texstate.c:726) by 0x35443E1E: _mesa_update_texture (texstate.c:757) by 0x35420809: _mesa_update_state_locked (state.c:430) by 0x35420ED0: _mesa_update_state (state.c:504) by 0x3535BF87: _mesa_Clear (clear.c:172) by 0x546214F: spice_egl_update_display (spice-widget-egl.c:514) 32,768 bytes in 1 blocks are definitely lost in loss record 9,864 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) by 0x3568853B: can_write_oacontrol (intel_extensions.c:153) by 0x3568853B: intelInitExtensions (intel_extensions.c:279) by 0x35651380: brwCreateContext (brw_context.c:875) by 0x35602720: driCreateContextAttribs (dri_util.c:426) by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) by 0xF0BE727: eglCreateContext (eglapi.c:638) by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) 32,768 bytes in 1 blocks are definitely lost in loss record 9,865 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) by 0x356887F3: can_do_pipelined_register_writes (intel_extensions.c:88) by 0x356887F3: intelInitExtensions (intel_extensions.c:338) by 0x35651380: brwCreateContext (brw_context.c:875) by 0x35602720: driCreateContextAttribs (dri_util.c:426) by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) by 0xF0BE727: eglCreateContext (eglapi.c:638) by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) 98,304 bytes in 3 blocks are definitely lost in loss record 9,872 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) by 0x35684052: brw_new_batch (intel_batchbuffer.c:164) by 0x35684052: _intel_batchbuffer_flush.part.2 (intel_batchbuffer.c:397) by 0x3564F834: intel_glFlush (brw_context.c:259) by 0xF0C3DA0: dri2_make_current (egl_dri2.c:1189) by 0xF0BAB1B: eglMakeCurrent (eglapi.c:703) by 0x546274E: spice_widget_init_egl_win (spice-widget-egl.c:316) by 0x546274E: spice_egl_realize_display (spice-widget-egl.c:333) by 0x545B89F: drawing_area_realize (spice-widget.c:586) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) by 0xB44CC51: g_signal_emit (gsignal.c:3441) 131,072 bytes in 4 blocks are definitely lost in loss record 9,874 of 9,882 at 0x35B19E40: drm_intel_gem_bo_map (intel_bufmgr_gem.c:1454) by 0x35683E3C: intel_batchbuffer_reset (intel_batchbuffer.c:68) by 0x356848E8: intel_batchbuffer_init (intel_batchbuffer.c:45) by 0x35651337: brwCreateContext (brw_context.c:848) by 0x35602720: driCreateContextAttribs (dri_util.c:426) by 0xF0C48B1: dri2_create_context (egl_dri2.c:1072) by 0xF0BE727: eglCreateContext (eglapi.c:638) by 0x5461D27: spice_egl_init (spice-widget-egl.c:256) by 0x545B885: drawing_area_realize (spice-widget.c:581) by 0xB431784: g_closure_invoke (gclosure.c:804) by 0xB443A40: signal_emit_unlocked_R (gsignal.c:3629) by 0xB44C92E: g_signal_emit_valist (gsignal.c:3385) 1,080,655 (284 direct, 1,080,371 indirect) bytes in 1 blocks are definitely lost in loss record 9,881 of 9,882 at 0x4C2A988: calloc (vg_replace_malloc.c:711) by 0x355A2221: ralloc_size (ralloc.c:113) by 0x355A227D: rzalloc_size (ralloc.c:134) by 0x355A2BEE: ra_alloc_reg_set (register_allocate.c:196) by 0x356D79AA: brw_alloc_reg_set(brw_compiler*, int) (brw_fs_reg_allocate.cpp:159) by 0x356D817D: brw_fs_alloc_reg_sets (brw_fs_reg_allocate.cpp:305) by 0x356FDACC: brw_compiler_create (brw_shader.cpp:84) by 0x35691995: intelInitScreen2 (intel_screen.c:1495) by 0x35602A5E: driCreateNewScreen2 (dri_util.c:144) by 0xF0C547B: dri2_create_screen (egl_dri2.c:674) by 0xF0C808F: dri2_initialize_x11_dri3 (platform_x11.c:1303) by 0xF0C808F: dri2_initialize_x11 (platform_x11.c:1464) by 0xF0C18FE: _eglMatchAndInitialize (egldriver.c:261) Acked-by: Marc-André Lureau <mlureau@redhat.com>
2016-03-29doc: Remove dropped functionsPavel Grunt1-2/+0
Dropped in 70a00b8fcc2ca85d3601f6ac4895f906f9032e77 Acked-by: Marc-André Lureau <mlureau@redhat.com>
2016-03-29widget: Avoid combining ternary with another operatorsPavel Grunt1-5/+6
Logical operators like "&&" has higher precedency than "?:". Readiness of SpiceDisplay was wrongly determined due to missing parentheses around the ternary operator. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=94738 Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-29usb: fix build, missing ')'Marc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2016-03-24usb device widget: don't try to disconnect on failed connectJonathon Jongsma2-0/+7
When you try to redirect a usb device to the guest and it fails, we uncheck the checkbox for this device. This causes the 'clicked' signal to be emitted, which causes us to try to disconnect the device (which is not currently connected, since the connect operation failed). When we try to disconnect an unconnected device, the device manager leaks memory and gets left in an inconsistent state because we allocate the task data, call _set_redirecting(self, TRUE) and then return early with the following warning printed to the terminal: (lt-spicy:4638): GSpice-CRITICAL **: spice_usbredir_channel_disconnect_device_async: assertion 'channel != NULL' failed To avoid this, disable signal handlers for the checkbox 'clicked' signal while we're changing the checkbox state in response to a connection error. In addition, add an additional check to spice_usb_device_manager_disconnect_device_async() to ensure that the passed device is actually connected.
2016-03-24SpiceUsbDeviceManager: propagate errors from sub-tasksJonathon Jongsma1-2/+17
_connect_device_async_cb() just turned TRUE unconditionally even if the sub-task had failed. Instead, introduce a _spice_usb_device_manager_connect_device_finish() function which passes up the result of the subtask.
2016-03-24UsbDeviceManager: Deprecate synchronous disconnection methodDmitry Fleytman1-0/+3
Asynchronous disconnection should be used instead. Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceWidget: Use asynchronous disconnect APIKirill Moizik1-9/+33
Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceWidget: Consider asynchronous redirection flowsKirill Moizik1-18/+20
Gray out redirection controls while there are asynchronous redirection flows in progress. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceWidget: Show info bar during redirection flowsKirill Moizik4-0/+33
Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24usbredir: Disconnect USB device asynchronouslyKirill Moizik1-7/+41
Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceManager: Track device disconnection operations in progressKirill Moizik1-2/+5
During device disconnection, unwanted hotplug events may happen. We need to ignore those therefore we track disconnection operations in progress. See also comment to commit "Do not process USB hotplug events while redirection is in progress" that introduces corresponding filtering out logic. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceManager: Implement asynchronous disconnect device flowKirill Moizik5-0/+140
This commit introduces functions for asynchronous disconnection flows. Following commits will make use of those. Thread safety is ensured the same way it was done for connection flow in previous commits. Disconnect logic is protected by the same locks that protect connect/usbredir/channel management logic. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24UsbDeviceManager: Track device redirection operations in progressKirill Moizik1-13/+54
During device connection, unwanted hotplug events may happen. We need to ignore those therefore we track redirection operations in progress. See also comment to commit "Do not process USB hotplug events while redirection is in progress" that introduces corresponding filtering out logic. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2016-03-24usbredir: Spawn a different thread for device redirection flowKirill Moizik1-12/+31
On Windows when using usbdk, opening and closing USB device handle, i.e. calling libusb_open()/libusb_unref_device() can block for a few seconds (3-5 second more specifically on patch author's HW). libusb_open() is called by spice_usbredir_channel_open_device(). libusb_unref_device() is called implicitly via usbredirhost_set_device(..., NULL) from spice_usbredir_channel_disconnect_device(). Both these calls happen on the main thread. If it blocks, this causes the UI to freeze. This commit makes sure libusb_open() is called from a different thread to avoid blocking the mainloop when usbdk is used. Following commits also move usbredirhost_set_device(..., NULL) call to separate threads. Since this commit introduces additional execution contexts running in parallel to the main thread there are thread safety concerns to be secured. Mainly there are 3 types of objects accessed by newly introduced threads: 1. libusb contexts 2. usbredir context 3. redirection channels Fortunately libusb accesses are either thread safe or already performed by a separate thread and protected by locks as needed. As for channels and usbredir, in order to achieve thread safety additional locks were introduced by previous patches in preparation to adding asynchronous contexts: 1. Channel objects data accesses from different threads protected with a new lock (device_connect_mutex); 2. Handling usbredir messages protected by the same new lock in order to ensure there are no messages processing flows in progress when device gets connected or disconnected. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24usbredir: Protect data accessed by asynchronous redirection flowsKirill Moizik2-3/+18
This commit adds locking to ensure thread safety required after start/stop redirection flows moved to separate threads. This is done in preparation to following commits that will introduce actual multithreaded access to corresponding routines. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24GUdevClient: Do not process USB hotplug events while redirection is in progressKirill Moizik1-0/+19
USB redirection flow on Windows includes a number of reset requests issued to the port that hosts the device deing redirected. Each port reset emulates device removal and reinsertion and produces corresponding hotplug events and a number of device list updates on different levels of USB stack and USB redirection engine. As a result, queriyng USB device list performed by spice-gtk's hotplug event handler may return inconsistent results if performed in parallel to redirection flow. This patch suppresses handling of USB hotplug events during redirection and injects a simulated hotplug event after redirection completion in order to properly process real device list changes in case they happened during the redirection flow. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usb-dev: Track device redirection operations in progressKirill Moizik1-0/+59
This commit introduces redirecting property of GUdevClient This property indicates when a redirection operation is in progress on a device. It's set back to FALSE once the device is fully redirected to the guest. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24usbredir: Introduce mutex for device (dis)connectionKirill Moizik2-0/+19
This commit introduces channel mutex to allow usage of channel objects in mutithreaded environments. This mutex will be used by future commits to protect thread unsafe usbredir functions and data structures. Signed-off-by: Kirill Moizik <kmoizik@redhat.com> Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usb-dev: Fix device (un)plug notification handlerDmitry Fleytman1-65/+28
This patch fixes device list change notification handing logic for cases when more than one device being plugged or unplugged simultaneously. The simplest way to reproduce the problematic scenario is (un)plugging of a usb HUB with a few devices inserted. Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24usb-dev-manager: Fix cbinfo leak in case of abnormal returnDmitry Fleytman1-6/+9
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usbredir: Use UsbDk backend when availableDmitry Fleytman1-1/+3
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usbredir: Do not use UsbClerk for non-WinUsb backendsDmitry Fleytman1-16/+28
Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usbredir: Move installer interaction logic to separate functionsDmitry Fleytman1-43/+65
This is a refactoring done in preparation for the next commits. Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24usbdk: Load hide rules for auto-redirected devicesDmitry Fleytman1-0/+82
Hide rules order UsbDk to avoid showing specific USB devices to Windows PnP manager. Spice-gtk loads hide rules for devices that should be automatically redirected on connection to prevent Windows from showing "New Hardware Found" wizard window for USB devices that do not have driver on the local system. Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
2016-03-24win-usbredir: Only match USB devices by VID:PID when WinUsb usedDmitry Fleytman1-37/+43
In other cases match devices by BUS:ADDR. This commit introduces use_usbclerk flag which is set TRUE unconditionally for Windows builds for now. Next patches will introduce UsbDk backend integrartion which will set this flag in accordance to UsbDk presence on the system. Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24Add SpiceUsbDeviceManager parameter to device comparison functionsChristophe Fergeau1-18/+22
This additional parameter is currently unused, but this is in preparation for the next commits. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24win-usbredir: Introduce UsbDk wrapperDmitry Fleytman3-0/+223
Introduce UsbDk API definitions and binding code. UsbDk API DLL is loaded dynamically and wrapped by a thin glue code layer. This approach was chosen in order to make spice-gtk functional without UsbDk installed. Next patches will introduce dynamic backend selection logic, i.e. spice-gtk will try to use UsbDk by default and fallback to the old WinUsb/usbclerk scheme in case UsbDk is not available. Signed-off-by: Kirill Moizik <kirillm@daynix.com> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24widget: modify update-area to not require primary surfaceMarc-André Lureau1-13/+28
If egl display is enabled, use GL scanout geometry to check intersection with the monitor area. This solves displaying GL display without software canvas (currently d->area is empty and gl drawing fails) Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>