[SUBMIT] tlv_eeprom: remove leading space when displaying TLV binary value
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Fri, 14 Nov 2025 17:51:47 +0000 (12:51 -0500)
committerHugo Villeneuve <hvilleneuve@dimonoff.com>
Mon, 17 Nov 2025 15:50:01 +0000 (10:50 -0500)
When displaying TLV binary values, as in this example:

    TLV Name             Code Len Value
    -------------------- ---- --- -----
    Product Name         0x21   6 my-product
    Vendor Extension     0xFD   6  0x66 0x6F 0x6F 0x62 0x61 0x72
    CRC-32               0xFE   4 0x3CAAF7AE

There is a leading space before the first byte.

Fix by not printing the space character for the first value.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
src/tlv_eeprom.c

index a6564e9..fdb8349 100644 (file)
@@ -339,7 +339,11 @@ static void decode_tlv_value(struct tlvinfo_tlv *tlv, char *value, int value_len
                                i++) {
                        char dec_val[DECODE_VALUE_MAX];
 
-                       sprintf(dec_val, " 0x%02X", tlv->value[i]);
+                       sprintf(dec_val, "0x%02X", tlv->value[i]);
+
+                       if (i != 0)
+                               strcat(value, " ");
+
                        strcat(value, dec_val);
                }
                break;