Fixed HID Device Class Driver not allocating a temporary buffer when the host request...
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 20 Apr 2010 08:52:51 +0000 (08:52 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 20 Apr 2010 08:52:51 +0000 (08:52 +0000)
Clean up incomplete BluetoothHost debugging commands to use GCC extension to avoid NULL parameters when no formatting is required.

Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.c
Demos/Host/Incomplete/BluetoothHost/Lib/ServiceDiscoveryProtocol.h
LUFA/Drivers/USB/Class/Device/HID.c
LUFA/Drivers/USB/Class/Device/HID.h
LUFA/ManPages/ChangeLog.txt

index 87ef652..1a8cf06 100644 (file)
@@ -90,7 +90,7 @@ void Bluetooth_ACLTask(void)
 \r
                        Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);\r
                        \r
-                       BT_ACL_DEBUG(1, ">> L2CAP Configuration Request", NULL);\r
+                       BT_ACL_DEBUG(1, ">> L2CAP Configuration Request");\r
                        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.ConfigurationRequest.DestinationChannel);\r
                }\r
        }\r
@@ -118,8 +118,8 @@ static void Bluetooth_ProcessIncommingACLPackets(void)
        Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));\r
        Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));\r
 \r
-       BT_ACL_DEBUG(2, "", NULL);\r
-       BT_ACL_DEBUG(2, "Packet Received", NULL);\r
+       BT_ACL_DEBUG(2, "");\r
+       BT_ACL_DEBUG(2, "Packet Received");\r
        BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));\r
        BT_ACL_DEBUG(2, "-- Data Length: 0x%04X", ACLPacketHeader.DataLength);\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);\r
@@ -160,7 +160,7 @@ static void Bluetooth_ProcessIncommingACLPackets(void)
                                Bluetooth_Signal_InformationReq(&SignalCommandHeader);\r
                                break;\r
                        case BT_SIGNAL_COMMAND_REJECT:\r
-                               BT_ACL_DEBUG(1, "<< Command Reject", NULL);\r
+                               BT_ACL_DEBUG(1, "<< Command Reject");\r
                                \r
                                uint16_t RejectReason;\r
                                Pipe_Read_Stream_LE(&RejectReason, sizeof(RejectReason));\r
@@ -230,8 +230,8 @@ uint8_t Bluetooth_SendPacket(void* Data, const uint16_t DataLen, Bluetooth_Chann
        \r
        Pipe_Freeze();\r
        \r
-       BT_ACL_DEBUG(2, "", NULL);\r
-       BT_ACL_DEBUG(2, "Packet Sent", NULL);\r
+       BT_ACL_DEBUG(2, "");\r
+       BT_ACL_DEBUG(2, "Packet Sent");\r
        BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));\r
        BT_ACL_DEBUG(2, "-- Data Length: 0x%04X", ACLPacketHeader.DataLength);\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DataHeader.DestinationChannel);\r
@@ -296,7 +296,7 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
        \r
        Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Connection Request", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Connection Request");\r
        BT_ACL_DEBUG(2, "-- PSM 0x%04X", PacketData.ConnectionRequest.PSM);\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.ConnectionRequest.SourceChannel);\r
 \r
@@ -339,7 +339,7 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const Channel)
 \r
        Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);\r
        \r
-       BT_ACL_DEBUG(1, ">> L2CAP Disconnection Request", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Disconnection Request");\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.DisconnectionRequest.DestinationChannel);  \r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.DisconnectionRequest.SourceChannel);    \r
 }\r
@@ -357,7 +357,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
        Pipe_ClearIN();\r
        Pipe_Freeze();\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Connection Request", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Connection Request");\r
        BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);\r
        \r
@@ -422,7 +422,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
        \r
        Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Connection Response", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Connection Response");\r
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.ConnectionResponse.Result);\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ResponsePacket.ConnectionResponse.DestinationChannel);\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.ConnectionResponse.SourceChannel);\r
@@ -441,7 +441,7 @@ static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* con
        Pipe_ClearIN();\r
        Pipe_Freeze();\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Connection Response", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Connection Response");\r
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);        \r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel); \r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);       \r
@@ -480,7 +480,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
        /* Search for the referenced channel in the channel information list */\r
        Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationRequest.DestinationChannel, false);\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Configuration Request", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Configuration Request");\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConfigurationRequest.DestinationChannel);\r
        BT_ACL_DEBUG(2, "-- Remote MTU: 0x%04X", ChannelData->RemoteMTU);\r
        BT_ACL_DEBUG(2, "-- Options Len: 0x%04X", OptionsLen);\r
