summaryrefslogtreecommitdiff
path: root/sys/src/cmd/nusb/disk
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-07-05 23:19:13 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-07-05 23:19:13 +0200
commit336e605a1191efe1293333bac3b4f76d07b9f89b (patch)
treed704e9107c46f5d7b8b22321defa78d7257e44a1 /sys/src/cmd/nusb/disk
parentc20bab6fe09a9dea8d743017090b21edaa642ebf (diff)
support for huawei e220 g3 modem, cleanup nusb/serial
Diffstat (limited to 'sys/src/cmd/nusb/disk')
-rw-r--r--sys/src/cmd/nusb/disk/disk.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/src/cmd/nusb/disk/disk.c b/sys/src/cmd/nusb/disk/disk.c
index b690825ab..4641ffabb 100644
--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -1012,6 +1012,22 @@ umsdevfree(void *a)
free(ums);
}
+/*
+ * some devices like usb modems appear as mass storage
+ * for windows driver installation. switch mode here
+ * and exit if we detect one so the real driver can
+ * attach it.
+ */
+static void
+notreallyums(Dev *dev)
+{
+ /* HUAWEI E220 */
+ if(dev->usb->vid == 0x12d1 && dev->usb->did == 0x1003){
+ usbcmd(dev, Rh2d|Rstd|Rdev, Rsetfeature, Fdevremotewakeup, 0x02, nil, 0);
+ exits("mode switch");
+ }
+}
+
static Srv diskfs = {
.attach = dattach,
.walk1 = dwalk,
@@ -1045,6 +1061,7 @@ main(int argc, char **argv)
dev = getdev(*argv);
if(dev == nil)
sysfatal("getdev: %r");
+ notreallyums(dev);
ums = dev->aux = emallocz(sizeof(Ums), 1);
ums->maxlun = -1;
dev->free = umsdevfree;