All Class Driver Host mode demos now correctly set the board LEDs to READY once the...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 25 Mar 2010 06:34:38 +0000 (06:34 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 25 Mar 2010 06:34:38 +0000 (06:34 +0000)
Fixed Still Image Host class driver not resetting the transaction ID when a new session is opened, fixed driver not sending a valid session ID to the device.

21 files changed:
Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
Demos/Host/ClassDriver/MouseHost/MouseHost.c
Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c
Demos/Host/LowLevel/StillImageHost/StillImageHost.c
LUFA/Drivers/USB/Class/Common/MIDI.h
LUFA/Drivers/USB/Class/Common/StillImage.h
LUFA/Drivers/USB/Class/Host/StillImage.c
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/LUFAPoweredProjects.txt
Projects/RelayBoard/Descriptors.c
Projects/RelayBoard/Descriptors.h
Projects/RelayBoard/RelayBoard.c
Projects/RelayBoard/RelayBoard.h

index 2470108..0e7e579 100644 (file)
@@ -115,9 +115,8 @@ int main(void)
                                        break;\r
                                }\r
                                \r
-                               LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
-                               \r
                                printf("Joystick Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 88ba426..15b9319 100644 (file)
@@ -111,6 +111,7 @@ int main(void)
                                }\r
                                \r
                                printf("Keyboard Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 78ec56a..14b6501 100644 (file)
@@ -115,9 +115,8 @@ int main(void)
                                        break;\r
                                }\r
                                \r
-                               LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
-\r
                                printf("Keyboard Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index f467d16..064c22d 100644 (file)
@@ -101,6 +101,7 @@ int main(void)
                                }\r
                                \r
                                printf("MIDI Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 4aa0c53..6740d9c 100644 (file)
@@ -101,6 +101,7 @@ int main(void)
                                }\r
                                \r
                                printf("Mass Storage Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 7d241af..4501a25 100644 (file)
@@ -111,6 +111,7 @@ int main(void)
                                }\r
                                \r
                                printf("Mouse Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index d0aca1e..c735b5c 100644 (file)
@@ -115,9 +115,8 @@ int main(void)
                                        break;\r
                                }\r
                                \r
-                               LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
-                               \r
                                printf("Mouse Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 3463855..2df6572 100644 (file)
@@ -108,6 +108,7 @@ int main(void)
                                }\r
                                \r
                                printf("Printer Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 5b2bfe1..e31f9a3 100644 (file)
@@ -143,6 +143,7 @@ int main(void)
                                printf("Device Vendor ID: 0x%08lX\r\n", VendorID);\r
 \r
                                printf("RNDIS Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index 22f7409..ff33c45 100644 (file)
@@ -88,7 +88,7 @@ int main(void)
                                if (SImage_Host_ConfigurePipes(&DigitalCamera_SI_Interface,\r
                                                               ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError)\r
                                {\r
-                                       printf("Attached Device Not a Valid CDC Class Device.\r\n");\r
+                                       printf("Attached Device Not a Valid Still Image Class Device.\r\n");\r
                                        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
                                        USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
                                        break;\r
@@ -103,6 +103,7 @@ int main(void)
                                }\r
                                \r
                                printf("Still Image Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index ba56ae3..d5ec041 100644 (file)
@@ -103,6 +103,7 @@ int main(void)
                                }\r
                                \r
                                printf("CDC Device Enumerated.\r\n");\r
+                               LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
                                USB_HostState = HOST_STATE_Configured;\r
                                break;\r
                        case HOST_STATE_Configured:\r
index f89de22..c923ca3 100644 (file)
@@ -167,7 +167,6 @@ void StillImage_Task(void)
                        }\r
                                \r
                        puts_P(PSTR("Still Image Device Enumerated.\r\n"));\r
-\r
                        USB_HostState = HOST_STATE_Configured;\r
                        break;\r
                case HOST_STATE_Configured:\r
index 8eed101..755006a 100644 (file)
@@ -87,7 +87,7 @@
                 *\r
                 *  \param[in] channel  MIDI channel number to address\r
                 */\r
-               #define MIDI_CHANNEL(channel)        (channel - 1)\r
+               #define MIDI_CHANNEL(channel)        ((channel) - 1)\r
                \r
        /* Type Defines: */\r
                /** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host\r
index 7b3df20..e65b2db 100644 (file)
                 *\r
                 *  \return Number of bytes of the given unicode string\r
                 */\r
-               #define UNICODE_STRING_LENGTH(chars)   (chars << 1)\r
+               #define UNICODE_STRING_LENGTH(chars)   ((chars) << 1)\r
                \r
                /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
                 *  a command container.\r
                 *\r
                 *  \param[in] params  Number of parameters which are to be sent in the Param field of the container\r
                 */\r
-               #define PIMA_COMMAND_SIZE(params)      ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \\r
-                                                       (params * sizeof(uint32_t)))\r
+               #define PIMA_COMMAND_SIZE(params)      ((sizeof(SI_PIMA_Container_t) - 12) + \\r
+                                                       ((params) * sizeof(uint32_t)))\r
 \r
                /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for\r
                 *  a data container.\r
                 *\r
                 *  \param[in] datalen  Length in bytes of the data in the container\r
                 */\r
