summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-12-06 23:24:42 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-12-06 23:24:42 +0100
commit29ca49ca38340835a86ab2862445e4cef673aa5c (patch)
tree79ebbd8d6d0f6ac7dc0aee72684eda2a7f640b8a
parent04fd67ab064978a9e7bf1b7c88c476fe4a894faf (diff)
nusb/ether: remove vid check in smsc driver, cleanup cdc driver
-rw-r--r--sys/src/cmd/nusb/ether/cdc.c32
-rw-r--r--sys/src/cmd/nusb/ether/ether.c3
-rw-r--r--sys/src/cmd/nusb/ether/smsc.c3
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,40 +9,12 @@
#include <auth.h>
#include <fcall.h>
#include <9p.h>
+#include <ip.h>
#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)
{
return read(ep->dfd, p, 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 <auth.h>
#include <fcall.h>
#include <9p.h>
+#include <ip.h>
#include "usb.h"
#include "dat.h"
-#include <ip.h>
-
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 <auth.h>
#include <fcall.h>
#include <9p.h>
+#include <ip.h>
#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)