@@ -541,7 +541,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
                }\r
        }\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Configuration Response", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Configuration Response");\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.ConfigurationResponse.SourceChannel);\r
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.ConfigurationResponse.Result);\r
 }\r
@@ -559,7 +559,7 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
        Pipe_ClearIN();\r
        Pipe_Freeze();\r
        \r
-       BT_ACL_DEBUG(1, "<< L2CAP Configuration Response", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Configuration Response");\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConfigurationResponse.SourceChannel);\r
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConfigurationResponse.Result);\r
 \r
@@ -600,7 +600,7 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
        \r
        Pipe_Read_Stream_LE(&DisconnectionRequest, sizeof(DisconnectionRequest));\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Disconnection Request", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Disconnection Request");\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionRequest.DestinationChannel);\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionRequest.SourceChannel);\r
        \r
@@ -631,7 +631,7 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
        if (ChannelData != NULL)\r
          ChannelData->State = Channel_Closed;\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Disconnection Response", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Disconnection Response");\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ResponsePacket.DisconnectionResponse.SourceChannel);\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ResponsePacket.DisconnectionResponse.DestinationChannel);\r
 }\r
@@ -646,7 +646,7 @@ static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t*
        \r
        Pipe_Read_Stream_LE(&DisconnectionResponse, sizeof(DisconnectionResponse));\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Disconnection Response", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Disconnection Response");\r
        BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionResponse.DestinationChannel);\r
        BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionResponse.SourceChannel);\r
        \r
