From 0223c3668c1ad5507a4d3a393b2bea5f3426289c Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 10 May 2013 21:45:37 +0200 Subject: [PATCH] Update Android Accessory Class driver to be compatible with protocol version 2 devices. --- LUFA/DoxygenPages/ChangeLog.txt | 8 +++++--- .../USB/Class/Common/AndroidAccessoryClassCommon.h | 5 +++-- LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index dd9a4eabe4..c4b9af9a5f 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -8,16 +8,18 @@ * * \section Sec_ChangeLogXXXXXX Version XXXXXX * New: - * - Library Applications: - * - Added new Printer class bootloader - * - Added new Mass Storage class bootloader + * - Core: * - Added additional MIDI command definitions to the MIDI class driver (thanks to Daniel Dreibrodt) * - Added new CONCAT() and CONCAT_EXPANDED() convenience macros * - Added new Printer Device Class driver + * - Library Applications: + * - Added new Printer class bootloader + * - Added new Mass Storage class bootloader * * Changed: * - Core: * - Updated the BUILD build system module to produce binary BIN files in addition to Intel HEX files + * - Updated the Android Accessory Class to accept version 2 protocol devices (with version 1 functionality) * * Fixed: * - Core: diff --git a/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h b/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h index bf3c07760f..feb8e4b409 100644 --- a/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h +++ b/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h @@ -104,16 +104,17 @@ AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ - + #if !defined(__DOXYGEN__) AOA_STRING_TOTAL_STRINGS #endif }; - + /** Enum for the possible Android Open Accessory protocol versions. */ enum AOA_Protocols_t { AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ + AOA_PROTOCOL_AccessoryV2 = 0x0002, /**< Android Open Accessory version 2. */ }; /* Disable C linkage for C++ Compilers: */ diff --git a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c index 1ae6fae828..1871df1464 100644 --- a/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c +++ b/LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c @@ -167,7 +167,7 @@ uint8_t AOA_Host_StartAccessoryMode(USB_ClassInfo_AOA_Host_t* const AOAInterface if ((ErrorCode = AOA_Host_GetAccessoryProtocol(&AccessoryProtocol)) != HOST_WAITERROR_Successful) return ErrorCode; - if (AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV1)) + if ((AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV1)) && (AccessoryProtocol != CPU_TO_LE16(AOA_PROTOCOL_AccessoryV2))) return AOA_ERROR_LOGICAL_CMD_FAILED; for (uint8_t PropertyIndex = 0; PropertyIndex < AOA_STRING_TOTAL_STRINGS; PropertyIndex++)