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.
                                        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
 
                                }\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
 
                                        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
 
                                }\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
 
                                }\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
 
                                }\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
 
                                        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
 
                                }\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
 
                                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
 
                                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
                                }\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
 
                                }\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
 
                        }\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
 
                 *\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
 
                 *\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
 
 \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
        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
 \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
 
   *  - 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
   *  - 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
 
  *  - 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
 
 */\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
   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
 
 */\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
 
 */\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
 
 */\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