diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c index 24701087ba85f8caff45494186588118cd04d877..0e7e579824324cf6e22911b0b77e584625c4d89a 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c @@ -115,9 +115,8 @@ int main(void) break; } - LEDs_SetAllLEDs(LEDS_NO_LEDS); - printf("Joystick Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c index 88ba426f136d2b806041081479010a5e54740bc0..15b93199effad37b0dd3c548349a7e4c7e304dba 100644 --- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c +++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c @@ -111,6 +111,7 @@ int main(void) } printf("Keyboard Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c index 78ec56aa321759e94b1833bcb5331fa072d82b1d..14b65012065ed4566344165acc388bc0de3ce211 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -115,9 +115,8 @@ int main(void) break; } - LEDs_SetAllLEDs(LEDS_NO_LEDS); - printf("Keyboard Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c index f467d16bce84cb66c4170688dc969c6be73db526..064c22dd6336fcd70b711cfe54599f9f7d832f02 100644 --- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c +++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c @@ -101,6 +101,7 @@ int main(void) } printf("MIDI Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c index 4aa0c532b59fd81326d89976a40f4cdccda89422..6740d9cb7f6e2dc0c9a7813a36e169c9bdf6d0e4 100644 --- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c +++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c @@ -101,6 +101,7 @@ int main(void) } printf("Mass Storage Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c index 7d241afa39633b2780e96c4c9a486ee0ca9f352a..4501a25dc22b139a12e249ba4ef54b85ebdac9a8 100644 --- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c +++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c @@ -111,6 +111,7 @@ int main(void) } printf("Mouse Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c index d0aca1e5d5129034431bdad335fc467cc305eda6..c735b5c005149517593b4973928dd30e332412c0 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c @@ -115,9 +115,8 @@ int main(void) break; } - LEDs_SetAllLEDs(LEDS_NO_LEDS); - printf("Mouse Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c index 3463855d3eb56479b99fce14941f2fb153c84c8e..2df65729324cab94b88952af060dda636619770e 100644 --- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c +++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c @@ -108,6 +108,7 @@ int main(void) } printf("Printer Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c index 5b2bfe1339f1669f9f60e87926cd570ca6fa51f8..e31f9a3362ba5610b6aadf31f5a8b6fde3caebcc 100644 --- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c +++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c @@ -143,6 +143,7 @@ int main(void) printf("Device Vendor ID: 0x%08lX\r\n", VendorID); printf("RNDIS Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c index 22f74096f605330814b7795427bd577387298ef1..ff33c457d5629e0108a036da40357c895a67a37a 100644 --- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c +++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c @@ -88,7 +88,7 @@ int main(void) if (SImage_Host_ConfigurePipes(&DigitalCamera_SI_Interface, ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError) { - printf("Attached Device Not a Valid CDC Class Device.\r\n"); + printf("Attached Device Not a Valid Still Image Class Device.\r\n"); LEDs_SetAllLEDs(LEDMASK_USB_ERROR); USB_HostState = HOST_STATE_WaitForDeviceRemoval; break; @@ -103,6 +103,7 @@ int main(void) } printf("Still Image Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c index ba56ae3a36b0b3657801487a90ac1e848fb614ed..d5ec0417b976800a02d0a79eff2c3504291d9d84 100644 --- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c +++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c @@ -103,6 +103,7 @@ int main(void) } printf("CDC Device Enumerated.\r\n"); + LEDs_SetAllLEDs(LEDMASK_USB_READY); USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c index f89de225f016fd173e90a98c4bb58dc953f7c2c0..c923ca393054f94f5184c58173cc5e6205088e91 100644 --- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c +++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c @@ -167,7 +167,6 @@ void StillImage_Task(void) } puts_P(PSTR("Still Image Device Enumerated.\r\n")); - USB_HostState = HOST_STATE_Configured; break; case HOST_STATE_Configured: diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h index 8eed1019851ae0b6fe9a16614c7d7b7f6983ba3e..755006a7093e9b3388cd14ee7aec59a4702377d8 100644 --- a/LUFA/Drivers/USB/Class/Common/MIDI.h +++ b/LUFA/Drivers/USB/Class/Common/MIDI.h @@ -87,7 +87,7 @@ * * \param[in] channel MIDI channel number to address */ - #define MIDI_CHANNEL(channel) (channel - 1) + #define MIDI_CHANNEL(channel) ((channel) - 1) /* Type Defines: */ /** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h index 7b3df201aed7decc90cadf68e67c8728c958398f..e65b2dbfdbb6316a3301dd990b20ffabf6e9707f 100644 --- a/LUFA/Drivers/USB/Class/Common/StillImage.h +++ b/LUFA/Drivers/USB/Class/Common/StillImage.h @@ -63,23 +63,23 @@ * * \return Number of bytes of the given unicode string */ - #define UNICODE_STRING_LENGTH(chars) (chars << 1) + #define UNICODE_STRING_LENGTH(chars) ((chars) << 1) /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for * a command container. * * \param[in] params Number of parameters which are to be sent in the Param field of the container */ - #define PIMA_COMMAND_SIZE(params) ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \ - (params * sizeof(uint32_t))) + #define PIMA_COMMAND_SIZE(params) ((sizeof(SI_PIMA_Container_t) - 12) + \ + ((params) * sizeof(uint32_t))) /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for * a data container. * * \param[in] datalen Length in bytes of the data in the container */ - #define PIMA_DATA_SIZE(datalen) ((sizeof(SI_PIMA_Container_t) - sizeof(((SI_PIMA_Container_t*)NULL)->Params)) + \ - datalen) + #define PIMA_DATA_SIZE(datalen) ((sizeof(SI_PIMA_Container_t) - 12) + \ + (datalen)) /* Enums: */ /** Enum for the possible PIMA contains types. */ @@ -122,7 +122,7 @@ uint16_t Type; /**< Container type, a value from the PIMA_Container_Types_t enum */ uint16_t Code; /**< Command, event or response code of the container */ uint32_t TransactionID; /**< Unique container ID to link blocks together */ - uint32_t Params[5]; /**< Block parameters to be issued along with the block code (command blocks only) */ + uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */ } SI_PIMA_Container_t; /* Disable C linkage for C++ Compilers: */ diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index 577f619c8c7bf129d63182c55b0d03aaf286cb27..d116ceb743ed07a743dfa9a1dca732b6d13b76be 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -315,12 +315,15 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) uint8_t ErrorCode; + SIInterfaceInfo->State.TransactionID = 0; + SIInterfaceInfo->State.IsSessionOpen = false; + SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t) { - .DataLength = PIMA_COMMAND_SIZE(0), + .DataLength = PIMA_COMMAND_SIZE(1), .Type = CType_CommandBlock, .Code = 0x1002, - .Params = {}, + .Params = {1}, }; if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) @@ -332,7 +335,6 @@ uint8_t SImage_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) if ((PIMABlock.Type != CType_ResponseBlock) || (PIMABlock.Code != 0x2001)) return SI_ERROR_LOGICAL_CMD_FAILED; - SIInterfaceInfo->State.TransactionID = 0; SIInterfaceInfo->State.IsSessionOpen = true; return PIPE_RWSTREAM_NoError; @@ -347,10 +349,10 @@ uint8_t SImage_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo) SI_PIMA_Container_t PIMABlock = (SI_PIMA_Container_t) { - .DataLength = PIMA_COMMAND_SIZE(0), + .DataLength = PIMA_COMMAND_SIZE(1), .Type = CType_CommandBlock, .Code = 0x1003, - .Params = {}, + .Params = {1}, }; if ((ErrorCode = SImage_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError) diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 3be0bdc4fa123cd4eb2bb2473af236f9d0620e7e..1a0fd0d799894abd384e7f7584ee3b5e405ac7c1 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -23,6 +23,7 @@ * - Double bank CDC endpoints in the XPLAIN Bridge project, re-enable JTAG once the mode selection pin has been sampled. * - Standardized the naming scheme given to configuration descriptor sub-elements in the Device mode demos, bootloaders * and projects + * - All Class Driver Host mode demos now correctly set the board LEDs to READY once the enumeration process has completed * * <b>Fixed:</b> * - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin @@ -34,6 +35,8 @@ * - Fixed LowLevel MassStorage demo broken on the U2 AVRs due to double-banked endpoints * - Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL is defined (thanks to C. Scott Ananian) * - Fixed incorrect definition of HID_ALIGN_DATA() causing incorrect HID report item data alignment + * - 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 * * \section Sec_ChangeLog100219 Version 100219 * diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index 2d6feac35d4b23a4598b8555b28e9eb0ceb79111..0c8eca39cef6db3344a0422c6ce5b3fbd79df275 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -21,6 +21,7 @@ * - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/ * - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b + * - JM-DB-U2, an ATMEGA32U2 development board: http://u2.mattair.net/index.html * - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/ * - Nanduino, a do-it-yourself AT90USB162 board: http://www.makestuff.eu/wordpress/?page_id=569 * - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c index 1beb811397a2b8d4c5f38920987468136b4bb429..d4857a5574c78a329ee4885927f38ad6e4bd651d 100644 --- a/Projects/RelayBoard/Descriptors.c +++ b/Projects/RelayBoard/Descriptors.c @@ -7,6 +7,7 @@ */ /* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this @@ -18,7 +19,6 @@ advertising or publicity pertaining to distribution of the software without specific, written prior permission. - The author disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h index 65644a899af51884cdbed94071b3822afb0c23e0..6cd6feefcdd37d44f4525438587c22f066b3e148 100644 --- a/Projects/RelayBoard/Descriptors.h +++ b/Projects/RelayBoard/Descriptors.h @@ -7,6 +7,7 @@ */ /* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c index 0923a2301f5c69eb3d0c53611db7cf16f5f51f08..c3034178f30a3486ec73325b132c0b06465f11bd 100644 --- a/Projects/RelayBoard/RelayBoard.c +++ b/Projects/RelayBoard/RelayBoard.c @@ -7,6 +7,7 @@ */ /* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this diff --git a/Projects/RelayBoard/RelayBoard.h b/Projects/RelayBoard/RelayBoard.h index 686c9c04660d81f45935f41705ced745bd7148c7..2ffa59023c867fe0332b65da037da1c650334e25 100644 --- a/Projects/RelayBoard/RelayBoard.h +++ b/Projects/RelayBoard/RelayBoard.h @@ -7,6 +7,7 @@ */ /* + Copyright 2010 OBinou (obconseil [at] gmail [dot] com) Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this