summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown2015-02-10 14:45:57 +0100
committerMichael Brown2015-02-10 14:49:27 +0100
commit58c3e7f74771dd4748983cc47ed53241ac1864f1 (patch)
treee5baedb5b58a1abadf5ea3811fa66e87d14d40d7 /src/drivers/bus
parent[usb] Parse endpoint descriptor bInterval field (diff)
downloadipxe-58c3e7f74771dd4748983cc47ed53241ac1864f1.tar.gz
ipxe-58c3e7f74771dd4748983cc47ed53241ac1864f1.tar.xz
ipxe-58c3e7f74771dd4748983cc47ed53241ac1864f1.zip
[usb] Allow usb_stream() to enforce a terminating short packet
Some USB endpoints require that a short packet be used to terminate transfers, since they have no other way to determine message boundaries. If the message length happens to be an exact multiple of the USB packet size, then this requires the use of an additional zero-length packet. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/usb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c
index 5a338a5e..8900324a 100644
--- a/src/drivers/bus/usb.c
+++ b/src/drivers/bus/usb.c
@@ -451,9 +451,11 @@ int usb_message ( struct usb_endpoint *ep, unsigned int request,
*
* @v ep USB endpoint
* @v iobuf I/O buffer
+ * @v terminate Terminate using a short packet
* @ret rc Return status code
*/
-int usb_stream ( struct usb_endpoint *ep, struct io_buffer *iobuf ) {
+int usb_stream ( struct usb_endpoint *ep, struct io_buffer *iobuf,
+ int terminate ) {
struct usb_device *usb = ep->usb;
struct usb_port *port = usb->port;
int rc;
@@ -467,7 +469,7 @@ int usb_stream ( struct usb_endpoint *ep, struct io_buffer *iobuf ) {
return rc;
/* Enqueue stream transfer */
- if ( ( rc = ep->host->stream ( ep, iobuf ) ) != 0 ) {
+ if ( ( rc = ep->host->stream ( ep, iobuf, terminate ) ) != 0 ) {
DBGC ( usb, "USB %s %s could not enqueue stream transfer: %s\n",
usb->name, usb_endpoint_name ( ep->address ),
strerror ( rc ) );