diff options
author | Jimmy Zhang <jimmzhang@nvidia.com> | 2016-03-14 19:42:47 -0700 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2016-03-15 11:16:07 -0600 |
commit | cb6a710e0452d45376b3460e454a271bbd212fdf (patch) | |
tree | 1548af9c91284e29bdcbd71e98d94fffbb9d021f /src/usb.c | |
parent | 918e0fd8fce2b4450686e2bd0effceb73b33f2ae (diff) | |
download | tegrarcm-cb6a710e0452d45376b3460e454a271bbd212fdf.tar.gz |
Add option --usb-timeout=<value>
RCM communication sometimes fails if the USB timeout is short. The default
timeout is 1000ms. Increasing the timeout value may avoid this issue. The
exact cause is not yet diagnosed. This patch implements a --usb-timeout
option to allow the value to be configured. A value of 0 means unlimited
timeout.
Example:
$ sudo tegrarcm --bct=jetson-tk1-bct.bct --bootloader=u-boot.bin \
--loadaddr=0x83d88000 --pkc=rsa_priv.der --usb-timeout=5000
Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com>
(swarren, commit description fixes)
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'src/usb.c')
-rw-r--r-- | src/usb.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, NVIDIA CORPORATION + * Copyright (c) 2011-2016, NVIDIA CORPORATION * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,6 +39,7 @@ #define USB_XFER_MAX 4096 +uint32_t usb_timeout = USB_TIMEOUT; // // returns 1 if the specified usb device matches the vendor id // @@ -307,7 +308,7 @@ int usb_write(usb_device_t *usb, uint8_t *buf, int len) while (len) { chunk_size = MIN(len, USB_XFER_MAX); ret = libusb_bulk_transfer(usb->handle, usb->endpt_out, buf, - chunk_size, &actual_chunk, USB_TIMEOUT); + chunk_size, &actual_chunk, usb_timeout); if (ret != LIBUSB_SUCCESS) { dprintf("libusb write failure: %d: %s\n", ret, libusb_error_name(ret)); return EIO; @@ -334,7 +335,7 @@ int usb_read(usb_device_t *usb, uint8_t *buf, int len, int *actual_len) while (len) { chunk_size = MIN(len, USB_XFER_MAX); ret = libusb_bulk_transfer(usb->handle, usb->endpt_in, buf, - chunk_size, &actual_chunk, USB_TIMEOUT); + chunk_size, &actual_chunk, usb_timeout); if (ret != LIBUSB_SUCCESS) { dprintf("libusb read failure: %d: %s\n", ret, libusb_error_name(ret)); return EIO; |