X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/6198289b388e4122afe4913f899b37a8e7cd8af4..7d4cccc22d60125fac111819df48af1873d11018:/Demos/Host/GenericHIDHost/GenericHIDHost.c diff --git a/Demos/Host/GenericHIDHost/GenericHIDHost.c b/Demos/Host/GenericHIDHost/GenericHIDHost.c index 625ca7023..778b8f6f8 100644 --- a/Demos/Host/GenericHIDHost/GenericHIDHost.c +++ b/Demos/Host/GenericHIDHost/GenericHIDHost.c @@ -75,7 +75,7 @@ int main(void) /* Initialize USB Subsystem */ USB_Init(); - /* Startup message */ + /* Start-up message */ puts_P(PSTR(ESC_RESET ESC_BG_WHITE ESC_INVERSE_ON ESC_ERASE_DISPLAY "Generic HID Host Demo running.\r\n" ESC_INVERSE_OFF)); @@ -132,7 +132,7 @@ EVENT_HANDLER(USB_HostError) for(;;); } -/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occured while +/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while * enumerating an attached USB device. */ EVENT_HANDLER(USB_DeviceEnumerationFailed) @@ -288,7 +288,7 @@ TASK(USB_HID_Host) wLength: 0, }; - /* Send the request, display error and wait for device detatch if request fails */ + /* Send the request, display error and wait for device detach if request fails */ if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful) { puts_P(PSTR("Control Error (Set Configuration).\r\n")); @@ -350,6 +350,9 @@ TASK(USB_HID_Host) */ ISR(ENDPOINT_PIPE_vect, ISR_BLOCK) { + /* Save previously selected pipe before selecting a new pipe */ + uint8_t PrevSelectedPipe = Pipe_GetCurrentPipe(); + /* Check to see if the HID data IN pipe has caused the interrupt */ if (Pipe_HasPipeInterrupted(HID_DATA_IN_PIPE)) { @@ -367,5 +370,8 @@ ISR(ENDPOINT_PIPE_vect, ISR_BLOCK) ReadNextReport(); } } + + /* Restore previously selected pipe */ + Pipe_SelectPipe(PrevSelectedPipe); } #endif