diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c4fb7f95..15cf79fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ lib_xua Change Log ================== +1.1.0 +----- + + + * ADDED: Ability to read or modify serial number string + 1.0.1 ----- diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 60f68bf3..2cebd564 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -62,6 +62,16 @@ void XUA_Endpoint0_setProductStr(char * unsafe product_str); void XUA_Endpoint0_setProductStr(char * product_str); #endif +/** Function to set the Serial string + * + * \param serial_str Serial string to set +*/ +#ifdef __XC__ +void XUA_Endpoint0_setSerialStr(char * unsafe serial_str); +#else +void XUA_Endpoint0_setSerialStr(char * serial_str); +#endif + /** Function to set the BCD device * * \param bcdDevice BCD device to set @@ -72,7 +82,7 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); /** Function to get the Vendor string * - * \param vid vendor string + * \return vendor string */ #ifdef __XC__ char * unsafe XUA_Endpoint0_getVendorStr(); @@ -82,7 +92,7 @@ char * XUA_Endpoint0_getVendorStr(; /** Function to get the Product string * - * \param pid Product string + * \return Product string */ #ifdef __XC__ char * unsafe XUA_Endpoint0_getProductStr(); @@ -90,15 +100,25 @@ char * unsafe XUA_Endpoint0_getProductStr(); char * XUA_Endpoint0_getProductStr(; #endif -/** Function to get the Vendor string +/** Function to get the Serial Number string * - * \return Vendor string + * \return Serial string +*/ +#ifdef __XC__ +char * unsafe XUA_Endpoint0_getSerialStr(); +#else +char * XUA_Endpoint0_getSerialStr(; +#endif + +/** Function to get the Vendor ID + * + * \return Vendor ID */ unsigned short XUA_Endpoint0_getVendorId(); -/** Function to get the Product string +/** Function to get the Product ID * - * \return Product string + * \return Product ID */ unsigned short XUA_Endpoint0_getProductId(); diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index b8b0aa5f..6f454747 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.0.1 +VERSION = 1.1.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index f30b4c5c..e91d61fc 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -118,6 +118,8 @@ char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; #endif +char g_serial_str[XUA_MAX_STR_LEN] = ""; + /* Subslot */ const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, #if(OUTPUT_FORMAT_COUNT > 1) @@ -289,6 +291,9 @@ void XUA_Endpoint0_setStrTable() { concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2); concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2); #endif + + // update Serial strings + concatenateAndCopyStrings(g_serial_str, "", g_strTable.serialStr); } void XUA_Endpoint0_setVendorStr(char* vendor_str) { @@ -301,6 +306,11 @@ void XUA_Endpoint0_setProductStr(char* product_str) { concatenateAndCopyStrings(product_str, "", g_product_str); } +void XUA_Endpoint0_setSerialStr(char* serial_str) { + debug_printf("XUA_Endpoint0_setSerialStr() with string %s\n", serial_str); + concatenateAndCopyStrings(serial_str, "", g_serial_str); +} + char* XUA_Endpoint0_getVendorStr() { return g_strTable.vendorStr; } @@ -313,6 +323,10 @@ char* XUA_Endpoint0_getProductStr() { #endif } +char* XUA_Endpoint0_getSerialStr() { + return g_strTable.serialStr; +} + void XUA_Endpoint0_setProductId(unsigned short pid) { #if (AUDIO_CLASS == 1) devDesc_Audio1.idProduct = pid; diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 185575bb..beaaa4e7 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -40,6 +40,7 @@ #define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08" #define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09" #define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a" +#define XUA_SERIAL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0b" // The value below must match the length of XUA_DESCR_EMPTY_STRING. #define XUA_MAX_STR_LEN (32) @@ -334,7 +335,7 @@ StringDescTable_t g_strTable = { .langID = "\x09\x04", /* US English */ .vendorStr = XUA_VENDOR_EMPTY_STRING, - .serialStr = "", + .serialStr = XUA_SERIAL_EMPTY_STRING, #if (AUDIO_CLASS == 2) .productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, .outputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING,