Add USB Mass Storage host support infrastructure for Hekate#1
Conversation
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
|
@copilot review this. Suggests edits. Thing we may have missed. And a GitHub testing framework. Based on documentation and actions you may be aware in other repos |
Co-authored-by: nafields <2613057+nafields@users.noreply.github.com>
Comprehensive review complete! I've created detailed documentation covering all your requests: 📋 Code Review (CODE_REVIEW_SUGGESTIONS.md)20 items identified with priority levels (P0-P3):
Each item includes code examples and implementation guidance. 🧪 Testing Framework (TESTING_FRAMEWORK.md)GitHub Actions workflows created:
Manual testing materials:
🔍 Missing Items (MISSING_ITEMS.md)Complete checklist of 20 remaining items with:
Path to MVP: ~900 LOC needed for P0+P1 items (PHY, transfers, events, descriptors) ✅ What's Working
All materials committed in 8f5aeb4. The workflows will run automatically on future pushes. |
Implements foundational USB host mode to enable reading from USB mass storage devices (flash drives, SSDs) connected via USB-C. Core transfer implementations remain incomplete pending hardware testing.
Infrastructure
bdk/usb/xhci.c/h) - Controller init, ring management, slot allocation. Transfer functions stubbed for future completion.bdk/usb/usb_msc_host.c/h) - SCSI command layer (TEST_UNIT_READY, INQUIRY, READ_CAPACITY, READ/WRITE). Relies on xHCI bulk transfers.nyx/nyx_gui/emummc_storage_usb.c/h) - Block device interface with 64-sector cache, read-only default mode.clock_enable_xusb_{host,ss,fs}()for XUSB controller clocks.Safety & Configuration
Default read-only with explicit
usb_write_enableflag required for writes. Cache gracefully degrades on allocation failure. All magic numbers replaced with named constants (USB_DEFAULT_PORT,SECTOR_SIZE_BYTES, etc.).Architecture
USB host available through Nyx only (not raw bootloader). Single device support, no hub enumeration. Polling mode for simplicity.
Remaining Work
Transfer implementation requires:
Documentation
README_USB_STORAGE.md- Usage, safety warnings, troubleshootingIMPLEMENTATION_STATUS.md- Technical status and TODO trackingDEVELOPMENT_SUMMARY.md- Architecture decisions and metricsCODE_REVIEW_SUGGESTIONS.md- Comprehensive code review with 20 prioritized itemsTESTING_FRAMEWORK.md- Complete testing strategy and proceduresMISSING_ITEMS.md- Detailed checklist of remaining work with estimatesTesting & CI/CD
GitHub Actions Workflows:
.github/workflows/build-check.yml- Automated build verification with devkitARM, validates USB object files are compiled.github/workflows/static-analysis.yml- Code quality checks (cppcheck, documentation validation, header guards)Testing Materials:
Code Review Summary
Comprehensive review identified 20 items organized by priority:
Path to Minimum Viable Product requires completing P0 and P1 items (~900 LOC total).
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.