usb_interrupt_msg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… usb_interrupt_msg β€” Kernel API Manual, section 9

okay so bestie, welcome to usb_interrupt_msg(9) β€” the one where you build an interrupt urb, yeet it off into the world, and then just stand there waiting for it to come back. πŸ’–


✨ NAME ✨

usb_interrupt_msg β€” builds an interrupt urb, sends it off and waits for completion πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

int usb_interrupt_msg (struct usb_device *usb_dev , unsigned int pipe ,
void *data , int len , int *actual_length , int timeout );

🌸 ARGUMENTS 🌸

  • usb_dev β€” pointer to the usb device to send the message to πŸ’«
  • pipe β€” the endpoint "pipe" you're sending the message to, iykyk
  • data β€” pointer to the data to send
  • len β€” length in bytes of the data to send
  • actual_length β€” pointer to a location to put the actual length transferred in bytes (yes, actual β€” it's giving receipts)
  • timeout β€” time in msecs to wait for the message to complete before timing out ⏰

🧚 CONTEXT 🧚

task context, might sleep. 😴 like, it will nap, and that's legal here.


πŸ‘‘ DESCRIPTION πŸ‘‘

This function sends a simple interrupt message to a specified endpoint and waits for the message to complete, or timeout. simple as that, no cap.

🚨 do NOT use this function from within an interrupt context. literally do not.

If you need an asynchronous message, or need to send a message from within interrupt context, use usb_submit_urb ✨. If a thread in your driver uses this call, make sure your disconnect method can wait for it to complete β€” and here's the shady part: since you don't have a handle on the URB used, you can't cancel the request. πŸ’€ no take-backs, no refunds.


πŸ”₯ RETURN πŸ”₯

If successful, 0. Otherwise a negative error number. The number of actual bytes transferred will be stored in the actual_length parameter. πŸ“¬


🌈 SEE ALSO 🌈

Kernel file ./drivers/usb/core/message.c β€” and the whole friend group:


and that's the whole page, bestie 🫢 this lil icon lives in ./drivers/usb/core, dated October 2026, and it's manual usb_interrupt_msg(9). go forth and interrupt (responsibly, in task context only) πŸ’œβœ¨

πŸ“¦ where this page comes from