summaryrefslogtreecommitdiffstats
path: root/drivers/dfu
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-12-11 18:40:49 -0500
committerTom Rini <trini@ti.com>2014-12-11 18:40:49 -0500
commitfc9b0b80435cda721fbdbe507c9e4f388b0ea62b (patch)
treee50527455a67f1fc9f793f42d9672b237ac806f7 /drivers/dfu
parent2c49323d5de38e119f102fa3f5fb291c4bc4e8a0 (diff)
parent0c6de8853b2571251fdefe34598e0c344fe1372b (diff)
downloadblackbird-obmc-uboot-fc9b0b80435cda721fbdbe507c9e4f388b0ea62b.tar.gz
blackbird-obmc-uboot-fc9b0b80435cda721fbdbe507c9e4f388b0ea62b.zip
Merge branch 'master' of git://git.denx.de/u-boot-usb
Conflicts: board/freescale/mx6sxsabresd/mx6sxsabresd.c Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/dfu.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index c0aba6e197..14cb366b01 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -544,10 +544,35 @@ struct dfu_entity *dfu_get_entity(int alt)
int dfu_get_alt(char *name)
{
struct dfu_entity *dfu;
+ char *str;
list_for_each_entry(dfu, &dfu_list, list) {
- if (!strncmp(dfu->name, name, strlen(dfu->name)))
- return dfu->alt;
+ if (dfu->name[0] != '/') {
+ if (!strncmp(dfu->name, name, strlen(dfu->name)))
+ return dfu->alt;
+ } else {
+ /*
+ * One must also consider absolute path
+ * (/boot/bin/uImage) available at dfu->name when
+ * compared "plain" file name (uImage)
+ *
+ * It is the case for e.g. thor gadget where lthor SW
+ * sends only the file name, so only the very last part
+ * of path must be checked for equality
+ */
+
+ str = strstr(dfu->name, name);
+ if (!str)
+ continue;
+
+ /*
+ * Check if matching substring is the last element of
+ * dfu->name (uImage)
+ */
+ if (strlen(dfu->name) ==
+ ((str - dfu->name) + strlen(name)))
+ return dfu->alt;
+ }
}
return -ENODEV;
OpenPOWER on IntegriCloud