am ab6e55f7: Merge "Enlarge USB bulk transfer size for faster downloads"
* commit 'ab6e55f72b975b4fc61c436d4540ba7416166262': Enlarge USB bulk transfer size for faster downloads
This commit is contained in:
commit
c4eaebbe7a
2 changed files with 10 additions and 4 deletions
|
|
@ -61,6 +61,11 @@
|
||||||
#define DBG1(x...)
|
#define DBG1(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The max bulk size for linux is 16384 which is defined
|
||||||
|
* in drivers/usb/core/devio.c.
|
||||||
|
*/
|
||||||
|
#define MAX_USBFS_BULK_SIZE (16 * 1024)
|
||||||
|
|
||||||
struct usb_handle
|
struct usb_handle
|
||||||
{
|
{
|
||||||
char fname[64];
|
char fname[64];
|
||||||
|
|
@ -289,7 +294,7 @@ int usb_write(usb_handle *h, const void *_data, int len)
|
||||||
|
|
||||||
while(len > 0) {
|
while(len > 0) {
|
||||||
int xfer;
|
int xfer;
|
||||||
xfer = (len > 4096) ? 4096 : len;
|
xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len;
|
||||||
|
|
||||||
bulk.ep = h->ep_out;
|
bulk.ep = h->ep_out;
|
||||||
bulk.len = xfer;
|
bulk.len = xfer;
|
||||||
|
|
@ -323,7 +328,7 @@ int usb_read(usb_handle *h, void *_data, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
while(len > 0) {
|
while(len > 0) {
|
||||||
int xfer = (len > 4096) ? 4096 : len;
|
int xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len;
|
||||||
|
|
||||||
bulk.ep = h->ep_in;
|
bulk.ep = h->ep_in;
|
||||||
bulk.len = xfer;
|
bulk.len = xfer;
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
#define DBG(x...)
|
#define DBG(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_USBFS_BULK_SIZE (1024 * 1024)
|
||||||
|
|
||||||
/** Structure usb_handle describes our connection to the usb device via
|
/** Structure usb_handle describes our connection to the usb device via
|
||||||
AdbWinApi.dll. This structure is returned from usb_open() routine and
|
AdbWinApi.dll. This structure is returned from usb_open() routine and
|
||||||
|
|
@ -160,7 +161,7 @@ int usb_write(usb_handle* handle, const void* data, int len) {
|
||||||
if (NULL != handle) {
|
if (NULL != handle) {
|
||||||
// Perform write
|
// Perform write
|
||||||
while(len > 0) {
|
while(len > 0) {
|
||||||
int xfer = (len > 4096) ? 4096 : len;
|
int xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len;
|
||||||
ret = AdbWriteEndpointSync(handle->adb_write_pipe,
|
ret = AdbWriteEndpointSync(handle->adb_write_pipe,
|
||||||
(void*)data,
|
(void*)data,
|
||||||
(unsigned long)xfer,
|
(unsigned long)xfer,
|
||||||
|
|
@ -200,7 +201,7 @@ int usb_read(usb_handle *handle, void* data, int len) {
|
||||||
DBG("usb_read %d\n", len);
|
DBG("usb_read %d\n", len);
|
||||||
if (NULL != handle) {
|
if (NULL != handle) {
|
||||||
while (1) {
|
while (1) {
|
||||||
int xfer = (len > 4096) ? 4096 : len;
|
int xfer = (len > MAX_USBFS_BULK_SIZE) ? MAX_USBFS_BULK_SIZE : len;
|
||||||
|
|
||||||
ret = AdbReadEndpointSync(handle->adb_read_pipe,
|
ret = AdbReadEndpointSync(handle->adb_read_pipe,
|
||||||
(void*)data,
|
(void*)data,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue