X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/bf50959b8016adbf6b295178b26b8173514dd060..f79f9abd28040d839b02ea22cdfde3d0a34f3482:/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c index 8dc0b6246..0353af4fb 100644 --- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c +++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -295,21 +295,26 @@ static void SideShow_GetString(SideShow_PacketHeader_t* PacketHeader, void* Unic static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader) { - uint8_t TotalInstalledApplications = SideShow_GetTotalApplications(); - uint16_t GadgetGUIDBytes = (TotalInstalledApplications * sizeof(GUID_t)); - + uint8_t TotalApplications = 0; + Endpoint_ClearOUT(); + for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) + { + if (InstalledApplications[App].InUse) + TotalApplications++; + } + PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + - sizeof(uint32_t) + GadgetGUIDBytes; + sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t)); Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM); Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t)); - Endpoint_Write_DWord_LE(TotalInstalledApplications); + Endpoint_Write_DWord_LE(TotalApplications); for (uint8_t App = 0; App < MAX_APPLICATIONS; App++) { - if (InstalledApplications[App].InUse == true) + if (InstalledApplications[App].InUse) Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t)); } @@ -386,9 +391,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* PacketHeader) SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID); if (AppToDelete != NULL) - { - AppToDelete->InUse = false; - } + AppToDelete->InUse = false; else PacketHeader->Type.NAK = true;