Skip to content

F0097 usb-1

Rule: High-speed bulk endpoints have 512-byte packets and bIntervals in range.

Code F0097 (stable, never reused)
Id usb-1
Category usb
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai off
embedded deny bedrock error: High-speed bulk endpoint max packet not 512, bInterval out of range for the speed
ui off
egui off
units-strict off
units-paranoid off

Why

A High-Speed bulk endpoint must advertise a 512-byte max packet size; a Full-Speed value (64) left over from porting an example, or a bInterval the speed doesn't allow, can work on one host's driver stack and misbehave on another's.

Example

Vb135's USB-HS serial example needed exactly this fix on Windows (commit c0d19b8): "Fix USB HS example on Windows (needed to use 512B packet size). bInterval is also incorrectly set to 255 (reported in Linux as 11 max, though seem to work)." Linux's USB stack tolerated the wrong values; Windows did not.

How to fix

Set the max packet size from the negotiated speed (512 for HS, 64 for FS) rather than a literal copied from an example, and keep bInterval inside the range the USB spec allows for the endpoint's speed and transfer type — check against a second host stack (Windows and Linux differ here), not just the one in daily use.

How it is checked

Src mid — the descriptor values are static and the speed/type combination is known at build time, so a lint can check max packet size and bInterval range per advertised speed.

Source

Ported from embedded_bedrock's firmware check catalogue, USB-1 (book/checks.md, detail in book/checks/usb.md). Found on: vb135 c0d19b8 (Windows).

Configure

[lints.usb-1]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(usb-1) <reason> (waivers); the code works there too, as in [lints.F0097].