usb_request.c (343135) | usb_request.c (365965) |
---|---|
1/* $FreeBSD: stable/11/sys/dev/usb/usb_request.c 343135 2019-01-18 08:48:30Z hselasky $ */ | 1/* $FreeBSD: stable/11/sys/dev/usb/usb_request.c 365965 2020-09-21 18:28:23Z hselasky $ */ |
2/*- 3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. 4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved. 5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 704 unchanged lines hidden (view full) --- 714 715 switch (err) { 716 case USB_ERR_NORMAL_COMPLETION: 717 case USB_ERR_SHORT_XFER: 718 case USB_ERR_STALLED: 719 case USB_ERR_CANCELLED: 720 break; 721 default: | 2/*- 3 * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. 4 * Copyright (c) 1998 Lennart Augustsson. All rights reserved. 5 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 704 unchanged lines hidden (view full) --- 714 715 switch (err) { 716 case USB_ERR_NORMAL_COMPLETION: 717 case USB_ERR_SHORT_XFER: 718 case USB_ERR_STALLED: 719 case USB_ERR_CANCELLED: 720 break; 721 default: |
722 DPRINTF("I/O error - waiting a bit for TT cleanup\n"); | 722 DPRINTF("error=%s - waiting a bit for TT cleanup\n", 723 usbd_errstr(err)); |
723 usb_pause_mtx(mtx, hz / 16); 724 break; 725 } 726 return ((usb_error_t)err); 727} 728 729/*------------------------------------------------------------------------* 730 * usbd_do_request_proc - factored out code --- 272 unchanged lines hidden (view full) --- 1003 1004 if ((min_len < 2) || (max_len < 2)) { 1005 err = USB_ERR_INVAL; 1006 goto done; 1007 } 1008 USETW(req.wLength, min_len); 1009 1010 err = usbd_do_request_flags(udev, mtx, &req, | 724 usb_pause_mtx(mtx, hz / 16); 725 break; 726 } 727 return ((usb_error_t)err); 728} 729 730/*------------------------------------------------------------------------* 731 * usbd_do_request_proc - factored out code --- 272 unchanged lines hidden (view full) --- 1004 1005 if ((min_len < 2) || (max_len < 2)) { 1006 err = USB_ERR_INVAL; 1007 goto done; 1008 } 1009 USETW(req.wLength, min_len); 1010 1011 err = usbd_do_request_flags(udev, mtx, &req, |
1011 desc, 0, NULL, 500 /* ms */); | 1012 desc, 0, NULL, 1000 /* ms */); |
1012 1013 if (err != 0 && err != USB_ERR_TIMEOUT && 1014 min_len != max_len) { 1015 /* clear descriptor data */ 1016 memset(desc, 0, max_len); 1017 1018 /* try to read full descriptor length */ 1019 USETW(req.wLength, max_len); 1020 1021 err = usbd_do_request_flags(udev, mtx, &req, | 1013 1014 if (err != 0 && err != USB_ERR_TIMEOUT && 1015 min_len != max_len) { 1016 /* clear descriptor data */ 1017 memset(desc, 0, max_len); 1018 1019 /* try to read full descriptor length */ 1020 USETW(req.wLength, max_len); 1021 1022 err = usbd_do_request_flags(udev, mtx, &req, |
1022 desc, USB_SHORT_XFER_OK, NULL, 500 /* ms */); | 1023 desc, USB_SHORT_XFER_OK, NULL, 1000 /* ms */); |
1023 1024 if (err == 0) { 1025 /* verify length */ 1026 if (buf[0] > max_len) 1027 buf[0] = max_len; 1028 else if (buf[0] < 2) 1029 err = USB_ERR_INVAL; 1030 --- 1278 unchanged lines hidden --- | 1024 1025 if (err == 0) { 1026 /* verify length */ 1027 if (buf[0] > max_len) 1028 buf[0] = max_len; 1029 else if (buf[0] < 2) 1030 err = USB_ERR_INVAL; 1031 --- 1278 unchanged lines hidden --- |