diff options
author | 2020-11-23 21:33:37 +0000 | |
---|---|---|
committer | 2020-11-23 21:33:37 +0000 | |
commit | 88e48fc9892112ea04dc8cb14bc94e8645477f62 (patch) | |
tree | 2b903b797c1bb41ded3304a3eb2ad69c06424352 /sys | |
parent | Ignore duplicate sigsha2 notify, don't fail the exchange. (diff) | |
download | wireguard-openbsd-88e48fc9892112ea04dc8cb14bc94e8645477f62.tar.xz wireguard-openbsd-88e48fc9892112ea04dc8cb14bc94e8645477f62.zip |
Adopt a Linux heuristic and mark as IGNORE_RESIDUE those umass(4)
devices whose INQUIRY command succeeds but with a residue equal to the
requested bytes. Subsequent i/o's (including the INQUIRY) which succeed
with a residue equal to the requested bytes will have residue set to 0.
Fixes (very?) old devices such as the memory stick Andrew Daugherity
pulled out of his drawer and with which he hoped to install 6.8.
Subsequent testing of diffs much appreciated!
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/umass.c | 11 | ||||
-rw-r--r-- | sys/dev/usb/umassvar.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index de23c439817..cb549b6beeb 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass.c,v 1.78 2020/09/05 14:21:52 krw Exp $ */ +/* $OpenBSD: umass.c,v 1.79 2020/11/23 21:33:37 krw Exp $ */ /* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */ /* @@ -1299,8 +1299,17 @@ umass_bbb_state(struct usbd_xfer *xfer, void *priv, usbd_status err) return; } else { /* success */ + u_int32_t residue = UGETDW(sc->csw.dCSWDataResidue); sc->transfer_state = TSTATE_IDLE; if (sc->transfer_dir == DIR_IN) { + if (residue == sc->transfer_datalen) { + if (sc->cbw.CBWCDB[0] == INQUIRY) + SET(sc->sc_quirks, + UMASS_QUIRK_IGNORE_RESIDUE); + if (ISSET(sc->sc_quirks, + UMASS_QUIRK_IGNORE_RESIDUE)) + USETDW(sc->csw.dCSWDataResidue, 0); + } sc->transfer_actlen = sc->transfer_datalen - UGETDW(sc->csw.dCSWDataResidue); memcpy(sc->transfer_data, sc->data_buffer, diff --git a/sys/dev/usb/umassvar.h b/sys/dev/usb/umassvar.h index d55b671a025..b653737b4a3 100644 --- a/sys/dev/usb/umassvar.h +++ b/sys/dev/usb/umassvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: umassvar.h,v 1.15 2015/12/16 14:50:26 mpi Exp $ */ +/* $OpenBSD: umassvar.h,v 1.16 2020/11/23 21:33:38 krw Exp $ */ /* $NetBSD: umassvar.h,v 1.20 2003/09/08 19:31:01 mycroft Exp $ */ /*- * Copyright (c) 1999 MAEKAWA Masahide <bishop@rr.iij4u.or.jp>, @@ -176,6 +176,7 @@ struct umass_softc { u_int32_t sc_quirks; #define UMASS_QUIRK_WRONG_CSWSIG 0x00000001 #define UMASS_QUIRK_WRONG_CSWTAG 0x00000002 +#define UMASS_QUIRK_IGNORE_RESIDUE 0x00000004 u_int32_t sc_busquirks; |