summaryrefslogtreecommitdiffstats
path: root/utils/imxtools/sbtools
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-05-25 16:04:19 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-09-07 17:44:53 +0200
commit1dc1a9310e8a078a633dd90def13103f80e01ce7 (patch)
treee28ba06d68a5cedfac33ea6e893b7e42288e58ba /utils/imxtools/sbtools
parent50778c82f1311979ca3d3a6a7d0021367bb26ef4 (diff)
downloadrockbox-1dc1a9310e8a078a633dd90def13103f80e01ce7.tar.gz
rockbox-1dc1a9310e8a078a633dd90def13103f80e01ce7.tar.bz2
rockbox-1dc1a9310e8a078a633dd90def13103f80e01ce7.zip
sbtools: use default transfer size if it cannot be probed
A older commit removed this ability but it tends to be a problem since the HID driver can prevent probing of transfer size which then needs to be entered by hand on the command line. Change-Id: Ie5a556ffdcc2adec0e1c984810983e19136b6473
Diffstat (limited to 'utils/imxtools/sbtools')
-rw-r--r--utils/imxtools/sbtools/sbloader.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/utils/imxtools/sbtools/sbloader.c b/utils/imxtools/sbtools/sbloader.c
index 0a82a66a0c..99715a6232 100644
--- a/utils/imxtools/sbtools/sbloader.c
+++ b/utils/imxtools/sbtools/sbloader.c
@@ -61,9 +61,9 @@ struct dev_info_t
struct dev_info_t g_dev_info[] =
{
- {0x066f, 0x3780, 0, HID_DEVICE}, /* i.MX233 / STMP3780 */
- {0x066f, 0x3770, 0, HID_DEVICE}, /* STMP3770 */
- {0x15A2, 0x004F, 0, HID_DEVICE}, /* i.MX28 */
+ {0x066f, 0x3780, 1024, HID_DEVICE}, /* i.MX233 / STMP3780 */
+ {0x066f, 0x3770, 48, HID_DEVICE}, /* STMP3770 */
+ {0x15A2, 0x004F, 1024, HID_DEVICE}, /* i.MX28 */
{0x066f, 0x3600, 4096, RECOVERY_DEVICE}, /* STMP36xx */
};
@@ -427,8 +427,7 @@ static int probe_hid_xfer_size(libusb_device_handle *dev)
return xfer_size / 8;
Lerr:
- printf("Cannot probe transfer size, please specify it on command line.\n");
- exit(11);
+ printf("Cannot probe transfer size, using default.\n");
return 0;
}
@@ -436,8 +435,7 @@ static int probe_xfer_size(enum dev_type_t prot, libusb_device_handle *dev)
{
if(prot == HID_DEVICE)
return probe_hid_xfer_size(dev);
- printf("Cannot probe transfer size, please specify it on command line.\n");
- exit(10);
+ printf("Cannot probe transfer size, using default.\n");
return 0;
}
@@ -593,12 +591,19 @@ int main(int argc, char **argv)
dev_type = g_dev_info[db_idx].dev_type;
xfer_size = g_dev_info[db_idx].xfer_size;
}
+ /* if not forced, try to probe transfer size */
+ if(force_xfer_size == 0)
+ force_xfer_size = probe_xfer_size(dev_type, dev);
+ /* make a decision */
if(force_xfer_size > 0)
xfer_size = force_xfer_size;
+ else if(xfer_size == 0)
+ {
+ printf("Cannot probe transfer size, please specify it on the command line.\n");
+ exit(10);
+ }
if(dev_type == PROBE_DEVICE)
dev_type = probe_protocol(dev);
- if(xfer_size == 0)
- xfer_size = probe_xfer_size(dev_type, dev);
/* open file */
FILE *f = fopen(filename, "r");
if(f == NULL)