aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/Incomplete/Sideshow
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Device/Incomplete/Sideshow')
-rw-r--r--Demos/Device/Incomplete/Sideshow/Descriptors.c22
-rw-r--r--Demos/Device/Incomplete/Sideshow/Descriptors.h11
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c2
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h2
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c3
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h3
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c3
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h3
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c6
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h6
-rw-r--r--Demos/Device/Incomplete/Sideshow/Sideshow.c10
11 files changed, 37 insertions, 34 deletions
diff --git a/Demos/Device/Incomplete/Sideshow/Descriptors.c b/Demos/Device/Incomplete/Sideshow/Descriptors.c
index f6d16c841..e05358e68 100644
--- a/Demos/Device/Incomplete/Sideshow/Descriptors.c
+++ b/Demos/Device/Incomplete/Sideshow/Descriptors.c
@@ -154,7 +154,9 @@ USB_OSCompatibleIDDescriptor_t PROGMEM DevCompatIDs =
SubCompatibleID: "UNIV1"}
};
-uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
+uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+ const uint8_t wIndex,
+ void** const DescriptorAddress)
{
const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF);
@@ -207,11 +209,12 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex,
return Size;
}
-bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
- void** const DescriptorAddress, uint16_t* const DescriptorSize)
+uint16_t USB_GetOSFeatureDescriptor(const uint16_t wValue,
+ const uint8_t wIndex,
+ void** const DescriptorAddress)
{
void* Address = NULL;
- uint16_t Size = 0;
+ uint16_t Size = NO_DESCRIPTOR;
/* Check if a device level OS feature descriptor is being requested */
if (wValue == 0x0000)
@@ -224,13 +227,6 @@ bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
}
}
- if (Address != NULL)
- {
- *DescriptorAddress = Address;
- *DescriptorSize = Size;
-
- return true;
- }
-
- return false;
+ *DescriptorAddress = Address;
+ return Size;
} \ No newline at end of file
diff --git a/Demos/Device/Incomplete/Sideshow/Descriptors.h b/Demos/Device/Incomplete/Sideshow/Descriptors.h
index 83c683be5..4d672c0ce 100644
--- a/Demos/Device/Incomplete/Sideshow/Descriptors.h
+++ b/Demos/Device/Incomplete/Sideshow/Descriptors.h
@@ -85,11 +85,12 @@
} USB_OSCompatibleIDDescriptor_t;
/* Function Prototypes: */
- uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
- ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3);
+ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
+ const uint8_t wIndex,
+ void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
- bool USB_GetOSFeatureDescriptor(const uint16_t wValue, const uint8_t wIndex,
- void** const DescriptorAddress, uint16_t* const DescriptorSize)
- ATTR_WARN_UNUSED_RESULT ATTR_WEAK ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4);
+ uint16_t USB_GetOSFeatureDescriptor(const uint16_t wValue,
+ const uint8_t wIndex,
+ void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
index a6c529e69..e8631be8e 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
@@ -44,7 +44,7 @@ SideShow_Application_t* SideShow_GetFreeApplication(void)
return NULL;
}
-SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID)
+SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID)
{
for (uint8_t App = 0; App < ARRAY_ELEMENTS(InstalledApplications); App++)
{
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
index ed885d40d..9624c7c34 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
@@ -57,6 +57,6 @@
/* Function Prototypes: */
SideShow_Application_t* SideShow_GetFreeApplication(void);
- SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID);
+ SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID);
#endif
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
index 5bce088c8..827deb0a4 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
@@ -280,7 +280,8 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
return;
}
-static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, void* const UnicodeStruct)
+static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
+ void* const UnicodeStruct)
{
Endpoint_ClearOUT();
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
index 6d4ad4c26..1395cd367 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
@@ -151,7 +151,8 @@
static void SideShow_GetCurrentUser(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader);
- static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader, void* const UnicodeStruct);
+ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
+ void* const UnicodeStruct);
static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader);
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
index 29f768ecc..02b681c50 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
@@ -30,7 +30,8 @@
#include "SideshowCommon.h"
-uint16_t SideShow_Read_Unicode_String(void* const UnicodeString, const uint16_t MaxBytes)
+uint16_t SideShow_Read_Unicode_String(void* const UnicodeString,
+ const uint16_t MaxBytes)
{
Unicode_String_t* const UnicodeStruct = (Unicode_String_t*)UnicodeString;
uint32_t UnicodeCharsToRead;
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
index 7c632b3c4..b801ecfa5 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
@@ -96,7 +96,8 @@
} SideShow_PacketHeader_t;
/* Function Prototypes: */
- uint16_t SideShow_Read_Unicode_String(void* UnicodeString, const uint16_t MaxBytes);
+ uint16_t SideShow_Read_Unicode_String(void* UnicodeString,
+ const uint16_t MaxBytes);
void SideShow_Write_Unicode_String(void* UnicodeString);
void SideShow_Discard_Byte_Stream(void);
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
index 0d1dd80fb..5bfae1b49 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
@@ -31,7 +31,8 @@
#define INCLUDE_FROM_SIDESHOWCONTENT_C
#include "SideshowContent.h"
-bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, SideShow_Application_t* const Application)
+bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
+ SideShow_Application_t* const Application)
{
uint32_t ContentSize;
uint32_t ContentID;
@@ -69,7 +70,8 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, Side
return true;
}
-static void SideShow_ProcessXMLContent(void* ContentData, uint32_t ContentSize)
+static void SideShow_ProcessXMLContent(void* ContentData,
+ uint32_t ContentSize)
{
printf(" XML");
Endpoint_Discard_Stream(ContentSize);
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
index 97a6bee81..6e3031c13 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
@@ -116,10 +116,12 @@
#define XML_END_TAG "</body>"
/* Function Prototypes: */
- bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader, SideShow_Application_t* const Application);
+ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
+ SideShow_Application_t* const Application);
#if defined(INCLUDE_FROM_SIDESHOWCONTENT_C)
- static void SideShow_ProcessXMLContent(void* ContentData, uint32_t ContentSize);
+ static void SideShow_ProcessXMLContent(void* ContentData,
+ uint32_t ContentSize);
#endif
#endif \ No newline at end of file
diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c
index 3e9778e29..2972e0cf7 100644
--- a/Demos/Device/Incomplete/Sideshow/Sideshow.c
+++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c
@@ -122,13 +122,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE))
{
void* DescriptorPointer;
- uint16_t DescriptorSize;
+ uint16_t DescriptorSize = USB_GetOSFeatureDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
+ &DescriptorPointer, &DescriptorSize);
- if (!(USB_GetOSFeatureDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
- &DescriptorPointer, &DescriptorSize)))
- {
- return;
- }
+ if (DescriptorSize == NO_DESCRIPTOR)
+ return;
Endpoint_ClearSETUP();