Added endian-correction to the CDC driver's Line Encoding control request handlers.
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 7 Oct 2011 03:47:42 +0000 (03:47 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 7 Oct 2011 03:47:42 +0000 (03:47 +0000)
LUFA/Drivers/USB/Class/Device/CDC.c
LUFA/Drivers/USB/Core/UC3/Device_UC3.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/LUFAPoweredProjects.txt

index da880ab..dc8c1e7 100644 (file)
@@ -51,8 +51,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
                        if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                Endpoint_ClearSETUP();
                        if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                Endpoint_ClearSETUP();
-                               Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));
-                               Endpoint_ClearOUT();
+                               Endpoint_Write_32_LE(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
+                               Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat);
+                               Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType);
+                               Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits);
+                               Endpoint_ClearIN();
+                               Endpoint_ClearStatusStage();
                        }
 
                        break;
                        }
 
                        break;
@@ -60,8 +64,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
                        if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                Endpoint_ClearSETUP();
                        if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
                        {
                                Endpoint_ClearSETUP();
-                               Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));
-                               Endpoint_ClearIN();
+                               CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE();
+                               CDCInterfaceInfo->State.LineEncoding.CharFormat  = Endpoint_Read_8();
+                               CDCInterfaceInfo->State.LineEncoding.ParityType  = Endpoint_Read_8();
+                               CDCInterfaceInfo->State.LineEncoding.DataBits    = Endpoint_Read_8();
+                               Endpoint_ClearOUT();
+                               Endpoint_ClearStatusStage();
 
                                EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
                        }
 
                                EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
                        }
index a4bdab0..a26d7c2 100644 (file)
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
                        {
                                AVR32_USBB.UDCON.uadd  = Address;
                        static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
                        {
                                AVR32_USBB.UDCON.uadd  = Address;
-                               AVR32_USBB.UDCON.adden = true;
+                               AVR32_USBB.UDCON.adden = (Address ? true : false);
                        }
 
                        static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
                        }
 
                        static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
index b2ce391..d3ff685 100644 (file)
@@ -62,6 +62,7 @@
   *     and not a Pipe within the host
   *   - The MS_Host_ResetMSInterface() now performs a full Mass Storage reset sequence to prevent data corruption in the event of a device
   *     lock up or timeout (thanks to David Lyons)
   *     and not a Pipe within the host
   *   - The MS_Host_ResetMSInterface() now performs a full Mass Storage reset sequence to prevent data corruption in the event of a device
   *     lock up or timeout (thanks to David Lyons)
+  *   - Added endian-correction to the CDC driver's Line Encoding control request handlers.
   *  - Library Applications:
   *   - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates
   *   - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration
   *  - Library Applications:
   *   - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates
   *   - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration
index 45d0d91..df72cbc 100644 (file)
@@ -79,6 +79,7 @@
  *  - Opendous-JTAG, an open source ARM JTAG debugger: http://code.google.com/p/opendous-jtag/
  *  - Openkubus, an open source hardware-based authentication dongle: http://code.google.com/p/openkubus/
  *  - Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm
  *  - Opendous-JTAG, an open source ARM JTAG debugger: http://code.google.com/p/opendous-jtag/
  *  - Openkubus, an open source hardware-based authentication dongle: http://code.google.com/p/openkubus/
  *  - Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm
+ *  - Programmable keyboard controller: http://41j.com/blog/2011/10/a-programmable-keyboard-controller/
  *  - Programmable XBOX controller: http://richard-burke.dyndns.org/wordpress/pan-galactic-gargantuan-gargle-brain-aka-xbox-360-usb-controller/
  *  - PSGroove, a Playstation 3 Homebrew dongle: http://github.com/psgroove
  *  - PS/2 to USB adapter: https://github.com/makestuff/p2ukbd
  *  - Programmable XBOX controller: http://richard-burke.dyndns.org/wordpress/pan-galactic-gargantuan-gargle-brain-aka-xbox-360-usb-controller/
  *  - PSGroove, a Playstation 3 Homebrew dongle: http://github.com/psgroove
  *  - PS/2 to USB adapter: https://github.com/makestuff/p2ukbd