• Status Unconfirmed
  • Percent Complete
  • Task Type Bugs
  • Category USB operation
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by amachronic - 2021-11-10

FS#13317 - USB Mode - Ask is buggy

The way that USB Mode - Ask is currently implemented is buggy and especially so on native ports.

There are three separate issues:

  • Doing the yes/no dialog from the USB thread makes button input misbehave because get_action() is not designed to be re-entrant and the main thread is very likely blocked in get_action() at the time of the call.
  • The yes/no is run as soon as a cable is inserted and blocks the USB thread - on native ports this prevents transfer completion events from being delivered which prevents USB from working at all.
  • Native ports will probably have to behave similar to Android and come up in a charging only mode by default. After getting user input, the player needs to soft disconnect from the host so it can change its USB descriptors; support for this will have to be added to each USB driver.

Designing around the 3rd case might be a good idea, eg. have USB come up in one mode by default and then have a usb_mode_switch() call which the UI thread can invoke to enable or disable different drivers. On hosted ports this would translate to setting a new USB gadget configuration via sysfs. On native ports it would trigger a reconnect to get the OS to re-read the descriptors.


I just merged your patch to kill the existing implementation. I guess we can leave this ticket as a to-do item?


Available keyboard shortcuts


Task Details

Task Editing