Skip to content

refactor(usb): make device topology descriptor-driven - #2

Open
pvurda wants to merge 1 commit into
tests/ploytec-codec-protocolfrom
refactor/device-usb-topology
Open

refactor(usb): make device topology descriptor-driven#2
pvurda wants to merge 1 commit into
tests/ploytec-codec-protocolfrom
refactor/device-usb-topology

Conversation

@pvurda

@pvurda pvurda commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace global endpoint/interface assumptions with a portable per-device USB topology descriptor
  • validate topology direction, endpoint numbers, transfer masks, altsetting compatibility, duplicate endpoints, and managed-interface ordering
  • validate every required endpoint against the real USB descriptors before claiming interfaces or creating ALSA state
  • claim unique secondary interfaces, preserve original altsettings, and roll back in reverse order
  • migrate Ploytec to interface 0 playback / interface 1 capture / managed MIDI input without changing IDs or packet processing

No Xone:43C USB ID or runtime support is added. The existing 40/80-frame discrepancy remains deliberately unchanged. This PR is stacked on #1.

Topology contract

The shared descriptor represents full endpoint addresses, interface/altsetting ownership, allowed bulk/interrupt/isochronous transports, and whether MIDI belongs to Ozzy. Isochronous configurations validate structurally but Linux probe returns -EOPNOTSUPP until an isochronous data plane exists. Unmanaged MIDI is excluded from interface claims and ALSA rawmidi creation.

Validation

  • 43,140 TAP assertions across 18 cases
  • GCC and Clang with ASan/UBSan
  • Linux module build with W=1 against kernel 6.14 locally
  • CI gates preserve exactly 0a4a:ffdb, ffd2, ffdd, ff4d, and ffad
  • no residual intf2, global num_interfaces, midi_in_ep, or legacy PCM endpoint fields
  • checkpatch: zero errors

Rollback behavior

All descriptors are checked before claims. A partial claim or altsetting failure restores configured interfaces in reverse order and releases only interfaces actually claimed by Ozzy. Physical disconnect avoids USB control operations once the device is detached.

@pvurda

pvurda commented Aug 26, 2026

Copy link
Copy Markdown
Owner Author

Final stacked CI is green: https://github.com/pvurda/Ozzy/actions/runs/32918815537

Passed gates:

  • kernel module builds on 5.15, 6.8, and 6.14 with W=1
  • GCC and Clang protocol/topology tests under ASan/UBSan
  • 43,140 TAP assertions
  • exact five-device USB ID preservation gate
  • changed-line checkpatch with zero errors

All three module artifacts were downloaded and their modinfo names verified as snd_usb_ozzy.

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.

1 participant