From 29ca49ca38340835a86ab2862445e4cef673aa5c Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 6 Dec 2012 23:24:42 +0100 Subject: nusb/ether: remove vid check in smsc driver, cleanup cdc driver --- sys/src/cmd/nusb/ether/cdc.c | 32 ++------------------------------ sys/src/cmd/nusb/ether/ether.c | 3 +-- sys/src/cmd/nusb/ether/smsc.c | 3 +-- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/sys/src/cmd/nusb/ether/cdc.c b/sys/src/cmd/nusb/ether/cdc.c index a36d79fb0..6cc581aad 100644 --- a/sys/src/cmd/nusb/ether/cdc.c +++ b/sys/src/cmd/nusb/ether/cdc.c @@ -9,39 +9,11 @@ #include #include #include <9p.h> +#include #include "usb.h" #include "dat.h" -static int -str2mac(uchar *m, char *s) -{ - int i; - - if(strlen(s) != 12) - return -1; - - for(i=0; i<12; i++){ - uchar v; - - if(s[i] >= 'A' && s[i] <= 'F'){ - v = 10 + s[i] - 'A'; - } else if(s[i] >= 'a' && s[i] <= 'f'){ - v = 10 + s[i] - 'a'; - } else if(s[i] >= '0' && s[i] <= '9'){ - v = s[i] - '0'; - } else { - v = 0; - } - if(i&1){ - m[i/2] |= v; - } else { - m[i/2] = v<<4; - } - } - return 0; -} - static int cdcread(Dev *ep, uchar *p, int n) { @@ -84,7 +56,7 @@ cdcinit(Dev *d) mac = nil; } if(mac != nil){ - str2mac(macaddr, mac); + parseether(macaddr, mac); free(mac); epread = cdcread; diff --git a/sys/src/cmd/nusb/ether/ether.c b/sys/src/cmd/nusb/ether/ether.c index 952f1a851..90478faaf 100644 --- a/sys/src/cmd/nusb/ether/ether.c +++ b/sys/src/cmd/nusb/ether/ether.c @@ -5,12 +5,11 @@ #include #include #include <9p.h> +#include #include "usb.h" #include "dat.h" -#include - typedef struct Tab Tab; typedef struct Qbuf Qbuf; typedef struct Dq Dq; diff --git a/sys/src/cmd/nusb/ether/smsc.c b/sys/src/cmd/nusb/ether/smsc.c index 23bfc2af3..d0134529a 100644 --- a/sys/src/cmd/nusb/ether/smsc.c +++ b/sys/src/cmd/nusb/ether/smsc.c @@ -9,6 +9,7 @@ #include #include #include <9p.h> +#include #include "usb.h" #include "dat.h" @@ -257,8 +258,6 @@ smscwrite(Dev *ep, uchar *p, int n) int smscinit(Dev *d) { - if(d->usb->vid != 0x0424) - return -1; if(!doreset(d, Hwcfg, Lrst) || !doreset(d, Pmctrl, Phyrst)) return -1; if(!setmac) -- cgit v1.2.3