mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Oops - SCSI INQUIRY data uses fixed-length, non-terminated strings -- need to copy the strings to a temp buffer and terminate before using them in printf.
This commit is contained in:
parent
64937a6206
commit
b2cf4d3222
@ -224,8 +224,17 @@ void MassStorage_Task(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* VendorID and ProductID are fixed-length non-null terminated strings - need to terminate them before displaying */
|
||||||
|
char VendorID[9];
|
||||||
|
char ProductID[17];
|
||||||
|
|
||||||
|
memcpy(&VendorID, &InquiryData.VendorID, 8);
|
||||||
|
memcpy(&ProductID, &InquiryData.ProductID, 16);
|
||||||
|
VendorID[8] = 0x00;
|
||||||
|
ProductID[16] = 0x00;
|
||||||
|
|
||||||
/* Print vendor and product names of attached device */
|
/* Print vendor and product names of attached device */
|
||||||
printf_P(PSTR("Vendor: %s, Product: %s\r\n"), InquiryData.VendorID, InquiryData.ProductID);
|
printf_P(PSTR("Vendor \"%s\", Product \"%s\"\r\n"), VendorID, ProductID);
|
||||||
|
|
||||||
/* Wait until disk ready */
|
/* Wait until disk ready */
|
||||||
puts_P(PSTR("Waiting until ready.."));
|
puts_P(PSTR("Waiting until ready.."));
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
#include <avr/power.h>
|
#include <avr/power.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "ConfigDescriptor.h"
|
#include "ConfigDescriptor.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user