Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
17fb268e
Commit
17fb268e
authored
Aug 15, 2012
by
Henrik Nordstrom
Browse files
fel: Increase timeout to 60 seconds instead of splitting bulk transfers
parent
114aabc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
fel.c
View file @
17fb268e
...
@@ -47,14 +47,13 @@ static const int AW_USB_WRITE = 0x12;
...
@@ -47,14 +47,13 @@ static const int AW_USB_WRITE = 0x12;
static
const
int
AW_USB_FEL_BULK_EP_OUT
=
0x01
;
static
const
int
AW_USB_FEL_BULK_EP_OUT
=
0x01
;
static
const
int
AW_USB_FEL_BULK_EP_IN
=
0x82
;
static
const
int
AW_USB_FEL_BULK_EP_IN
=
0x82
;
static
const
int
AW_USB_MAX_BULK_SEND
=
64
*
1024
;
// 64KB per bulk request
static
int
timeout
=
60000
;
void
usb_bulk_send
(
libusb_device_handle
*
usb
,
int
ep
,
const
void
*
data
,
int
length
)
void
usb_bulk_send
(
libusb_device_handle
*
usb
,
int
ep
,
const
void
*
data
,
int
length
)
{
{
int
rc
,
sent
;
int
rc
,
sent
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
int
len
=
length
<
AW_USB_MAX_BULK_SEND
?
length
:
AW_USB_MAX_BULK_SEND
;
rc
=
libusb_bulk_transfer
(
usb
,
ep
,
(
void
*
)
data
,
length
,
&
sent
,
timeout
);
rc
=
libusb_bulk_transfer
(
usb
,
ep
,
(
void
*
)
data
,
len
,
&
sent
,
1000
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
errno
=
EIO
;
errno
=
EIO
;
perror
(
"usb send"
);
perror
(
"usb send"
);
...
@@ -69,7 +68,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length)
...
@@ -69,7 +68,7 @@ void usb_bulk_recv(libusb_device_handle *usb, int ep, void *data, int length)
{
{
int
rc
,
recv
;
int
rc
,
recv
;
while
(
length
>
0
)
{
while
(
length
>
0
)
{
rc
=
libusb_bulk_transfer
(
usb
,
ep
,
data
,
length
,
&
recv
,
1000
);
rc
=
libusb_bulk_transfer
(
usb
,
ep
,
data
,
length
,
&
recv
,
timeout
);
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
errno
=
EIO
;
errno
=
EIO
;
perror
(
"usb recv"
);
perror
(
"usb recv"
);
...
...
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