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
5bc8c9e0
Commit
5bc8c9e0
authored
Aug 10, 2012
by
Jens Andersen
Browse files
fel - fix sending files > 64KB
* Split into 64KB bulk requests * Smaller requests are sent as-is
parent
66acd46f
Changes
1
Show whitespace changes
Inline
Side-by-side
fel.c
View file @
5bc8c9e0
...
@@ -47,12 +47,14 @@ static const int AW_USB_WRITE = 0x12;
...
@@ -47,12 +47,14 @@ 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
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
)
{
rc
=
libusb_bulk_transfer
(
usb
,
ep
,
(
void
*
)
data
,
length
,
&
sent
,
1000
);
int
len
=
length
<
AW_USB_MAX_BULK_SEND
?
length
:
AW_USB_MAX_BULK_SEND
;
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"
);
...
...
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