USB audio strings Topic is solved

Discussions about USB Audio on XMOS devices
maxter
Member
Posts: 14
Joined: Fri Jun 14, 2024 9:55 am

USB audio strings

Post by maxter »

I found that the function

Code: Select all

void XUA_Endpoint0_setSerialStr(char* serial_str)
in xua_endpoint0.c writes the passed string to g_serial_str, but that variable is only used when creating the USB structure, so if the serial string needs to be changed at runtime, e.g. after reading it from the Flash, it will not be updated; so the serial string will always be the same as the string set with

Code: Select all

#define SERIAL_STR
The following change allows to set the serial string at runtime

Code: Select all

388c392
<     concatenateAndCopyStrings(serial_str, "", g_serial_str);
---
>     concatenateAndCopyStrings(serial_str, "", g_strTable.serialStr);
Is there any issue with this change, that I didn't spot? If not, could it be considered for future releases?
View Solution
User avatar
Ross
Verified
XCore Expert
Posts: 1006
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

I wasn't involved in these string changes - they were added to support another project where this information was read from a configuration flash at boot time.

I've had a quick look at the code and agree with you there is a potential issue here (and with some other strings). I think your change makes sense.

Please could you raise an issue here https://github.com/xmos/lib_xua/issues and we'll patch it up for everyone else.

Thanks
Technical Director @ XMOS. Opinions expressed are my own.
maxter
Member
Posts: 14
Joined: Fri Jun 14, 2024 9:55 am

Post by maxter »

Ross wrote: Thu Jul 11, 2024 12:16 pm I wasn't involved in these string changes - they were added to support another project where this information was read from a configuration flash at boot time.

I've had a quick look at the code and agree with you there is a potential issue here (and with some other strings). I think your change makes sense.

Please could you raise an issue here https://github.com/xmos/lib_xua/issues and we'll patch it up for everyone else.

Thanks
Thanks Ross, just created the ticket.
What is strange is that the setting at runtime is exactly my use case: I read the string from the Flash (will be the OTP) and use that method to update the USB descriptor