void EVENT_USB_Device_UnhandledControlRequest(void)
{
/* Determine which interface's Line Coding data is being set from the wIndex parameter */
- uint8_t* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? (uint8_t*)&LineEncoding1 : (uint8_t*)&LineEncoding2;
+ void* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? &LineEncoding1 : &LineEncoding2;
/* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest)
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_GetDeviceID,
.wValue = 0,
- .wIndex = 0,
+ .wIndex = PrinterInterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),
};
{
USB_ControlRequest = (USB_Request_Header_t)
{
- bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
- bRequest: REQ_GetPortStatus,
- wValue: 0,
- wIndex: 0,
- wLength: sizeof(uint8_t),
+ .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
+ .bRequest = REQ_GetPortStatus,
+ .wValue = 0,
+ .wIndex = PrinterInterfaceNumber,
+ .wLength = sizeof(uint8_t),
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
.bRequest = REQ_SoftReset,
.wValue = 0,
- .wIndex = 0,
+ .wIndex = PrinterInterfaceNumber,
.wLength = 0,
};
#include <string.h>
#include <LUFA/Drivers/USB/USB.h>
+
+ #include "../PrinterHost.h"
/* Macros: */
/** Printer class-specific request to retrieve the printer's ID string. */
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
+ /* External Variables: */
+ extern uint8_t PrinterInterfaceNumber;
+
/* Function Prototypes: */
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
- .bRequest = REQ_SoftReset,
- .wValue = 0,
- .wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
- .wLength = 0,
+ .bRequest = REQ_SoftReset,
+ .wValue = 0,
+ .wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
+ .wLength = 0,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
* in the USB controller if the endpoints or pipes were allocated in anything other than ascending order (thanks to Martin Degelsegger)
* - Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control
* request handler
+ * - Fixed LowLevel PrinterHost demo not sending control requests to the attached printer with the correct printer interface wIndex value
*
* \section Sec_ChangeLog100807 Version 100807
* <b>New:</b>