usbd: return an empty device list from sceUsbdGetDeviceList (Gran Turismo 7) #1831
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1831
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1831/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@NevesHenry on GitHub · 2026-10-22 14:06 UTC · original
NevesHenry:usbd/empty-device-list→main· +15 −0 · 1 files · 1 commits · merged 2026-10-22 14:18 UTCGame: Gran Turismo 7 (PPSA01317, 1.710), #1451 (also reported in #1614 and #1706)
GT7 calls
sceUsbdGetDeviceList(8qB9Ar4P5nc) andsceUsbdFreeDeviceList(EQ6SCLMqzkM) about 8 times a second. Neither is registered in libUsbd, so every call goes through the unresolved-import stub. That stub returns 0 without writing the list pointer, and the game then passes that pointer to FreeDeviceList.Evidence from the attached logs:
dad900c): 961 of the 1024 "Unresolved import stub called" lines are these two (481 + 480).e5f0ee7): 962 of 1024 (481 + 481).This registers both functions:
sceUsbdGetDeviceListreturns 0 devices with a static NULL-terminated list.0x80240002(INVALID_ARG).sceUsbdFreeDeviceListdoes nothing, because the list is static and holds no device.Testing: a new
usbd_testsfails on main (both NIDs missing) and passes with this change. libUsbd.cpp also builds inside the emulator target.What this doesn't do: it doesn't fix the crash in #1451 when a car is rendered. It stops GT7 from going through the stub with an uninitialized list, and keeps the stub log free for that crash. I don't own the game, so it was not run with GT7.
AI disclosure: the change, the unit test and this description were written with Claude Code. Testing was the unit test and build above.
@coderabbitai[bot] on GitHub · 2026-10-22 14:10 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
12f8836e-7001-436a-b0c9-65fea5aa3926📥 Commits
Reviewing files that changed from the base of the PR and between
c5016d9455and 26fa417036865315b713bc696e61e367fe3f903f.📒 Files selected for processing: 3
CMakeLists.txtsrc/libs/libUsbd.cpptests/UsbdTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Adds and registers
UsbdGetDeviceListandUsbdFreeDeviceList. Retrieval returns a static empty list or an invalid-argument error for a null output pointer. Freeing the static list is a no-op. Adds tests for these behaviors and registers the test executable with CTest and the aggregate test target.Suggested reviewers:
defektuPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
26fa4The device-list behavior and its test registration are in place. No identified issue blocks merging after normal checks.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.