docs: usb: document USBDEVFS_BULK return value
PATCH 1/1 docs: usb: document USBDEVFS_BULK return value
Replace the FIXME in the usbfs bulk I/O documentation with the current behavior.
Document that USBDEVFS_BULK returns the completed URB actual_length on success, which may be smaller than the requested len. Also clarify that for IN endpoints only the returned number of bytes is copied into the userspace buffer, so a smaller return value indicates a short read.
Signed-off-by Adeel Zahid <[email protected]>
--- Documentation/driver-api/usb/usb.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
Documentation/driver-api/usb/usb.rst +13 -3
@@ -535,9 +535,19 @@ USBDEVFS_BULK The ``ep`` value identifies a bulk endpoint number (1 to 15, as identified in an endpoint descriptor), masked with USB_DIR_IN when referring to an endpoint which sends data to the host from the - device. The length of the data buffer is identified by ``len``; Recent - kernels support requests up to about 128KBytes. *FIXME say how read - length is returned, and how short reads are handled.*. + device. The length of the data buffer is identified by ``len``. Recent + kernels support requests up to about 128 KBytes. + + On success, the ioctl returns the completed URB's ``actual_length`` + value, that is, the number of bytes actually transferred for the + request. This may be less than the value requested in ``len``. + + For an IN endpoint, the return value tells userspace how many bytes were + read and copied into ``data``. If the return value is smaller than + ``len``, the read completed as a short read, and only the returned + number of bytes is valid in the buffer. + + Failures return a negative errno value. USBDEVFS_CLEAR_HALT Clears endpoint halt (stall) and resets the endpoint toggle. This is
Signature · 1 line
2.43.0