STRUCT USB_INTERFACE_CACHE(9)
β¨ struct usb_interface_cache(9) β¨
okay so bestie, we're in the Kernel API Manual today and this one is genuinely one of the good ones β it's the long-term representation of a device interface π like, this struct is the one that stays.
πΈ NAME πΈ
struct usb_interface_cache β long-term representation of a device interface β¨
π¦ SYNOPSIS π¦
struct usb_interface_cache {
unsigned num_altsetting;
struct kref ref;
struct usb_host_interface altsetting[];
};
π Members π
num_altsettingβ the number of altsettings that are defined, fr fr. that's the count, no cap.refβ the reference counter π«Ά (it's astruct kref, she's keeping track).altsettingβ a variable-length array of interface structures, one for each alternate setting that may be selected β¨. each one includes a set of endpoint configurations. and heads up: they will be in no particular order π so don't go assuming any kind of sorted vibe, because there isn't one.
π Description π
so here's the moment. these structures persist for the lifetime of a usb_device β which is literally the whole point of them. unlike struct usb_interface (which persists only as long as its configuration is installed π), these ones stick around.
and because they stick around, the altsetting arrays can be accessed through these structures at any time β β that means you can compare configurations, and it's also what provides support for the /sys/kernel/debug/usb/devices pseudo-file. icon behaviour. ate. π
π SEE ALSO π
kernel file ./include/linux/usb.h, plus the whole friend group:
struct usb_host_endpoint(9)struct usb_interface(9)usb_set_intfdata(9)struct usb_host_config(9)struct usb_device(9)usb_hub_for_each_child(9)usb_interface_claimed(9)usb_make_path(9)USB_DEVICE(9)USB_DEVICE_VER(9)USB_DEVICE_INTERFACE_CLASS(9)USB_DEVICE_INTERFACE_PROTOCOL(9)USB_DEVICE_INTERFACE_NUMBER(9)USB_DEVICE_INFO(9)USB_INTERFACE_INFO(9)USB_DEVICE_AND_INTERFACE_INFO(9)USB_VENDOR_AND_INTERFACE_INFO(9)struct usb_driver(9)struct usb_device_driver(9)struct usb_class_driver(9)module_usb_driver(9)struct urb(9)usb_fill_control_urb(9)usb_fill_bulk_urb(9)usb_fill_int_urb(9)usb_urb_dir_in(9)usb_urb_dir_out(9)struct usb_sg_request(9)
okay that's the whole page bestie, go forth and cache responsibly π§π
this one came out of./include/linuxand it's dated October 2026 β and the page footer is still signing off asstruct usb_interface_cache(9), periodt π π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms