AgeCommit message (Collapse)AuthorFilesLines
2012-09-25Rename libusbredirparser.pc to libusbredirparser-0.5.pcusbredir-0.5.2Hans de Goede5-5/+12
The usbredir 0.5 release introduced the new API for 64 bit packet ids, but it kept the libusbredirparser.pc name as is, meaning that older versions of qemu will still have their pkg-config check for usbredirparser fulfilled, and build with the usb-redir device. Due to the API change there will be some compiler warnings, but the build will succeed, however the usb-redir device will be broken on 32 bit machines. To solve this, this patch renames the libusbredirparser.pc file to libusbredirparser-0.5.pc, so that it will no longer fulfill the pkg-config check of the qemu-1.2 and older releases, stopping the (silent) breakage. A patch has been send to qemu-devel to adjusts qemu master's configure. Signed-off-by: Hans de Goede <>
2012-09-25Prepare for a 0.5.1 releaseusbredir-0.5.1Hans de Goede2-2/+3
Signed-off-by: Hans de Goede <>
2012-09-19usbredirhost: Drop isoc in packets when write queue gets too largeHans de Goede1-2/+16
If the write queue gets too large our network connection likely is not keeping up. The best (and only) thing we can do then is drop isoc input packages, these are also the likely cause of this, since all other transfer types more or less auto-adjust to the network speed (rhbz#855737). Signed-off-by: Hans de Goede <>
2012-09-19Make usbredir*_has_data_to_write return the write queue depthHans de Goede5-7/+19
Instead of only returning 0 or 1, this can be used for flowcontrol purposes. Signed-off-by: Hans de Goede <>
2012-09-11libusbredirhost: Don't call libusb_error_name() on transfer status codesHans de Goede1-4/+2
Signed-off-by: Hans de Goede <>
2012-09-07usbredirhost: Fix compiler warning when using -Wformat-securityHans de Goede1-1/+1
Signed-off-by: Hans de Goede <>
2012-09-07Prepare for a 0.5 releaseusbredir-0.5Hans de Goede2-3/+3
Signed-off-by: Hans de Goede <>
2012-09-05usbredirparser: Add a usbredirparser_fl_no_hello flagHans de Goede2-6/+9
This is necessary to be able to properly init a parser for unserialization. Signed-off-by: Hans de Goede <>
2012-08-31usbredirparser: Check for extraneous state-data after unserializeHans de Goede1-0/+5
Signed-off-by: Hans de Goede <>
2012-08-31usbredirfilter_check: return -ENOENT rather then -EPERM if no rules matchHans de Goede3-10/+19
This way the caller can differentiate between a deny caused by a matching rule, and one caused by there being no matching rules. Signed-off-by: Hans de Goede <>
2012-08-31usbredirhost: Use libusb_error_name instead of logging raw error codesHans de Goede2-26/+36
Signed-off-by: Hans de Goede <>
2012-08-31usbredirparser: Update API for 64 bit packet idsHans de Goede6-129/+142
-ABI and API breakage !! -Bump libusbredirparser soname version -Change version to 0.5 so that libusbredirparser users can test for the new API Signed-off-by: Hans de Goede <>
2012-08-31Add support for 64 bit packet idsHans de Goede5-65/+108
Note this commit only adds support for 64 bit packet ids to the wire protocol and parser, the libusbredirparser API still needs to be updated to actually deal with 64 bit ids at the API level. Signed-off-by: Hans de Goede <>
2012-08-31usbredirproto-compat.h: Fixup copy paste naming errorHans de Goede2-2/+2
Rename usb_redir_ep_info_header_no_max_pktsz_version to usb_redir_ep_info_header_no_max_pktsz. Signed-off-by: Hans de Goede <>
2012-08-31usbredirhost: Ack packet cancels immediatelyHans de Goede2-34/+72
With the upcoming qemu changes (for live migration), once a packet has been cancelled its id may be reused for another packet immediately afterward, the usb-guest will then expect to first get the reply to the cancelled packet, and then to the new packet with the same id. But the actual cancellation can finish later then the new packet. To avoid this, this patch moves the sending back of the cancelled packet to the usb-guest to immediately after receiving the cancel, rather then waiting for the usb-host OS to mark the packet as completed or cancelled. Signed-off-by: Hans de Goede <>
2012-08-31Update ChangeLog for recent changesHans de Goede1-0/+8
As indicated in the ChangeLog I'm aiming to do a new release on Sept 3th :) Signed-off-by: Hans de Goede <>
2012-08-27usbredirparser: unserialize: Don't alloc a 0 bytes bufferHans de Goede1-7/+10
Signed-off-by: Hans de Goede <>
2012-08-14usbredirparser: Add state serialization supportHans de Goede2-0/+393
Signed-off-by: Hans de Goede <>
2012-08-08usbredirparser: Make sure we always have a consistent stateHans de Goede1-2/+4
Even when skipping over bad packets, this is needed for state serialization support. Signed-off-by: Hans de Goede <>
2012-07-31usbredirserver: Fix a crash on client disconnectHans de Goede1-0/+4
Signed-off-by: Hans de Goede <>
2012-07-30Make log message prefix constantHans de Goede2-57/+53
Make log messages prefix constant, rather then dependent on the log level so that it can be easily removed by the higher levels if desired, even when translated. Signed-off-by: Hans de Goede <>
2012-07-30usbredirhost: Move the busy device error to the right placeHans de Goede1-7/+7
After upstream review of the libusb patch for returning ERROR_BUSY from libusb_detach_kernel_driver if the uswbfs driver is already bound, the behavior has been changed to instead return ERROR_NOT_FOUND. This means that the userfriendly device is busy error test is now done in the wrong place. Signed-off-by: Hans de Goede <>
2012-07-28usbredirhost: Make the error message for busy devices more userfriendlyHans de Goede1-2/+5
Signed-off-by: Hans de Goede <>
2012-07-08usbredirfilter: Win32: use strtok_r implementation of glibcUri Lublin4-0/+100
I could not find an imlpementation of strtok_r in mingw. It seems strtok_s requires an additional package to be installed on the usb-host machine. This patch adds the glibc implementation of strtok_r to be used on windows.
2012-07-06usbredirhost: Properly log an error when the initial device reset failsHans de Goede2-0/+2
Signed-off-by: Hans de Goede <>
2012-06-22usbredirhost: Don't set a timeout on bulk transfersHans de Goede1-2/+2
Bulk packets can be (ab)used as interrupt transfers without timing guarantees, iow you can submit a bulk in transfer and let it be submitted until the device has data to reports a few eons later. This is used by (some?) USB cdc-acm devices (modems, smartcard readers, gps devices), specifically a smartcard reader I've been debugging, which currently does not work. Not setting a timeout at the usb-host side fixes these devices. For devices where timeouts do make sense, the timeouts should be handled by the usb-guest, which has device specific knowledge we lack. Signed-off-by: Hans de Goede <>
2012-05-23usbredirhost: claim/release: ignore NOT_SUPPORTED on attach|detach kernel driverUri Lublin1-1/+3
On Windows libusb_(attach|detach)_kernel_driver are not supported. A libusb driver is already installed (device was successfully opened). In that case just continue as if operation was successful.
2012-05-23usbredirhost: add LIBUSB_CALL to libusb complete-callback-functionsUri Lublin1-4/+4
In libusb.h the following definition appears: typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer); Added LIBUSB_CALL to the following functions: usbredirhost_iso_packet_complete usbredirhost_interrupt_packet_complete usbredirhost_control_packet_complete usbredirhost_bulk_packet_complete This fixes the following compiler warning for Windows (mingw): ./usbredirhost/usbredirhost.c: In function 'usbredirhost_alloc_iso_stream': ./usbredir/usbredirhost/usbredirhost.c:1206:13: warning: passing argument 7 of 'libusb_fill_iso_transfer' from incompatible pointer type [enabled by default] do not run ./configure if env variable NOCONFIGURE is definedUri Lublin1-1/+3
2012-05-23usbredirhost: undef ERROR if already definedUri Lublin1-0/+3
On Windows (mingw), ERROR is already defined (to 0) This fixes the following compiler warning: warning: "ERROR" redefined [enabled by default]
2012-05-23configure: Windows: ignore usbredirserver and usbredirtestclient subdirsUri Lublin2-1/+17
Their build fails, so skip them. Things to fix to make the them work on Win32 include sockets, signals, threads and more.
2012-04-02Release 0.4.3usbredir-0.4.3Hans de Goede2-1/+10
Signed-off-by: Hans de Goede <>
2012-04-02usbredirserver: Add a manpageHans de Goede2-0/+40
Signed-off-by: Hans de Goede <>
2012-03-31usbredirhost: Speed up reset handlingHans de Goede1-5/+29
In some cases a usb-guest does multiple resets in a row, these are instant from the guest pov but they are synchronously handled by us. So if a usb-guest does 4 resets in a row (seabios does this) then we can accumulate quite a bit of latency, sometimes so much that guests cancel a submitted transfer because they think it has timed out while we simply have not gotten around to handling it. This patch fixes this issue by speeding up resets in a number of ways: 1) Keep track of a reset state, if the device was reset and no requests were send to it since, this is true. In this case further resets are treated as a no-op. 2) Since the first thing most guests do is a reset, do one as soon as we open the device. 3) Remove the sleep we had in our reset code, as it is not necessary, actually the kernel already fires multiple commands to the device before the libusb_reset_device call returns... Signed-off-by: Hans de Goede <>
2012-03-31usbredirhost: Restore device config when releasing the deviceHans de Goede1-6/+39
Signed-off-by: Hans de Goede <>
2012-03-31usbredirhost: Fix handling of unconfigured devicesHans de Goede1-32/+34
Instead of rejecting (when trying to open) or crashing (when the device was set to unconfigured state from the guest), properly handle unconfigured devices. Signed-off-by: Hans de Goede <>
2012-03-06Release 0.4.2usbredir-0.4.2Hans de Goede1-1/+1
Signed-off-by: Hans de Goede <>
2012-03-06Extend the usb_redir_ep_info packet header with a max_packet_size fieldHans de Goede6-1/+35
This new field is only send / received if both sides have the (new) usb_redir_cap_ep_info_max_packet_size capability. Signed-off-by: Hans de Goede <>
2012-03-06Add usb_redir_babble status codeHans de Goede4-4/+14
Signed-off-by: Hans de Goede <>
2012-03-06Update ChangeLogHans de Goede1-0/+9
Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Fix reporting unused ep having a control typeHans de Goede1-1/+1
Before this patch we were reporting unused endpoints as having a type of control rather then invalid after a set_interface on interface 0. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Return usbredirhost_read_device_lost on reset failureHans de Goede1-2/+2
Failure to reset a device means that we've lost the device, report this to the user by returning usbredirhost_read_device_lost from the usbredirhost_read_guest_data call which triggered the reset. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Simplify usbredirhost_claim error handlingHans de Goede1-17/+5
An usbredirhost_claim failure always gets followed by a usbredirhost_clear_device call, so there is no need to cleanup / undo claiming of interfaces in the error path. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Make usbredirhost_release() return voidHans de Goede1-12/+6
No callers are interested in the return value, so lets just make it void. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Re-claim on set_config failureHans de Goede1-9/+5
If we fail to change the config we still need to re-claim the device, otherwise we loose access to it. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Move reading of active config and device desc. to claimHans de Goede1-16/+13
Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Failure to re-claim after a set_config means we've lost the devHans de Goede2-3/+12
So cleanup on failure to re-claim after a set_config, and let our user know that we've lost the device with a new usbredirhost_read_device_lost status. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Replace rejected flag with a read_status variableHans de Goede1-5/+6
So that the same mechanism can be used to return other errors too. Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Detach kernel drivers after a set_config tooHans de Goede1-14/+10
Changing the configuration of a device causes the drivers to get re-attached by the kernel, so we need to detach them after a set_config too. Since we then always detach the drivers we can drop the detach_drivers argument to usbredirhost_claim(). Signed-off-by: Hans de Goede <>
2012-03-06usbredirhost: Ensure we re-attach the kernel drivers after set_config failureHans de Goede1-1/+1
The set_config code path releases the interface without re-attaching the kernel drivers. If after this the actual set_config call or the re-claim failed the claimed flag would be 0, resulting in device cleanup not re-attaching the kernel drivers. So this patch keeps the claimed flag set to 1 when usbredirhost_release only releases the interfaces without re-attaching the kernel drivers, to ensure that they are properly re-attached on any later cleanup. Signed-off-by: Hans de Goede <>