Age | Commit message (Collapse) | Author | Files | Lines |
|
libusbredirhost prefixes all its messages with "usbredirhhost: ", which
is useful when logging to stderr, but not so much when showing the error
to the user in an error dialog, so remove the "usbredirhost: " prefix
when we store the message in a GError.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Its only user is channel-usbredir, which needs the libusb_device.
In preparations for a different SpiceUsbDevice.
|
|
This fixes the following compilation error:
channel-usbredir.c: In function 'spice_usbredir_channel_connect_device_async':
channel-usbredir.c:313:9: error: jump skips variable initialization [-Werror=jump-misses-init]
|
|
Reported and verified by Nicolas Prochazka
|
|
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Required to build on RHEL, even upcoming 6.3
|
|
In glib <= 2.30 g_mutex_foo() are macro's so dereferencing them directly
does not work.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
channel_reset gets called from spice_channel_disconnect, and
spice_usbredir_channel_disconnect calls spice_channel_disconnect
(so as to disconnect the channel when a usb device gets disconnected).
So calling spice_usbredir_channel_disconnect from channel_reset leads to
undesirable recursion. More over calling spice_usbredir_channel_disconnect
disconnects / closes both the channel and *the usb device* and closing the
usb device on migration is not what we want.
Note that currently migration of usbredir channels does not work, and this
patch does not fix this, but it does fix a regression when disconnecting
usb devices normally (by unplugging them for example).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
No that we no longer use GUsbSource we're hardly using any code from GUsb,
so drop our embeddied GUsb copy and do the last few things (device
enumeration through gudev) ourselves.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Now that we no longer use a GUsbSource this is no longer needed.
Note this is a change to our public API, but that is ok since we have not
yet done an official release with usbredir support.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This solves various latency issues with USB handling.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This is a preparation patch for handling usb packet completion in a
separate thread.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This is a preparation patch for handling usb packet completion in a
separate thread.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
The new (in usbredir-0.3.2) usbredirhost_open_full()
function allows us to be notified whenever usb packets completing
result in data to be send to the host. This removes the need for using
g_usb_source_set_callback and seeing if there is data to write on
any of the usb channels each time some usb event happens.
This also bumps the minimum needed libusbredirhost version to 0.3.2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
A usbredir channel must always be bi-directional. spice-server
allows only one client to connect even when in multi-client mode. Since
usually there are multiple usb channels available, it is allowed for one client
to use one channel, while another client uses another usb channel.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This new private method is to reset the channel to its initial state,
used by semi-seamless migration
|
|
All callers of spice_msg_out[_send_internal] unref the message immediately
after calling spice_msg_out[_send_internal]. This patch changes the
semantics so that spice_msg_out[_send_internal] takes ownership and it
is responsible for unref-ing the passed in SpiceMsgOut.
This is a preparation patch for changing the buffered write code
to use a queue of SpiceMsgOut-s, rather then memcpy the message contents
into an intermediate buffer.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Normally opening the USB device without first calling the helper will fail,
except when the process using spice-gtk is running as root.
So the current code which first tries to open the USB device before calling
the helper is optimizing for an exception rather then for the default code
path. More over it also causes libusb to print the following errors to stderr:
libusb:error [op_open] libusb couldn't open USB device /dev/bus/usb/002/017: Permission denied.
libusb:error [op_open] libusb requires write access to USB device nodes.
So this patch changes things to first call the helper and only then try
to open the device node.
This patch also modifies the helper to not call policykit when called by
a root process, since the set_facl which it will do, if policykit says it
is ok, is a no-op for root anyways. Instead it directly returns a success
status without doing anything when called by a root process.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
The usb acl helper asks policykit, which may want to interact with the
user through the policykit agent, which wants to grab the keyboard, if
we then have the keyboard grabbed, the agent says authentication has failed,
policykit rejects the helper opening up the acl and usbredir won't work.
Unfortunately the only way to work around this is to temporarily release our
own keyboard grab, not pretty but as discussed on irc, this is the "best"
solution.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
spice-client needs to be able to open the device nodes under /dev/bus/usb
to be able to redirect a usb device to the guest. Normally opening these
nodes is only allowed by root. This patch adds a suid root helper which
asks policykit if it is ok to grant raw usb device access, and if policykit
says it is ok, opens up the acl so that the spice-client can open the device
node.
As soon as spice-client closes the stdin of the helper, the helper removes
the extra rights. This ensures that the acl gets put back to normal even if
the spice client crashes. Normally the spice-client closes stdin directly
after opening the device node.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
With the (upcoming) introduction of the usb device node acl helper, which
uses policykit, spice_usbredir_channel_connect() may take a long time as
it will be waiting for the helper, which will be waiting for policykit which
may be interacting with the user -> Make spice_usbredir_channel_connect() async
Note that this patch only changes spice_usbredir_channel_connect's
API to use the standard GIO async API, it is not actually async after this
patch since it does not yet call the acl helper.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
This is a preparation patch for adding the usb device node acl helper
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
glib does not like it when objects have a private data size of 0, so don't
declare any private data when compiling without USE_USBREDIR set.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Private data in GObject's is initialized to 0's upon constuction
|
|
libusb_strerror is not going upstream because of i18n worries, provide
our own for now.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|