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 Legend
Posts: 1070
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
breadbanana
Junior Member
Posts: 7
Joined: Mon Apr 03, 2023 10:08 pm

Post by breadbanana »

Don't know if this is yet relevant. but just used right now and it works for me as expected.

i don't remember if this is from the standard project but there is a User_init() function at user_main.xc.
I just used XUA_Endpoint0_setSerialStr("STRING"); there and worked.
And it makes senses, as User_Init () runs before of the USB stuff, so when XUA reads the strings it is already populated.
User avatar
Ross
Verified
XCore Legend
Posts: 1070
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

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
Apparently this was my 1000th post. Hurrah!
Technical Director @ XMOS. Opinions expressed are my own