mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2024-12-21 09:33:59 +03:00
Add support for usb-redirect-on-connect in vv-files
Mirror the --spice-usbredir-redirect-on-connect command line option Signed-off-by: Alberto Mattea <alberto@mattea.info>
This commit is contained in:
parent
0a6155ca13
commit
f374f7a02d
@ -330,6 +330,11 @@ And the rules themselves are concatenated like this:
|
||||
|
||||
C<rule1|rule2|rule3>
|
||||
|
||||
=item C<usb-redirect-on-connect> (string)
|
||||
|
||||
Set a string specifying a filter to determine which USB devices, that are already plugged in,
|
||||
to redirect on connect once Spice connection is established. See usb-filter for the format.
|
||||
|
||||
=item C<secure-channels> (string list)
|
||||
|
||||
The list of session channels to secure.
|
||||
|
@ -70,6 +70,7 @@
|
||||
* - disable-effects: string list
|
||||
* - enable-usb-autoshare: int
|
||||
* - usb-filter: string
|
||||
* - usb-redirect-on-connect: string
|
||||
* - secure-channels: string list
|
||||
* - delete-this-file: int (0 or 1 atm)
|
||||
* - proxy: proxy URL, like http://user:pass@foobar:8080
|
||||
@ -131,6 +132,7 @@ enum {
|
||||
PROP_DISABLE_EFFECTS,
|
||||
PROP_ENABLE_USB_AUTOSHARE,
|
||||
PROP_USB_FILTER,
|
||||
PROP_USB_REDIRECT_ON_CONNECT,
|
||||
PROP_PROXY,
|
||||
PROP_VERSION,
|
||||
PROP_VERSIONS,
|
||||
@ -693,6 +695,19 @@ virt_viewer_file_set_usb_filter(VirtViewerFile* self, const gchar* value)
|
||||
g_object_notify(G_OBJECT(self), "usb-filter");
|
||||
}
|
||||
|
||||
gchar*
|
||||
virt_viewer_file_get_usb_redirect_on_connect(VirtViewerFile* self)
|
||||
{
|
||||
return virt_viewer_file_get_string(self, MAIN_GROUP, "usb-redirect-on-connect");
|
||||
}
|
||||
|
||||
void
|
||||
virt_viewer_file_set_usb_redirect_on_connect(VirtViewerFile* self, const gchar* value)
|
||||
{
|
||||
virt_viewer_file_set_string(self, MAIN_GROUP, "usb-redirect-on-connect", value);
|
||||
g_object_notify(G_OBJECT(self), "usb-redirect-on-connect");
|
||||
}
|
||||
|
||||
gchar*
|
||||
virt_viewer_file_get_proxy(VirtViewerFile* self)
|
||||
{
|
||||
@ -1065,6 +1080,9 @@ virt_viewer_file_set_property(GObject* object, guint property_id,
|
||||
case PROP_USB_FILTER:
|
||||
virt_viewer_file_set_usb_filter(self, g_value_get_string(value));
|
||||
break;
|
||||
case PROP_USB_REDIRECT_ON_CONNECT:
|
||||
virt_viewer_file_set_usb_redirect_on_connect(self, g_value_get_string(value));
|
||||
break;
|
||||
case PROP_PROXY:
|
||||
virt_viewer_file_set_proxy(self, g_value_get_string(value));
|
||||
break;
|
||||
@ -1193,6 +1211,9 @@ virt_viewer_file_get_property(GObject* object, guint property_id,
|
||||
case PROP_USB_FILTER:
|
||||
g_value_take_string(value, virt_viewer_file_get_usb_filter(self));
|
||||
break;
|
||||
case PROP_USB_REDIRECT_ON_CONNECT:
|
||||
g_value_take_string(value, virt_viewer_file_get_usb_redirect_on_connect(self));
|
||||
break;
|
||||
case PROP_PROXY:
|
||||
g_value_take_string(value, virt_viewer_file_get_proxy(self));
|
||||
break;
|
||||
@ -1353,6 +1374,10 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass)
|
||||
g_param_spec_string("usb-filter", "usb-filter", "usb-filter", NULL,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_USB_REDIRECT_ON_CONNECT,
|
||||
g_param_spec_string("usb-redirect-on-connect", "usb-redirect-on-connect", "usb-redirect-on-connect", NULL,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_DISABLE_CHANNELS,
|
||||
g_param_spec_boxed("disable-channels", "disable-channels", "disable-channels", G_TYPE_STRV,
|
||||
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
|
||||
|
@ -86,6 +86,8 @@ gint virt_viewer_file_get_enable_usb_autoshare(VirtViewerFile* self);
|
||||
void virt_viewer_file_set_enable_usb_autoshare(VirtViewerFile* self, gint value);
|
||||
gchar* virt_viewer_file_get_usb_filter(VirtViewerFile* self);
|
||||
void virt_viewer_file_set_usb_filter(VirtViewerFile* self, const gchar* value);
|
||||
gchar* virt_viewer_file_get_usb_redirect_on_connect(VirtViewerFile* self);
|
||||
void virt_viewer_file_set_usb_redirect_on_connect(VirtViewerFile* self, const gchar* value);
|
||||
gboolean virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **error);
|
||||
gchar* virt_viewer_file_get_smartcard_insert(VirtViewerFile* self);
|
||||
void virt_viewer_file_set_smartcard_insert(VirtViewerFile* self, const gchar* value);
|
||||
|
@ -632,6 +632,16 @@ fill_session(VirtViewerFile *file, SpiceSession *session)
|
||||
g_free(filterstr);
|
||||
}
|
||||
|
||||
if (virt_viewer_file_is_set(file, "usb-redirect-on-connect")) {
|
||||
gchar *filterstr = virt_viewer_file_get_usb_redirect_on_connect(file);
|
||||
SpiceUsbDeviceManager *manager = spice_usb_device_manager_get(session,
|
||||
NULL);
|
||||
if (manager != NULL) {
|
||||
g_object_set(manager, "redirect-on-connect", filterstr, NULL);
|
||||
}
|
||||
g_free(filterstr);
|
||||
}
|
||||
|
||||
if (virt_viewer_file_is_set(file, "secure-channels")) {
|
||||
gchar **channels = virt_viewer_file_get_secure_channels(file, NULL);
|
||||
g_object_set(G_OBJECT(session), "secure-channels", channels, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user