summaryrefslogtreecommitdiff
path: root/usbredirhost
AgeCommit message (Collapse)AuthorFilesLines
2014-12-04build-sys: add git.mk to generate .gitignoreMarc-André Lureau1-0/+2
2014-10-02usbredirhost: Add 2798:0001 to the do-not-reset blacklistHans de Goede1-0/+1
https://bugzilla.redhat.com/show_bug.cgi?id=1115917 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: reset device on releaseHans de Goede1-0/+10
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: lock host earlier in async packet completion callbacksHans de Goede1-5/+6
The transfer->foo_packet union members are also used on cancellation, and completion and cancellation may race, so they should not be accessed without holding the lock. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Improve debug loggingHans de Goede1-9/+22
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Fix a cancellation corner caseHans de Goede1-1/+3
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Add missing flush on cancelHans de Goede1-0/+1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Ensure all in flight urbs are cancelled before a resetHans de Goede1-0/+11
The guest should have cancelled any pending urbs already, but the cancellations have not necessary completed when we receive a reset. If we then continue with the reset pending urbs may complete with an error code of LIBUSB_TRANSFER_NO_DEVICE, causing us to see a device disconnect. We also need to cleanly shutdown any streams and let the guest know they should be restarted after the reset. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost_cancel_pending_urbs: Add a notify_guest parameterHans de Goede1-4/+11
If this is 1 then the guest will be send stream_status packets with a status of usb_redir_stall for any stopped streams. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Add usbredirhost_wait_for_cancel_completion helperHans de Goede1-12/+19
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-11-19usbredirhost: Implement support for bulk streamsHans de Goede1-5/+85
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-10-19usbredirhost: Fill in max_streams in ep_infoHans de Goede1-0/+24
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-07-12usbredirhost: Use libusb_set_auto_detach_kernel_driver when availableHans de Goede1-0/+15
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-05-13usbredirhost: Fix coverity sign_extension warningHans de Goede1-1/+2
Coverity does not like uint8_t * int being casted to an uint64_t, change the int to an unsigned int to make it happy. Note that the int in question can never be > 255, so this is not a real issue. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-01-25Properly declare C symbolsMarc-André Lureau1-0/+8
2012-12-05usbredirhost: Add a do-not-reset device blacklistHans de Goede1-11/+47
And populate it with 1210:001c Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Only apply mult to max-packet-size for isoc high speed endpointsHans de Goede1-16/+17
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add support for buffered bulk inputHans de Goede1-10/+67
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add usbredirhost_stop_stream() helper functionHans de Goede1-28/+14
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add usbredirhost_send_stream_data() helper functionHans de Goede1-34/+49
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Push sending of stream error status lower down the stackHans de Goede1-59/+43
Send the error status in the places where the error actually happens, rather then passing an error return code all the way up, and then check + send the error status at the higher level. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add usbredirhost_send_stream_status() helper functionHans de Goede1-32/+36
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add usbredirhost_clear_stream_stall_unlocked() helper funcHans de Goede1-29/+22
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost_interrupt_packet_complete: Split into in / out versionsHans de Goede1-26/+37
And name the input version usbredirhost_buffered_packet_complete in preparation for also using it for handling of buffered bulk-in endpoints. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Use multiple transfers for interrupt receivingHans de Goede1-136/+33
To ensure we don't loose any date when we suffer some latency in completion processing. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost_submit_stream_transfer_unlocked: Handle device disconnectHans de Goede1-3/+7
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Misc. stream cleanupsHans de Goede1-25/+28
1) Any stream failure which causes the stream to stop, should return usb_redir_stall, push this logic into the actual functions causing the failure, rather then letting the callers translate the error code. 2) Rename usbredirhost_alloc_stream to usbredirhost_alloc_stream_unlocked, add a new usbredirhost_alloc_stream() which does the locking on behalf of the caller. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Move start_stream for input endpoints to alloc_streamHans de Goede1-17/+7
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Add usbredirhost_start_stream_unlocked() helper functionHans de Goede1-34/+33
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Move the stream utility functions togetherHans de Goede1-127/+131
Now that the iso functions have been changed into generic buffered stream functions group them together in their own block, rather then grouping them with other iso functions. No functional changes, just moving code around. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-12-05usbredirhost: Change iso code into generic buffered stream codeHans de Goede1-121/+127
Mostly just variable/function renaming, and some small changes to usbredir_alloc_iso_stream to allow extending it to also allocate other type of streams (interrupt, bulk). This is a preparation patch for using multiple transfers per endpoint for interrupt receiving as well as for adding buffered bulk input support. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-10-06usbredirhost: Add support for bulk packets longer then 65535 bytesHans de Goede1-5/+9
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-25Rename libusbredirparser.pc to libusbredirparser-0.5.pcusbredir-0.5.2Hans de Goede1-1/+1
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 <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
2012-09-19Make usbredir*_has_data_to_write return the write queue depthHans de Goede1-2/+2
Instead of only returning 0 or 1, this can be used for flowcontrol purposes. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-11libusbredirhost: Don't call libusb_error_name() on transfer status codesHans de Goede1-4/+2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-09-07usbredirhost: Fix compiler warning when using -Wformat-securityHans de Goede1-1/+1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-08-31usbredirhost: Use libusb_error_name instead of logging raw error codesHans de Goede1-26/+35
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-08-31usbredirparser: Update API for 64 bit packet idsHans de Goede1-41/+46
-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 <hdegoede@redhat.com>
2012-08-31usbredirhost: Ack packet cancels immediatelyHans de Goede1-34/+71
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 <hdegoede@redhat.com>
2012-07-30Make log message prefix constantHans de Goede1-32/+29
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 <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
2012-07-28usbredirhost: Make the error message for busy devices more userfriendlyHans de Goede1-2/+5
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-07-06usbredirhost: Properly log an error when the initial device reset failsHans de Goede1-0/+1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
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]
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-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 <hdegoede@redhat.com>
2012-03-31usbredirhost: Restore device config when releasing the deviceHans de Goede1-6/+39
Signed-off-by: Hans de Goede <hdegoede@redhat.com>