kernel - Fix usb keyboard problems with ehci & ddb
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 29 Aug 2010 22:10:21 +0000 (15:10 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 29 Aug 2010 22:10:21 +0000 (15:10 -0700)
* Be sure to save the status of the xfer before reissuing the xfer
  in an interrupt pipe callback.

  This fixes an issue where ukbd thought the keyboard events from
  ehci were illegal because the status of the transfer was always
  IN_PROGRESS instead of COMPLETE.

  Interrupt pipes reissue their xfers prior to making the callback
  in order to ensure that the xfer is not somewhere in no-man's land
  if the callback enters the debugger (i.e. ctl-alt-esc).

sys/bus/usb/usbdi.c

index 60eae1d..014fa1b 100644 (file)
@@ -843,9 +843,10 @@ usb_transfer_complete(usbd_xfer_handle xfer)
                        xfer->callback(xfer, xfer->priv, xfer->status);
                pipe->methods->done(xfer);
        } else {
-               pipe->methods->done(xfer);
+               int status = xfer->status;      /* get this before restart */
+               pipe->methods->done(xfer);      /* restart */
                if (xfer->callback)
-                       xfer->callback(xfer, xfer->priv, xfer->status);
+                       xfer->callback(xfer, xfer->priv, status);
        }
 
        if (sync && !polling)