dfu: Fix listing devices using the ST reference bootloader

This commit is contained in:
Richard Hughes 2016-10-12 14:02:53 +01:00
parent 877df1dda3
commit c6a8deeb4c
3 changed files with 5 additions and 6 deletions

View File

@ -677,7 +677,7 @@ dfu_target_dfuse_func (void)
g_free (tmp);
/* multiple sectors */
ret = dfu_target_parse_sectors (target, "@Flash1 /0x08000000/2*001 Ka,4*001 Kg", &error);
ret = dfu_target_parse_sectors (target, "@Flash1 /0x08000000/2*001Ka,4*001Kg", &error);
g_assert_no_error (error);
g_assert (ret);
tmp = dfu_target_sectors_to_string (target);

View File

@ -213,13 +213,10 @@ dfu_target_parse_sector (DfuTarget *target,
return FALSE;
}
/* optional spaces */
while (tmp[0] == ' ')
tmp++;
/* get multiplier */
switch (tmp[0]) {
case 'B': /* byte */
case ' ': /* byte, ST reference bootloader :/ */
break;
case 'K': /* Kilo */
sector_size *= 0x400;

View File

@ -1817,7 +1817,9 @@ dfu_tool_list_target (DfuTarget *target)
if (tmp != NULL) {
/* TRANSLATORS: interface name, e.g. "Flash" */
dfu_tool_print_indent (_("Name"), tmp, 2);
} else {
} else if (!g_error_matches (error_local,
DFU_ERROR,
DFU_ERROR_NOT_FOUND)) {
g_autofree gchar *str = NULL;
str = g_strdup_printf ("Error: %s", error_local->message);
dfu_tool_print_indent (_("Name"), str, 2);