X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/6783bc4594177833d2b1047d77316e38cfe6a629..8ba51f090f7cafb36e1108cc58e68f5d71bc13c0:/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c index 7ed8898e3..a9f41ba64 100644 --- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c +++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c @@ -77,12 +77,12 @@ uint8_t Printer_SendData(void* PrinterCommands, uint16_t CommandSize) uint8_t Printer_GetDeviceID(char* DeviceIDString, uint16_t BufferSize) { uint8_t ErrorCode = HOST_SENDCONTROL_Successful; - uint16_t DeviceIDStringLength; + uint16_t DeviceIDStringLength = 0; USB_ControlRequest = (USB_Request_Header_t) { bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - bRequest: GET_DEVICE_ID, + bRequest: REQ_GetDeviceID, wValue: 0, wIndex: 0, wLength: sizeof(DeviceIDStringLength), @@ -92,6 +92,12 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString, uint16_t BufferSize) if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful) return ErrorCode; + + if (!(DeviceIDStringLength)) + { + DeviceIDString[0] = 0x00; + return HOST_SENDCONTROL_Successful; + } DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength); @@ -123,7 +129,7 @@ uint8_t Printer_GetPortStatus(uint8_t* PortStatus) USB_ControlRequest = (USB_Request_Header_t) { bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), - bRequest: GET_PORT_STATUS, + bRequest: REQ_GetPortStatus, wValue: 0, wIndex: 0, wLength: sizeof(uint8_t), @@ -144,7 +150,7 @@ uint8_t Printer_SoftReset(void) USB_ControlRequest = (USB_Request_Header_t) { bmRequestType: (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE), - bRequest: SOFT_RESET, + bRequest: REQ_SoftReset, wValue: 0, wIndex: 0, wLength: 0,