Oops - SCSI INQUIRY data uses fixed-length, non-terminated strings -- need to copy...
[pub/USBasp.git] / Demos / Host / LowLevel / MassStorageHost / MassStorageHost.c
index 79a5592..a1febf2 100644 (file)
@@ -224,8 +224,17 @@ void MassStorage_Task(void)
                                break;\r
                        }\r
                        \r
+                       /* VendorID and ProductID are fixed-length non-null terminated strings - need to terminate them before displaying */\r
+                       char VendorID[9];\r
+                       char ProductID[17];\r
+                       \r
+                       memcpy(&VendorID, &InquiryData.VendorID, 8);\r
+                       memcpy(&ProductID, &InquiryData.ProductID, 16);\r
+                       VendorID[8]   = 0x00;\r
+                       ProductID[16] = 0x00;\r
+\r
                        /* Print vendor and product names of attached device */\r
-                       printf_P(PSTR("Vendor: %s, Product: %s\r\n"), InquiryData.VendorID, InquiryData.ProductID);\r
+                       printf_P(PSTR("Vendor \"%s\", Product \"%s\"\r\n"), VendorID, ProductID);\r
                                                \r
                        /* Wait until disk ready */\r
                        puts_P(PSTR("Waiting until ready.."));\r