diff mbox

[V1] Re-attach usb device to kernel while usb_host_open fails

Message ID 1435117141-10459-1-git-send-email-lma@suse.com
State New
Headers show

Commit Message

Lin Ma June 24, 2015, 3:39 a.m. UTC
Changes in V1:
For avoiding regression issue, Dont remove the usb device from global hostdevs list while
usb speed mismatch occurs.

Signed-off-by: Lin Ma <lma@suse.com>
---
 hw/usb/host-libusb.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Gonglei (Arei) June 24, 2015, 3:53 a.m. UTC | #1
On 2015/6/24 11:39, Lin Ma wrote:
> Changes in V1:
> For avoiding regression issue, Dont remove the usb device from global hostdevs list while
> usb speed mismatch occurs.
> 
> Signed-off-by: Lin Ma <lma@suse.com>
> ---

The changing remarks should be lay up here,
and use v2 suffix instead of v1.

If you do this, you can add my R-by.
	Reviewed-by: Gonglei <arei.gonglei@huawei.com>

Please refer to:
http://wiki.qemu.org/Contribute/SubmitAPatch

Regards,
-Gonglei

>  hw/usb/host-libusb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index bc2944c..11429f5 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -889,6 +889,9 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev)
>  fail:
>      trace_usb_host_open_failure(bus_num, addr);
>      if (s->dh != NULL) {
> +        usb_host_release_interfaces(s);
> +        libusb_reset_device(s->dh);
> +        usb_host_attach_kernel(s);
>          libusb_close(s->dh);
>          s->dh = NULL;
>          s->dev = NULL;
>
Lin Ma June 24, 2015, 5:35 a.m. UTC | #2
在 2015年06月24日 11:53, Gonglei 写道:
> On 2015/6/24 11:39, Lin Ma wrote:
>> Changes in V1:
>> For avoiding regression issue, Dont remove the usb device from global hostdevs list while
>> usb speed mismatch occurs.
>>
>> Signed-off-by: Lin Ma <lma@suse.com>
>> ---
> The changing remarks should be lay up here,
> and use v2 suffix instead of v1.
>
> If you do this, you can add my R-by.
> 	Reviewed-by: Gonglei <arei.gonglei@huawei.com>
>
> Please refer to:
> http://wiki.qemu.org/Contribute/SubmitAPatch
>
> Regards,
> -Gonglei
I must be getting tired, Sorry about that.
>>   hw/usb/host-libusb.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
>> index bc2944c..11429f5 100644
>> --- a/hw/usb/host-libusb.c
>> +++ b/hw/usb/host-libusb.c
>> @@ -889,6 +889,9 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev)
>>   fail:
>>       trace_usb_host_open_failure(bus_num, addr);
>>       if (s->dh != NULL) {
>> +        usb_host_release_interfaces(s);
>> +        libusb_reset_device(s->dh);
>> +        usb_host_attach_kernel(s);
>>           libusb_close(s->dh);
>>           s->dh = NULL;
>>           s->dev = NULL;
>>
>
>
>
diff mbox

Patch

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index bc2944c..11429f5 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -889,6 +889,9 @@  static int usb_host_open(USBHostDevice *s, libusb_device *dev)
 fail:
     trace_usb_host_open_failure(bus_num, addr);
     if (s->dh != NULL) {
+        usb_host_release_interfaces(s);
+        libusb_reset_device(s->dh);
+        usb_host_attach_kernel(s);
         libusb_close(s->dh);
         s->dh = NULL;
         s->dev = NULL;