-               #define PIMA_DATA_SIZE(datalen)        ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \\r
-                                                       datalen)\r
+               #define PIMA_DATA_SIZE(datalen)        ((sizeof(SI_PIMA_Container_t) - 12) + \\r
+                                                       (datalen))\r
 \r
        /* Enums: */\r
                /** Enum for the possible PIMA contains types. */\r
                        uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */\r
                        uint16_t Code; /**< Command, event or response code of the container */\r
                        uint32_t TransactionID; /**< Unique container ID to link blocks together */\r
-                       uint32_t Params[5]; /**< Block parameters to be issued along with the block code (command blocks only) */\r
+                       uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */\r
                } SI_PIMA_Container_t;\r
                \r
        /* Disable C linkage for C++ Compilers: */\r
index 577f619..d116ceb 100644 (file)
@@ -315,12 +315,15 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
 \r
        uint8_t ErrorCode;\r
 \r
+       SIInterfaceInfo->State.TransactionID = 0;\r
+       SIInterfaceInfo->State.IsSessionOpen = false;\r
+\r
        SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)\r
                                                        {\r
-                                                               .DataLength    = PIMA_COMMAND_SIZE(0),\r
+                                                               .DataLength    = PIMA_COMMAND_SIZE(1),\r
                                                                .Type          = CType_CommandBlock,\r
                                                                .Code          = 0x1002,\r
-                                                               .Params        = {},\r
+                                                               .Params        = {1},\r
                                                        };\r
                                                        \r
        if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)\r
@@ -332,7 +335,6 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
        if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001))\r
          return SI_ERROR_LOGICAL_CMD_FAILED;\r
          \r
-       SIInterfaceInfo->State.TransactionID = 0;\r
        SIInterfaceInfo->State.IsSessionOpen = true;\r
 \r
        return PIPE_RWSTREAM_NoError;\r
@@ -347,10 +349,10 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
 \r
        SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t)\r
                                                        {\r
-                                                               .DataLength    = PIMA_COMMAND_SIZE(0),\r
+                                                               .DataLength    = PIMA_COMMAND_SIZE(1),\r
                                                                .Type          = CType_CommandBlock,\r
                                                                .Code          = 0x1003,\r
-                                                               .Params        = {},\r
+                                                               .Params        = {1},\r
                                                        };\r
                                                        \r
        if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)\r
index 3be0bdc..1a0fd0d 100644 (file)
@@ -23,6 +23,7 @@
   *  - Double bank CDC endpoints in the XPLAIN Bridge project, re-enable JTAG once the mode selection pin has been sampled.\r
   *  - Standardized the naming scheme given to configuration descriptor sub-elements in the Device mode demos, bootloaders\r
   *    and projects\r
+  *  - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed\r
   *\r
   *  <b>Fixed:</b>\r
   *  - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin\r
@@ -34,6 +35,8 @@
   *  - Fixed LowLevel MassStorage demo broken on the U2 AVRs due to double-banked endpoints\r
   *  - Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL is defined (thanks to C. Scott Ananian)\r
   *  - Fixed incorrect definition of HID_ALIGN_DATA() causing incorrect HID report item data alignment\r
+  *  - Fixed Still Image Host class driver not resetting the transaction ID when a new session is opened, fixed driver not sending\r
+  *    a valid session ID to the device\r
   *\r
   *  \section Sec_ChangeLog100219 Version 100219\r
   *\r
index 2d6feac..0c8eca3 100644 (file)
@@ -21,6 +21,7 @@
  *  - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/\r
  *  - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito\r
  *  - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b\r
+ *  - JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html\r
  *  - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/\r
  *  - Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569\r
  *  - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html\r
index 1beb811..d4857a5 100644 (file)
@@ -7,6 +7,7 @@
 */\r
 \r
 /*\r
+  Copyright 2010  OBinou (obconseil [at] gmail [dot] com)\r
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this\r
@@ -18,7 +19,6 @@
   advertising or publicity pertaining to distribution of the\r
   software without specific, written prior permission.\r
 \r
-\r
   The author disclaim all warranties with regard to this\r
   software, including all implied warranties of merchantability\r
   and fitness.  In no event shall the author be liable for any\r
index 65644a8..6cd6fee 100644 (file)
@@ -7,6 +7,7 @@
 */\r
 \r
 /*\r
+  Copyright 2010  OBinou (obconseil [at] gmail [dot] com)\r
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this\r
index 0923a23..c303417 100644 (file)
@@ -7,6 +7,7 @@
 */\r
 \r
 /*\r
+  Copyright 2010  OBinou (obconseil [at] gmail [dot] com)\r
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this\r
index 686c9c0..2ffa590 100644 (file)
@@ -7,6 +7,7 @@
 */\r
 \r
 /*\r
+  Copyright 2010  OBinou (obconseil [at] gmail [dot] com)\r
   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
 \r
   Permission to use, copy, modify, distribute, and sell this\r