From bd49ac8005b388df7c76cfdbba944f901b096f6b Mon Sep 17 00:00:00 2001 From: mpi Date: Tue, 6 Jan 2015 10:42:16 +0000 Subject: [PATCH] Support for MEDION S4222 which needs another funky umass quirk. From Ingo Feinerer. --- sys/dev/usb/umsm.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c index afde572f14c..2aab45f3628 100644 --- a/sys/dev/usb/umsm.c +++ b/sys/dev/usb/umsm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umsm.c,v 1.100 2014/07/12 21:24:33 mpi Exp $ */ +/* $OpenBSD: umsm.c,v 1.101 2015/01/06 10:42:16 mpi Exp $ */ /* * Copyright (c) 2008 Yojiro UO @@ -109,8 +109,9 @@ struct umsm_type { #define DEV_UMASS5 0x0100 #define DEV_UMASS6 0x0200 #define DEV_UMASS7 0x0400 +#define DEV_UMASS8 0x1000 #define DEV_UMASS (DEV_UMASS1 | DEV_UMASS2 | DEV_UMASS3 | DEV_UMASS4 | \ - DEV_UMASS5 | DEV_UMASS6 | DEV_UMASS7) + DEV_UMASS5 | DEV_UMASS6 | DEV_UMASS7 | DEV_UMASS8) }; static const struct umsm_type umsm_devs[] = { @@ -154,6 +155,9 @@ static const struct umsm_type umsm_devs[] = { {{ USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_KPC650 }, 0}, + {{ USB_VENDOR_MEDIATEK, USB_PRODUCT_MEDIATEK_UMASS }, DEV_UMASS8}, + {{ USB_VENDOR_MEDIATEK, USB_PRODUCT_MEDIATEK_DC_4COM }, 0}, + /* XXX Some qualcomm devices are missing */ {{ USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_MSM_DRIVER }, DEV_UMASS1}, {{ USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_MSM_DRIVER2 }, DEV_UMASS4}, @@ -303,6 +307,19 @@ umsm_match(struct device *parent, void *match, void *aux) return UMATCH_VENDOR_IFACESUBCLASS; } else return UMATCH_NONE; + /* + * Some devices have interfaces which fail to attach but in + * addition seem to make the remaining interfaces unusable. Only + * attach whitelisted interfaces in this case. + */ + } else if ((uaa->vendor == USB_VENDOR_MEDIATEK && + uaa->product == USB_PRODUCT_MEDIATEK_DC_4COM) && + !(id->bInterfaceClass == UICLASS_VENDOR && + ((id->bInterfaceSubClass == 0x02 && + id->bInterfaceProtocol == 0x01) || + (id->bInterfaceSubClass == 0x00 && + id->bInterfaceProtocol == 0x00)))) { + return UMATCH_NONE; } else return UMATCH_VENDOR_IFACESUBCLASS; } @@ -704,6 +721,13 @@ umsm_umass_changemode(struct umsm_softc *sc) cbw.CBWCDB[0] = UMASS_SERVICE_ACTION_OUT; cbw.CBWCDB[1] = 0x03; break; + case DEV_UMASS8: + USETDW(cbw.dCBWDataTransferLength, 0x0); + cbw.bCBWFlags = CBWFLAGS_OUT; + cbw.CBWCDB[0] = 0xf0; + cbw.CBWCDB[1] = 0x01; + cbw.CBWCDB[2] = 0x03; + break; default: DPRINTF(("%s: unknown device type.\n", sc->sc_dev.dv_xname)); break; -- 2.20.1