usb_bulk_msg(9)
usb_bulk_msg(9) β Kernel API Manual π«Ά
NAME β¨
usb_bulk_msg β builds a bulk urb, sends it off and waits for completion π
SYNOPSIS π
int usb_bulk_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β endpoint "pipe" to send the message todataβ pointer to the data to sendlenβ length in bytes of the data to sendactual_lengthβ pointer to a location to put the actual length transferred in bytestimeoutβ time in msecs to wait for the message to complete before timing out
CONTEXT π΄
Context check: task context, and it might sleep. So yeah, it can nap π΄.
DESCRIPTION π
okay so this function sends a simple bulk message to a specified endpoint and waits for the message to complete, or timeout. Itβs giving βsend it and chill until itβs doneβ energy β¨.
π¨ Do not use this function from within an interrupt context. 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. Since you don't have a handle on the URB used, you can't cancel the request. No cap, thatβs the rule π«Ά.
Because there is no usb_interrupt_msg and no USBDEVFS_INTERRUPT ioctl, users are forced to abuse this routine by using it to submit URBs for interrupt endpoints. We will take the liberty of creating an interrupt URB (with the default interval) if the target is an interrupt endpoint π.
RETURN π
If successful, 0. Otherwise a negative error number. The number of actual bytes transferred will be stored in the actual_length parameter. Thatβs where the byte count lands, bestie π.
SEE ALSO π
Kernel file ./drivers/usb/core/message.c is the source lore, and hereβs the whole friend group:
usb_control_msg(9)usb_control_msg_send(9)usb_control_msg_recv(9)usb_interrupt_msg(9)usb_bulk_msg_killable(9)usb_sg_init(9)usb_sg_wait(9)usb_sg_cancel(9)usb_get_descriptor(9)usb_get_string(9)usb_string(9)usb_cache_string(9)usb_get_status(9)usb_clear_halt(9)usb_disable_endpoint(9)usb_reset_endpoint(9)usb_disable_interface(9)usb_disable_device(9)usb_enable_endpoint(9)usb_enable_interface(9)usb_set_interface(9)usb_reset_configuration(9)usb_set_wireless_status(9)usb_driver_set_configuration(9)cdc_parse_cdc_header(9)
xoxo, your USB bestie signing off from ./drivers/usb/core β October 2026, page usb_bulk_msg(9) ππ¦
π¦ 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