STRUCT USBIO_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct usbio_device(9) β€” a Kernel API Manual moment

okay so bestie, we're in the Kernel API Manual today and the star of the show is struct usbio_device πŸ¦‹ β€” the usb device exposing IOs. she's the main character of /drivers/usb/misc/usbio.c and honestly? iconic.


✨ NAME ✨

struct usbio_device β€” the usb device exposing IOs. that's her. that's the whole vibe. πŸ‘‘


🌸 SYNOPSIS 🌸

no cap, here's the whole struct, every single field, copy-pasted exactly because we do not gatekeep:

struct usbio_device {
    struct device *dev;
    struct usb_device *udev;
    struct usb_interface *intf;
    unsigned long quirks;
    struct mutex ctrl_mutex;
    unsigned int ctrl_pipe;
    u16 ctrlbuf_len;
    void *ctrlbuf;
    struct mutex bulk_mutex;
    unsigned int tx_pipe;
    u16 txbuf_len;
    void *txbuf;
    unsigned int rx_pipe;
    u16 rxbuf_len;
    u16 rxdat_len;
    void *rxbuf;
    struct urb *urb;
    struct completion done;
    struct list_head cli_list;
    unsigned int nr_gpio_banks;
    struct usbio_gpio_bank_desc gpios[USBIO_MAX_GPIOBANKS];
    unsigned int nr_i2c_buses;
    struct usbio_i2c_bus_desc i2cs[USBIO_MAX_I2CBUSES];
 };

like, look at her. so many buffers. so many mutexes. it's giving organized chaos πŸ’€


πŸŽ€ Members πŸŽ€

breaking it down field by field, because you deserve to know every one of them 🫢

  • dev β€” the device in the usb interface
  • udev β€” the detected usb device
  • intf β€” the usb interface
  • quirks β€” quirks. yes that's the whole description. quirks. πŸ’…
  • ctrl_mutex β€” protects ctrl_buf
  • ctrl_pipe β€” the control transfer pipe
  • ctrlbuf_len β€” the size of the control transfer pipe
  • ctrlbuf β€” the buffer used for control transfers
  • bulk_mutex β€” protects tx_buf, rx_buf and split bulk-transfers getting interrupted
  • tx_pipe β€” the bulk out pipe
  • txbuf_len β€” the size of the bulk out pipe
  • txbuf β€” the buffer used for bulk out transfers
  • rx_pipe β€” the bulk in pipe
  • rxbuf_len β€” the size of the bulk in pipe
  • rxdat_len β€” the data length at rx buffer
  • rxbuf β€” the buffer used for bulk in transfers
  • urb β€” the urb to read bulk pipe
  • done β€” completion object as request is done
  • cli_list β€” device's client list
  • nr_gpio_banks β€” Number of I2C busses
  • gpios β€” I2C bank descriptors
πŸ‘€ so yeah β€” the source doc says nr_gpio_banks is the "Number of I2C busses" and gpios are "I2C bank descriptors". we're reporting it exactly as written, don't come for me, i'm just the messenger πŸ™ˆ
also ngl, the member list in the original just… stops after gpios 😭 so nr_i2c_buses and i2cs are in the struct (see the synopsis up there ⬆️) with no writeup at all. they're mysterious. they're lowkey lurking. respect it. πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./drivers/usb/misc/usbio.c struct usbio_client(9)

and that's the tea πŸ“ go read usbio.c, go say hi to struct usbio_client(9), you've got this bestie πŸ’–

this lil masterpiece lives in ./drivers/usb/misc, dated October 2026, and yes β€” we really did just do a whole struct usbio_device(9) deep dive together. slay. periodt. 🧚✨

πŸ“¦ where this page comes from