summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-10-20 21:46:08 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2005-10-20 21:46:08 +0000
commit64c1f7dadeb3fa9a67788cff735f9c79367516c2 (patch)
tree00c5dbba893d09077c98d6e24076d64004d996c5
parenta5a3263f95f0eccce534fad404ee6209b7265900 (diff)
fix command and write rid handling and fix some fmt strings used on debug.
should avoid several errors when using wicontrol(8) and make scanning work at some extent. tested by jsg, joris and todd at some extent.
-rw-r--r--sys/dev/usb/if_wi_usb.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/sys/dev/usb/if_wi_usb.c b/sys/dev/usb/if_wi_usb.c
index a5820f4ceac..eda0ac19339 100644
--- a/sys/dev/usb/if_wi_usb.c
+++ b/sys/dev/usb/if_wi_usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi_usb.c,v 1.21 2005/10/16 08:47:50 fgsch Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.22 2005/10/20 21:46:07 fgsch Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
@@ -1530,36 +1530,21 @@ wi_usb_cmdresp(struct wi_usb_chain *c)
type = htole16(presp->type);
cmdresperr = letoh16(presp->resp0);
- DPRINTFN(10,("%s: %s: enter rid=%x status %x %x %x\n",
+ DPRINTFN(10,("%s: %s: enter type=%x, status=%x, cmdresp=%x, "
+ "resp=%x,%x,%x\n",
USBDEVNAME(sc->wi_usb_dev), __func__, type, status, sc->cmdresp,
- cmdresperr));
+ cmdresperr, letoh16(presp->resp1),
+ letoh16(presp->resp2)));
- if (sc->cmdresp != status) {
- DPRINTFN(1,("%s:cmd ty %x st %x cmd %x failed %x\n",
+ /* XXX */
+ if (sc->cmdresp != (status & WI_STAT_CMD_CODE)) {
+ DPRINTFN(1,("%s: cmd ty %x st %x cmd %x failed %x\n",
USBDEVNAME(sc->wi_usb_dev),
type, status, sc->cmdresp, cmdresperr));
return;
}
- if ((cmdresperr != 0) && ((sc->cmdresp == WI_CMD_INQUIRE) ||
- (sc->cmdresp == WI_CMD_DISABLE)) ) {
- /*
- * For some reason MA111 does not like info frame requests,
- * or some DISABLES
- * It responds to the request with the info
- * but it claims the request failed
- * reset the error code.
- */
- cmdresperr = 0;
- }
-
- if (cmdresperr != 0) {
- DPRINTFN(1,("%s:cmd ty %x st %x cmd %x failed %x\n",
- USBDEVNAME(sc->wi_usb_dev),
- type, status, sc->cmdresp, cmdresperr));
- }
-
- sc->cmdresperr = cmdresperr;
+ sc->cmdresperr = (status & WI_STAT_CMD_RESULT) >> 8;
sc->cmdresp = 0; /* good value for idle == INI ?? XXX */
@@ -1604,7 +1589,7 @@ wi_usb_rridresp(struct wi_usb_chain *c)
ltv->wi_len = frmlen;
- DPRINTFN(10,("%s: %s: copying %x frmlen %d s %x d %x\n",
+ DPRINTFN(10,("%s: %s: copying %d frmlen %d\n",
USBDEVNAME(sc->wi_usb_dev), __func__, (ltv->wi_len-1)*2,
frmlen));
@@ -1630,7 +1615,7 @@ wi_usb_wridresp(struct wi_usb_chain *c)
DPRINTFN(10,("%s: %s: enter status=%x\n",
USBDEVNAME(sc->wi_usb_dev), __func__, status));
- sc->ridresperr = status;
+ sc->ridresperr = (status & WI_STAT_CMD_RESULT) >> 8;
sc->ridltv = 0;
wakeup(&sc->ridresperr);
}