svn commit: r190188 - head/sys/dev/usb

Andrew Thompson thompsa at FreeBSD.org
Fri Mar 20 15:15:23 PDT 2009


Author: thompsa
Date: Fri Mar 20 22:15:22 2009
New Revision: 190188
URL: http://svn.freebsd.org/changeset/base/190188

Log:
  MFp4 //depot/projects/usb @159423, 159497
  
  - Return a Zero Length packet on read errors.
  - Allow for smaller buffer size.
  
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/usb_generic.c

Modified: head/sys/dev/usb/usb_generic.c
==============================================================================
--- head/sys/dev/usb/usb_generic.c	Fri Mar 20 22:12:15 2009	(r190187)
+++ head/sys/dev/usb/usb_generic.c	Fri Mar 20 22:15:22 2009	(r190188)
@@ -416,6 +416,8 @@ ugen_default_read_callback(struct usb2_x
 
 	default:			/* Error */
 		if (xfer->error != USB_ERR_CANCELLED) {
+			/* send a zero length packet to userland */
+			usb2_fifo_put_data(f, xfer->frbuffers, 0, 0, 1);
 			f->flag_stall = 1;
 			f->fifo_zlp = 0;
 			usb2_transfer_start(f->xfer[1]);
@@ -1616,8 +1618,8 @@ ugen_set_buffer_size(struct usb2_fifo *f
 {
 	usb2_frlength_t t;
 
-	if (*(int *)addr < 1024)
-		t = 1024;
+	if (*(int *)addr < 0)
+		t = 0;		/* use "wMaxPacketSize" */
 	else if (*(int *)addr < (256 * 1024))
 		t = *(int *)addr;
 	else


More information about the svn-src-all mailing list