usb_bulk_msg_killable(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… usb_bulk_msg_killable β€” from the Kernel API Manual, bestie

Okay so picture this: you're in the kernel, you've got a USB device, and you need to send a bulk message and wait for it to finish β€” but with the option to get interrupted like a normal, killable little task. That's the whole vibe of usb_bulk_msg_killable, and honestly? Iconic. ✨


πŸ¦‹ NAME

usb_bulk_msg_killable β€” builds a bulk urb, sends it off, and waits for completion in a killable state. No cap, that's literally what it does. πŸŽ€

🌸 SYNOPSIS

int usb_bulk_msg_killable (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 you're sending the message to 🫢
  • pipe β€” the endpoint "pipe" to send the message to
  • 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 β€” because sometimes you ask for a lot and only part of it goes through, iykyk)
  • timeout β€” time in msecs to wait for the message to complete before timing out (if <= 0, the wait is as long as possible πŸ’€)

🧚 CONTEXT

task context, might sleep. So like… don't be weird about it. 😴

πŸ‘‘ DESCRIPTION

This function is just like usb_blk_msg, except that it waits in a killable state and there is no limit on the timeout length. That's the tea. πŸ«– Two whole differences, both of them lowkey huge: killable wait, unlimited timeout. Slay.

πŸ”₯ RETURN

If successful, 0. Otherwise a negative error number. The number of actual bytes transferred will be stored in the actual_length parameter. So even when it's giving failure energy, you still get the byte count. Iconic behavior honestly. πŸ’–

🌈 SEE ALSO

Kernel file ./drivers/usb/core/message.c, plus the whole friend group:


bestie reminder: it waits in a killable state, so your task can absolutely get yeeted mid-wait. that's a feature, not a bug πŸ’…

And that's the page, fr fr β€” brought to you by the fine folks over at ./drivers/usb/core, dated October 2026, filed under usb_bulk_msg_killable(9). Go forth and bulk-msg responsibly, bestie πŸŒŸπŸŽ€

πŸ“¦ where this page comes from