Fix up the incomplete Webserver project so that it integrates with the uIP stack...
[pub/USBasp.git] / Demos / Device / Incomplete / Sideshow / Sideshow.c
index 8454f9d..6c48c34 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
        SideShow Class demonstration application. This give a reference\r
        for implementing Microsoft SideShow compatible devices in an\r
        embedded environment. SideShow allows for gadget data displayed\r
-       on a Vista machine to also be displayed on an externally connected\r
-       interactive display. Upon enumeration on a Vista system, this will\r
+       on a Windows Vista or later machine to also be displayed on an\r
+       externally connected interactive display. Upon enumeration, this will\r
        appear as a new SideShow device which can have gadgets loaded onto\r
        it.\r
        \r
-       Note that while the incomming content is buffered in packet struct\r
+       Note that while the incoming content is buffered in packet struct\r
        form, the data is not actually displayed. It is left to the user to\r
        write sufficient code to read out the packed data for display to a\r
        screen.\r
@@ -82,17 +82,17 @@ void SetupHardware(void)
        SerialStream_Init(9600, false);\r
 }\r
 \r
-void EVENT_USB_Connect(void)\r
+void EVENT_USB_Device_Connect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
 }\r
 \r
-void EVENT_USB_Disconnect(void)\r
+void EVENT_USB_Device_Disconnect(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
 }\r
 \r
-void EVENT_USB_ConfigurationChanged(void)\r
+void EVENT_USB_Device_ConfigurationChanged(void)\r
 {\r
        LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
 \r
@@ -112,7 +112,7 @@ void EVENT_USB_ConfigurationChanged(void)
        }\r
 }\r
 \r
-void EVENT_USB_UnhandledControlPacket(void)\r
+void EVENT_USB_Device_UnhandledControlRequest(void)\r
 {\r
        /* Process UFI specific control requests */\r
        switch (USB_ControlRequest.bRequest)\r
@@ -131,7 +131,7 @@ void EVENT_USB_UnhandledControlPacket(void)
                                \r
                                Endpoint_ClearSETUP();\r
                                \r
-                               Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);\r
+                               Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);\r
                                Endpoint_ClearOUT();                            \r
                        }\r
 \r
@@ -141,17 +141,17 @@ void EVENT_USB_UnhandledControlPacket(void)
        \r
 void SideShow_Task(void)\r
 {\r
-       /* Check if the USB System is connected to a Host */\r
-       if (USB_IsConnected)\r
+       /* Device must be connected and configured for the task to run */\r
+       if (USB_DeviceState != DEVICE_STATE_Configured)\r
+         return;\r
+\r
+       /* Select the SideShow data out endpoint */\r
+       Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);\r
+       \r
+       /* Check to see if a new SideShow message has been received */\r
+       if (Endpoint_IsReadWriteAllowed())\r
        {\r
-               /* Select the SideShow data out endpoint */\r
-               Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);\r
-               \r
-               /* Check to see if a new SideShow message has been received */\r
-               if (Endpoint_IsReadWriteAllowed())\r
-               {\r
-                       /* Process the received SideShow message */\r
-                       Sideshow_ProcessCommandPacket();\r
-               }\r
+               /* Process the received SideShow message */\r
+               Sideshow_ProcessCommandPacket();\r
        }\r
 }\r