projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed PrinterHost demo Printer_GetDeviceID() routine not removing the Device ID strin...
[pub/USBasp.git]
/
Demos
/
Host
/
Incomplete
/
PrinterHost
/
Lib
/
PrinterCommands.c
diff --git
a/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
b/Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
index
87651e9
..
4e2a0d9
100644
(file)
--- a/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
+++ b/
Demos/Host/Incomplete/PrinterHost/Lib/PrinterCommands.c
@@
-63,7
+63,7
@@
uint8_t Printer_SendData(Printer_Data_t* PrinterCommands)
*
\r
* \return A value from the USB_Host_SendControlErrorCodes_t enum
\r
*/
\r
*
\r
* \return A value from the USB_Host_SendControlErrorCodes_t enum
\r
*/
\r
-uint8_t Printer_GetDeviceID(char* DeviceIDString, uint
8
_t BufferSize)
\r
+uint8_t Printer_GetDeviceID(char* DeviceIDString, uint
16
_t BufferSize)
\r
{
\r
uint8_t ErrorCode = HOST_SENDCONTROL_Successful;
\r
uint16_t DeviceIDStringLength;
\r
{
\r
uint8_t ErrorCode = HOST_SENDCONTROL_Successful;
\r
uint16_t DeviceIDStringLength;
\r
@@
-85,12
+85,15
@@
uint8_t Printer_GetDeviceID(char* DeviceIDString, uint8_t BufferSize)
if (DeviceIDStringLength > BufferSize)
\r
DeviceIDStringLength = BufferSize;
\r
\r
if (DeviceIDStringLength > BufferSize)
\r
DeviceIDStringLength = BufferSize;
\r
\r
- USB_ControlRequest.wLength =
(DeviceIDStringLength - 1)
;
\r
+ USB_ControlRequest.wLength =
DeviceIDStringLength
;
\r
\r
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
\r
return ErrorCode;
\r
\r
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
\r
return ErrorCode;
\r
-
\r
- DeviceIDString[DeviceIDStringLength] = 0x00;
\r
+
\r
+ /* Move string back two characters to remove the string length value from the start of the array */
\r
+ memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2);
\r
+
\r
+ DeviceIDString[DeviceIDStringLength - 2] = 0x00;
\r
\r
return HOST_SENDCONTROL_Successful;
\r
}
\r
\r
return HOST_SENDCONTROL_Successful;
\r
}
\r