@@ -667,7 +667,7 @@ static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t*
  */\r
 static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const SignalCommandHeader)\r
 {\r
-       BT_ACL_DEBUG(1, "<< L2CAP Echo Request", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Echo Request");\r
        \r
        Pipe_ClearIN();\r
        Pipe_Freeze();\r
@@ -684,7 +684,7 @@ static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const Sign
        \r
        Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Echo Response", NULL);\r
+       BT_ACL_DEBUG(1, ">> L2CAP Echo Response");\r
 }\r
 \r
 /** Internal Bluetooth stack Signal Command processing routine for an Information Request command.\r
@@ -697,7 +697,7 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
 \r
        Pipe_Read_Stream_LE(&InformationRequest, sizeof(InformationRequest));\r
 \r
-       BT_ACL_DEBUG(1, "<< L2CAP Information Request", NULL);\r
+       BT_ACL_DEBUG(1, "<< L2CAP Information Request");\r
        BT_ACL_DEBUG(2, "-- Info Type: 0x%04X", InformationRequest.InfoType);\r
        \r
        Pipe_ClearIN();\r
@@ -744,6 +744,6 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
        \r
        Bluetooth_SendPacket(&ResponsePacket, (sizeof(ResponsePacket) - sizeof(ResponsePacket.Data) + DataLen), NULL);\r
 \r
-       BT_ACL_DEBUG(1, ">> L2CAP Information Response", NULL); \r
+       BT_ACL_DEBUG(1, ">> L2CAP Information Response");       \r
        BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.InformationResponse.Result);\r
 }\r
index 01da758..1a72ced 100644 (file)
@@ -43,7 +43,7 @@
                #include "BluetoothStack.h"\r
                \r
        /* Macros: */\r
-               #define BT_ACL_DEBUG(l, s, ...)           do { if (ACL_DEBUG_LEVEL >= l) printf_P(PSTR("(ACL) " s "\r\n"), __VA_ARGS__); } while (0)\r
+               #define BT_ACL_DEBUG(l, s, ...)           do { if (ACL_DEBUG_LEVEL >= l) printf_P(PSTR("(ACL) " s "\r\n"), ##__VA_ARGS__); } while (0)\r
                #define ACL_DEBUG_LEVEL                   0\r
 \r
                #define BT_CHANNELNUMBER_BASEOFFSET       0x0040\r
index 55c7518..2f78621 100644 (file)
@@ -73,11 +73,11 @@ void Bluetooth_HCITask(void)
                                switch (HCIEventHeader.EventCode)\r
                                {\r
                                        case EVENT_COMMAND_COMPLETE:\r
-                                               BT_HCI_DEBUG(1, "<< Command Complete", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Command Complete");\r
                                                Bluetooth_HCIProcessingState = Bluetooth_HCINextState;\r
                                                break;\r
                                        case EVENT_COMMAND_STATUS:\r
-                                               BT_HCI_DEBUG(1, "<< Command Status", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Command Status");\r
                                                BT_HCI_DEBUG(2, "-- Status Code: 0x%02X", (((BT_HCIEvent_CommandStatus_t*)&EventParams)->Status));\r
 \r
                                                /* If the execution of a command failed, reset the stack */\r
@@ -85,7 +85,7 @@ void Bluetooth_HCITask(void)
                                                  Bluetooth_HCIProcessingState = Bluetooth_Init;\r
                                                break;\r
                                        case EVENT_CONNECTION_REQUEST:\r
-                                               BT_HCI_DEBUG(1, "<< Connection Request", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Connection Request");\r
                                                BT_HCI_DEBUG(2, "-- Link Type: 0x%02X", (((BT_HCIEvent_ConnectionRequest_t*)&EventParams)->LinkType));\r
 \r
                                                /* Need to store the remote device's BT address in a temporary buffer for later use */\r
@@ -106,7 +106,7 @@ void Bluetooth_HCITask(void)
 \r
                                                break;\r
                                        case EVENT_PIN_CODE_REQUEST:\r
-                                               BT_HCI_DEBUG(1, "<< Pin Code Request", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Pin Code Request");\r
 \r
                                                /* Need to store the remote device's BT address in a temporary buffer for later use */\r
                                                memcpy(Bluetooth_TempDeviceAddress,\r
@@ -116,7 +116,7 @@ void Bluetooth_HCITask(void)
                                                Bluetooth_HCIProcessingState = Bluetooth_Conn_SendPINCode;\r
                                                break;\r
                                        case EVENT_LINK_KEY_REQUEST:\r
-                                               BT_HCI_DEBUG(1, "<< Link Key Request", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Link Key Request");\r
                                                \r
                                                /* Need to store the remote device's BT address in a temporary buffer for later use */\r
                                                memcpy(Bluetooth_TempDeviceAddress,\r
@@ -126,7 +126,7 @@ void Bluetooth_HCITask(void)
                                                Bluetooth_HCIProcessingState = Bluetooth_Conn_SendLinkKeyNAK;\r
                                                break;\r
                                        case EVENT_CONNECTION_COMPLETE:\r
-                                               BT_HCI_DEBUG(1, "<< Connection Complete", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Connection Complete");\r
                                                BT_HCI_DEBUG(2, "-- Handle: 0x%04X", ((BT_HCIEvent_ConnectionComplete_t*)&EventParams)->ConnectionHandle);\r
 \r
                                                /* Need to store the remote device's BT address in a temporary buffer for later use */\r
@@ -141,7 +141,7 @@ void Bluetooth_HCITask(void)
                                                Bluetooth_ConnectionComplete();                                         \r
                                                break;\r
                                        case EVENT_DISCONNECTION_COMPLETE:\r
-                                               BT_HCI_DEBUG(1, "<< Disconnection Complete", NULL);\r
+                                               BT_HCI_DEBUG(1, "<< Disconnection Complete");\r
 \r
                                                /* Device disconnected, indicate connection information no longer valid */\r
                                                Bluetooth_Connection.IsConnected = false;\r
@@ -157,7 +157,7 @@ void Bluetooth_HCITask(void)
                        \r
                        break;\r
                case Bluetooth_Init:\r
-                       BT_HCI_DEBUG(1, "# Init", NULL);\r
+                       BT_HCI_DEBUG(1, "# Init");\r
 \r
                        /* Reset the connection information structure to destroy any previous connection state */\r
                        memset(&Bluetooth_Connection, 0x00, sizeof(Bluetooth_Connection));\r
@@ -165,7 +165,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_Init_Reset; \r
                        break;\r
                case Bluetooth_Init_Reset:\r
-                       BT_HCI_DEBUG(1, "# Reset", NULL);\r
+                       BT_HCI_DEBUG(1, "# Reset");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                        {\r
@@ -180,7 +180,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Init_SetLocalName:\r
-                       BT_HCI_DEBUG(1, "# Set Local Name", NULL);\r
+                       BT_HCI_DEBUG(1, "# Set Local Name");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
@@ -195,7 +195,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Init_SetDeviceClass:\r
-                       BT_HCI_DEBUG(1, "# Set Device Class", NULL);\r
+                       BT_HCI_DEBUG(1, "# Set Device Class");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
@@ -210,7 +210,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Init_WriteScanEnable:\r
-                       BT_HCI_DEBUG(1, "# Write Scan Enable", NULL);\r
+                       BT_HCI_DEBUG(1, "# Write Scan Enable");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                        {\r
@@ -227,7 +227,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Conn_AcceptConnection:\r
-                       BT_HCI_DEBUG(1, "# Accept Connection", NULL);\r
+                       BT_HCI_DEBUG(1, "# Accept Connection");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
@@ -248,7 +248,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Conn_RejectConnection:\r
-                       BT_HCI_DEBUG(1, "# Reject Connection", NULL);\r
+                       BT_HCI_DEBUG(1, "# Reject Connection");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
@@ -268,7 +268,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Conn_SendPINCode:\r
-                       BT_HCI_DEBUG(1, "# Send Pin Code", NULL);\r
+                       BT_HCI_DEBUG(1, "# Send Pin Code");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
@@ -289,7 +289,7 @@ void Bluetooth_HCITask(void)
                        Bluetooth_HCIProcessingState = Bluetooth_ProcessEvents;\r
                        break;\r
                case Bluetooth_Conn_SendLinkKeyNAK:\r
-                       BT_HCI_DEBUG(1, "# Send Link Key NAK", NULL);\r
+                       BT_HCI_DEBUG(1, "# Send Link Key NAK");\r
 \r
                        HCICommandHeader = (BT_HCICommand_Header_t)\r
                                {\r
index 71b87dd..282fcbc 100644 (file)
@@ -44,7 +44,7 @@
                #include "BluetoothClassCodes.h"\r
 \r
        /* Macros: */\r
-               #define BT_HCI_DEBUG(l, s, ...)                        do { if (HCI_DEBUG_LEVEL >= l) printf_P(PSTR("(HCI) " s "\r\n"), __VA_ARGS__); } while (0)\r
+               #define BT_HCI_DEBUG(l, s, ...)                        do { if (HCI_DEBUG_LEVEL >= l) printf_P(PSTR("(HCI) " s "\r\n"), ##__VA_ARGS__); } while (0)\r
                #define HCI_DEBUG_LEVEL                                0\r
 \r
                #define OGF_LINK_CONTROL                               0x01\r
index 58f47a1..4964516 100644 (file)
@@ -71,7 +71,7 @@ void ServiceDiscovery_ProcessPacket(void* Data, Bluetooth_Channel_t* Channel)
        SDP_PDUHeader_t* SDPHeader = (SDP_PDUHeader_t*)Data;\r
        SDPHeader->ParameterLength = SwapEndian_16(SDPHeader->ParameterLength);\r
 \r
-       BT_SDP_DEBUG(1, "SDP Packet Received", NULL);\r
+       BT_SDP_DEBUG(1, "SDP Packet Received");\r
        BT_SDP_DEBUG(2, "-- PDU ID: 0x%02X", SDPHeader->PDU);\r
        BT_SDP_DEBUG(2, "-- Param Length: 0x%04X", SDPHeader->ParameterLength);\r
 \r
@@ -91,19 +91,19 @@ void ServiceDiscovery_ProcessPacket(void* Data, Bluetooth_Channel_t* Channel)
 \r
 static void ServiceDiscovery_ProcessServiceSearch(SDP_PDUHeader_t* SDPHeader)\r
 {\r
-       BT_SDP_DEBUG(1, "<< Service Search", NULL);\r
+       BT_SDP_DEBUG(1, "<< Service Search");\r
 }\r
 \r
 static void ServiceDiscovery_ProcessServiceAttribute(SDP_PDUHeader_t* SDPHeader)\r
 {\r
-       BT_SDP_DEBUG(1, "<< Service Attribute", NULL);\r
+       BT_SDP_DEBUG(1, "<< Service Attribute");\r
 }\r
 \r
 static void ServiceDiscovery_ProcessServiceSearchAttribute(SDP_PDUHeader_t* SDPHeader)\r
 {\r
        void* CurrentParameter = ((void*)SDPHeader + sizeof(SDP_PDUHeader_t));\r
        \r
-       BT_SDP_DEBUG(1, "<< Service Search Attribute", NULL);\r
+       BT_SDP_DEBUG(1, "<< Service Search Attribute");\r
        \r
        uint8_t ElementHeaderSize;\r
 \r
index 26b3c10..397d10b 100644 (file)
@@ -43,7 +43,7 @@
                #include "BluetoothStack.h"\r
                \r
        /* Macros: */\r
-               #define BT_SDP_DEBUG(l, s, ...)                 do { if (SDP_DEBUG_LEVEL >= l) printf_P(PSTR("(SDP) " s "\r\n"), __VA_ARGS__); } while (0)\r
+               #define BT_SDP_DEBUG(l, s, ...)                 do { if (SDP_DEBUG_LEVEL >= l) printf_P(PSTR("(SDP) " s "\r\n"), ##__VA_ARGS__); } while (0)\r
                #define SDP_DEBUG_LEVEL                         2\r
                \r
                #define SDP_PDU_ERRORRESPONSE                   0x01\r
index cc1ad43..7ff3249 100644 (file)
@@ -53,11 +53,15 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                                uint16_t ReportINSize = 0;\r
                                uint8_t  ReportID     = (USB_ControlRequest.wValue & 0xFF);\r
                                uint8_t  ReportType   = (USB_ControlRequest.wValue >> 8) - 1;\r
+                               uint8_t  ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize];\r
+\r
+                               memset(ReportINData, 0, sizeof(ReportINData));\r
 \r
-                               memset(HIDInterfaceInfo->Config.PrevReportINBuffer, 0, HIDInterfaceInfo->Config.PrevReportINBufferSize);\r
-                               \r
                                CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType,\r
                                                                    HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize);\r
+                               \r
+                               if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)\r
+                                 memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, HIDInterfaceInfo->Config.PrevReportINBufferSize);\r
 \r
                                Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);\r
                                Endpoint_Write_Control_Stream_LE(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize);\r
@@ -169,7 +173,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
                if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)\r
                {\r
                        StatesChanged = (memcmp(ReportINData, HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize) != 0);\r
-                       memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, ReportINSize);\r
+                       memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, HIDInterfaceInfo->Config.PrevReportINBufferSize);\r
                }\r
 \r
                if (ReportINSize && (ForceSend || StatesChanged || IdlePeriodElapsed))\r
index 1ab7177..9275124 100644 (file)
                                        uint8_t  PrevReportINBufferSize; /**< Size in bytes of the given input report buffer. This is used to create a\r
                                                                          *  second buffer of the same size within the driver so that subsequent reports\r
                                                                          *  can be compared. If the user app is to determine when reports are to be sent\r
-                                                                         *  exclusively (i.e. \ref PrevReportINBuffer is NULL) this value is ignored.\r
+                                                                         *  exclusively (i.e. \ref PrevReportINBuffer is NULL) this value must still be\r
+                                                                                                         *  set to the size of the largest report the device can issue to the host.\r
                                                                          */\r
                                } Config; /**< Config data for the USB class interface within the device. All elements in this section\r
                                           *   <b>must</b> be set or the interface will fail to enumerate and operate correctly.\r
index f4c995f..fe59357 100644 (file)
@@ -43,6 +43,8 @@
   *    a valid session ID to the device\r
   *  - Removed invalid dfu and flip related targets from the bootloaders - bootloaders can only be replaced with an external programmer\r
   *  - Fixed Set/Clear Feature requests directed to a non-configured endpoint not returning a stall to the host\r
+  *  - Fixed HID Device Class Driver not allocating a temporary buffer when the host requests a report via the control endpoint and the\r
+  *    user has set the PrevReportINBuffer driver configuration element to NULL (thanks to Lars Noschinski)\r
   *\r
   *  \section Sec_ChangeLog100219 Version 100219\r
   *\r