Skip to content

Conversation

dhalbert
Copy link
Collaborator


SD card USB presentation

  • Add new .h-only compile option CIRCUITPY_SDCARD_USB, which will enable/disable presenting SD card as a USB MSC LUN.
  • Enable on all ports except atmel-samd due to some bug that causes USB disconnection. I tested most of the other ports, and they don't have this problem. I'll open a separate issue about this for fixing post 10.0.0.

Prevent unneeded auto-reload

  • Do not trigger an auto-reload if the host is doing a USB write that is not to the filesystem, but instead to the volume metadata (probably this is only the dirty bit being set/cleared). This prevents random long-interval auto-reloads (like 70 seconds) on Linux. macOS and Windows didn't have this problem. I check for this by seeing whether the LBA being written is below the FAT filesystem.

Technical debt found in passing

  • Use gc_ptr_on_heap() instead of gc_nbytes() > 0 when checking if an object on the heap. Will be slightly faster.
  • Reformatted some code with preprocessor guides around line 300 in supervisor/shared/usb/usb_msc_flash.c so the editor does not mess up the indentation.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor things. Want to document this behavior somewhere? Maybe the workflow markdown?

@dhalbert dhalbert requested a review from tannewt September 26, 2025 03:31
@dhalbert dhalbert force-pushed the sd-card-usb-presentation-fixes branch from 185841e to d5ca685 Compare September 26, 2025 04:02
@dhalbert
Copy link
Collaborator Author

Want to document this behavior somewhere? Maybe the workflow markdown?

I added a paragraph to the #### SD card drive section in workflows.md.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional doc thing.

@dhalbert dhalbert force-pushed the sd-card-usb-presentation-fixes branch from db41daf to edd4532 Compare September 26, 2025 17:48
@dhalbert dhalbert requested a review from tannewt September 26, 2025 17:49
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@dhalbert dhalbert merged commit bfb80c2 into adafruit:main Sep 26, 2025
606 checks passed
@dhalbert dhalbert deleted the sd-card-usb-presentation-fixes branch September 26, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SD card USB presentation problems
2 participants