Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
82b3d954
Commit
82b3d954
authored
May 16, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change to the USB core to retry failed devices on startup.
Based on a patch from Georg Acher <georg@acher.org>
parent
919c1984
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
10 deletions
+26
-10
drivers/usb/core/usb.c
drivers/usb/core/usb.c
+26
-10
No files found.
drivers/usb/core/usb.c
View file @
82b3d954
...
...
@@ -2583,9 +2583,13 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size)
* Only hub drivers (including virtual root hub drivers for host
* controllers) should ever call this.
*/
#define NEW_DEVICE_RETRYS 2
#define SET_ADDRESS_RETRYS 2
int
usb_new_device
(
struct
usb_device
*
dev
)
{
int
err
;
int
i
;
int
j
;
/* USB v1.1 5.5.3 */
/* We read the first 8 bytes from the device descriptor to get to */
...
...
@@ -2594,18 +2598,30 @@ int usb_new_device(struct usb_device *dev)
dev
->
epmaxpacketin
[
0
]
=
8
;
dev
->
epmaxpacketout
[
0
]
=
8
;
err
=
usb_set_address
(
dev
);
if
(
err
<
0
)
{
err
(
"USB device not accepting new address=%d (error=%d)"
,
dev
->
devnum
,
err
);
clear_bit
(
dev
->
devnum
,
dev
->
bus
->
devmap
.
devicemap
);
dev
->
devnum
=
-
1
;
return
1
;
}
for
(
i
=
0
;
i
<
NEW_DEVICE_RETRYS
;
++
i
)
{
wait_ms
(
10
);
/* Let the SET_ADDRESS settle */
for
(
j
=
0
;
j
<
SET_ADDRESS_RETRYS
;
++
j
)
{
err
=
usb_set_address
(
dev
);
if
(
err
>=
0
)
break
;
wait_ms
(
200
);
}
if
(
err
<
0
)
{
err
(
"USB device not accepting new address=%d (error=%d)"
,
dev
->
devnum
,
err
);
clear_bit
(
dev
->
devnum
,
dev
->
bus
->
devmap
.
devicemap
);
dev
->
devnum
=
-
1
;
return
1
;
}
wait_ms
(
10
);
/* Let the SET_ADDRESS settle */
err
=
usb_get_descriptor
(
dev
,
USB_DT_DEVICE
,
0
,
&
dev
->
descriptor
,
8
);
if
(
err
>=
8
)
break
;
wait_ms
(
100
);
}
err
=
usb_get_descriptor
(
dev
,
USB_DT_DEVICE
,
0
,
&
dev
->
descriptor
,
8
);
if
(
err
<
8
)
{
if
(
err
<
0
)
err
(
"USB device not responding, giving up (error=%d)"
,
err
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment