summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-03-05usbredirhost: Always re-attach kernel-drivers on device cleanupHans de Goede1-20/+9
Before this patch we kept track of if we actually detached the kernel driver, and would only then re-attach the kernel driver. But if an app is using auto-redirection there is a chance that we claim the interface before the kernel driver got a chance to attach, this esp. happens when the module first needs to be loaded by udev. This scenario would leave people with USB-devices without devices attached which is very rarely what people want! So this patch changes our behavior to instead always re-attach the kernel drivers on device cleanup. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-25Release usbredir-0.4.1usbredir-0.4.1Hans de Goede2-1/+6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-25Compile with -Wall -Werror by default and fix existing warningsHans de Goede3-4/+19
The direct trigger for making this change is the fact that the 0.4 release is broken due to a return without a value in a non void function. Somehow this happened to always do the right thing in my testing, but not for others. This is something which should have been caught by a compiler warning, but I always build from git, and then no -Wall (let alone -Werror) gets passed to the compiler, which allowed this to slip through. So to avoid future embarrassment this patch changes the configure script to add various compiler options to CFLAGS by default, which should catch most detectable mistakes. Note that this change modifies CFLAGS directly, so if you're somehow specifying your own CFLAGS nothing will change (this is intentional). Also all added flags are checked, so if you've a compiler which is not gcc nothing will change. This patch also fixes the few warnings actually present in the code, so as to not have a state in the commit tree where the code does not compile. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-22Release 0.4usbredir-0.4Hans de Goede4-5/+24
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-22usbredirfilter: constify various rules pointersHans de Goede6-17/+21
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-22usbredirhost: Clear ep_info on set_interfaceHans de Goede1-17/+32
Now that we only re-parse the interface and not the entire config when changing the alt setting, we must first clear the ep-info of the endpoints currently belonging to the interface as a different alt setting may have less endpoints! Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-21usbredirhost: add a parse_interface helper functionHans de Goede1-18/+25
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-18usbredirfilter: Fix mask in print functionHans de Goede1-1/+1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-16usbredirhost: avoid doing multiple locks/unlocks when canceling pending urbsHans de Goede1-38/+38
Also fix a nasty bug where we would try to cancel the head rather then the first transfer in the list! Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-16usbredirhost: Allow re-using a host instance with multiple devicesHans de Goede3-59/+186
See the description of the new usbredirhost_set_device() function in usbredirhost/usbredirhost.h Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-16usbredirparser: usbredirparser_have_peer_caps functionHans de Goede2-5/+20
Also remove the never implemented usbredirparser_get_peer_caps function from the public header file. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost: add send_interface_n_ep_info() and send_device_connect() helpersHans de Goede1-37/+67
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14Add a usb_redir_device_disconnect_ack packetHans de Goede4-2/+63
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14Add a usb_redir_filter_filter packetHans de Goede6-60/+187
Make this conditional on the same cap as device_reject, rename the cap to usb_redir_cap_filter. Rename device_reject to filter_reject to reflect that it is filtering related and that the the cap and packet names are consistent with each other. Also cleanup some related comments / docs. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirparser: call usbredirparser_verify_type_header after we get the dataHans de Goede1-9/+7
So that it can do some sanity checks on the data too. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost.h: Fix comment about our multi-thread safenessHans de Goede1-7/+1
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost: consolidate cancellation codeHans de Goede1-55/+41
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost: Better locking for interrupt receiving handlingHans de Goede1-10/+10
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost: No need to keep the lock when freeing a transferHans de Goede1-5/+1
Remove the wrong comment and move the free outside the locked part of the function. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14Fix some spelling errorsHans de Goede2-8/+8
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-14usbredirhost: Fix handling of iso stream stallsHans de Goede1-29/+33
Before this patch the code would cancel the iso stream, but keep the transfers, and then on a successfull clear of the stall re-submit the same transfers. This means however that the transfers would get resubmitted before their completion callback from the cancel got to run. And re-submitting an uncompleted transfer will fail. So instead cancel and free the stream (getting rid of the single user of cancel_iso_stream which did not want it to also free the urbs) and when the stall is successfully cleared, alloc a new stream and, if it is an input stream, submit its transfers. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-10usbredirhost: Fix tracking of input interrupt urb statusHans de Goede1-6/+2
When an input interrupt urb failed with an error of LIBUSB_TRANSFER_NO_DEVICE, we do not resubmit it (which is correct), but we did not set endpoint.interrupt in_transfer to NULL either, so later on we would try to cancel the non submitted urb. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-10usbredirhost: Properly wait for all transfers to be cancelled on closeHans de Goede1-32/+26
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-10Add an usb_redir_device_reject packetHans de Goede7-14/+107
Add an usb_redir_device_reject packet to allow notifying the usb-host when an usb-guest rejects a device because of usb-guest side device filtering. Also bump the version to 0.3.4 so that apps can check if libusbredirparser / libusbredirhost knows about usb_redir_device_reject by checking the version number. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-30usbredirserver/testclient: Fixup license headerHans de Goede2-4/+4
Fix accidental mention of Library / Lesser in the disclaimer, these 2 test / example programs are meant to be under the GPL not the LGPL. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-23usbredirhost: Don't attach drivers when releasing interfaces for set_configHans de Goede1-15/+22
When changing the active configuration we must first release all interfaces, this is done by the usbredirhost_release() helper function, but before this patch that function also re-attached the in kernel driver, making the interfaces busy again and causing the set_config call to fail. This patch fixes this by not doing the kernel driver re-attach when releasing the interfaces for a set_config call. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-12Prepare for a 0.3.3 releaseusbredir-0.3.3Hans de Goede1-2/+2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-12usbredirparser: verify interface_info interface_countHans de Goede1-0/+9
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-12usbredirfilter: Adjust usbredirfilter_check prototypeHans de Goede3-11/+14
This change allows the data from an usb_redir_interface_info_header struct to be directly passed to usbredirfilter_check(). Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-11usbredirparser: Add usbredirfilter codeHans de Goede7-4/+439
Add usbredirfilter code, to help apps exclude certain devices from redirection. See the new usbredirfilter.h for details. This commit also bumps the reported version to 0.3.3, so that apps using libusbredirparser can check for this version to check the presence of the new usbredirfilter functions. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-03Prepare for 0.3.2 releaseusbredir-0.3.2Hans de Goede4-7/+2
-Distribute the protocol doc and README.multi-thread -Don't distribute the .pc files, they are generated by configure -Update the TODO file Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-26usbredirhost: Implement usb_redir_cap_connect_device_versionHans de Goede2-27/+42
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-24usbredirparser: Add a hello_func callbackHans de Goede3-1/+17
This will get called after receiving the hello packet from the other side. This can be used to determine when the caps from the other side have been received and it thus is safe to call usbredirparser_send_device_connect. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-24usbredirparser: Add usbredirparser_caps_set_cap helperHans de Goede2-0/+10
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-24Extend the device_connect packet header with a device_version fieldHans de Goede6-5/+107
This new field is only send / received if both sides have the (new) usb_redir_cap_connect_device_version capability. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-24Update ChangeLogHans de Goede1-0/+4
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-21usbredirhost: Change under/overflow messages to debug messagesHans de Goede1-2/+2
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-21usbredirhost: Try to keep our buffer size near the target sizeHans de Goede1-0/+28
If our buffer gets completely drained, wait for it to refill before submitting more packets. If our buffers overflows, drop not just the package causing the overflow, but drop half the buffer size packets, so that it should be at its target size of being half-filled again. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-21usbredirhost: properly handle clear stalls send from the usbguestHans de Goede1-0/+14
If a control packet is a clear stall, we need to do an actual clear stall, rather then just forward the control packet, so that the usbhost usbstack knows the stall is cleared. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-19Define exec_prefix in .pc filesChristophe Fergeau2-0/+2
@libdir@ is expanded to ${exec_prefix}/lib on my machine so we need exec_prefix to be defined in the .pc file. Thanks to Marc-André Lureau for reporting this.
2011-12-19Fix usbredirhost_cancel_iso_stream never releasing the lockHans de Goede1-1/+5
Oops. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-19Allow specifying locking functions for multi-threading on open / createHans de Goede6-108/+73
Having separate set_locking_funcs functions causes the locking functions to be available potentially too late. And it just is not very pretty. This commit changes the API (in a way which is backward compat with 0.3.1), so that locking functions can be specified at creation time, just like all the other callbacks. This commit also bumps the reported version to 0.3.2, so that apps using libusbredirhost can check for this version to check the presence of the new usbredirhost_open_full function. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-17usbredirhost: Add debug printf for control packet completionHans de Goede1-0/+3
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-12-02README.multi-thread: document the usages of the write flush callbackHans de Goede1-0/+9
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-11-29usbredirhost: Better locking for isochronous packet handlingHans de Goede1-48/+38
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-11-25Fixup ChangeLogHans de Goede1-3/+10
0.3.1 was released a while ago, and some post release changes were added to the ChangeLog entries for 0.3.1, oops. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-11-25Switch to autotools build systemChristophe Fergeau19-179/+117
Replace the current build system with an autotools based one. HdG, 3 small changes: 1) LIBUSBREDIRPARSER_SO_VERSION 1:0:0 should be 0:0:0, so that the soname does not change by going from Makefiles to autofoo 2) Drop LIBGPOD_SO_VERSION from configure.ac 3) Make libusb pkgconfig check require version >= 1.0.9 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-09-30usbredirhost: Fix copy paste error in usbredirhost_cancel_iso_streamHans de Goede1-1/+1
usbredirhost_cancel_iso_stream should call usbredirhost_cancel_iso_stream_unlocked instead of calling itself. This fixes usbredirhost_cancel_iso_stream going into an endless recursion loop. Thanks to coolper chen <lixin.chen@saicocch.com> for reporting this! Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2011-09-30Small usb-redirection-protocol.txt correctionHans de Goede1-1/+2
2011-08-24Update TODOHans de Goede1-0/+1