aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/StillImageHost
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Host/LowLevel/StillImageHost')
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c9
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.c11
2 files changed, 6 insertions, 14 deletions
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
index e0d71a059..970df4f87 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
@@ -152,12 +152,9 @@ uint8_t SImage_RecieveBlockHeader(void)
}
/* Check to see if the device was disconnected, if so exit function */
- if (!(USB_IsConnected))
- {
- /* Return error code */
- return PIPE_RWSTREAM_DeviceDisconnected;
- }
- };
+ if (USB_HostState == HOST_STATE_Unattached)
+ return PIPE_RWSTREAM_DeviceDisconnected;
+ }
/* Freeze OUT pipe after use */
Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE);
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
index 5cfaf46be..ca0771a94 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
@@ -166,14 +166,11 @@ void StillImage_Task(void)
break;
}
+ puts_P(PSTR("Still Image Device Enumerated.\r\n"));
+
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
- puts_P(PSTR("Still Image Device Enumerated.\r\n"));
-
- USB_HostState = HOST_STATE_Ready;
- break;
- case HOST_STATE_Ready:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
@@ -331,9 +328,7 @@ void StillImage_Task(void)
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
- /* Wait until USB device disconnected */
- while (USB_IsConnected);
-
+ USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
}