nusb/ether: remove vid check in smsc driver, cleanup cdc driver
This commit is contained in:
parent
04fd67ab06
commit
29ca49ca38
3 changed files with 4 additions and 34 deletions
|
@ -9,39 +9,11 @@
|
||||||
#include <auth.h>
|
#include <auth.h>
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <9p.h>
|
#include <9p.h>
|
||||||
|
#include <ip.h>
|
||||||
|
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "dat.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
|
static int
|
||||||
cdcread(Dev *ep, uchar *p, int n)
|
cdcread(Dev *ep, uchar *p, int n)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +56,7 @@ cdcinit(Dev *d)
|
||||||
mac = nil;
|
mac = nil;
|
||||||
}
|
}
|
||||||
if(mac != nil){
|
if(mac != nil){
|
||||||
str2mac(macaddr, mac);
|
parseether(macaddr, mac);
|
||||||
free(mac);
|
free(mac);
|
||||||
|
|
||||||
epread = cdcread;
|
epread = cdcread;
|
||||||
|
|
|
@ -5,12 +5,11 @@
|
||||||
#include <auth.h>
|
#include <auth.h>
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <9p.h>
|
#include <9p.h>
|
||||||
|
#include <ip.h>
|
||||||
|
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
|
|
||||||
#include <ip.h>
|
|
||||||
|
|
||||||
typedef struct Tab Tab;
|
typedef struct Tab Tab;
|
||||||
typedef struct Qbuf Qbuf;
|
typedef struct Qbuf Qbuf;
|
||||||
typedef struct Dq Dq;
|
typedef struct Dq Dq;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <auth.h>
|
#include <auth.h>
|
||||||
#include <fcall.h>
|
#include <fcall.h>
|
||||||
#include <9p.h>
|
#include <9p.h>
|
||||||
|
#include <ip.h>
|
||||||
|
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
|
@ -257,8 +258,6 @@ smscwrite(Dev *ep, uchar *p, int n)
|
||||||
int
|
int
|
||||||
smscinit(Dev *d)
|
smscinit(Dev *d)
|
||||||
{
|
{
|
||||||
if(d->usb->vid != 0x0424)
|
|
||||||
return -1;
|
|
||||||
if(!doreset(d, Hwcfg, Lrst) || !doreset(d, Pmctrl, Phyrst))
|
if(!doreset(d, Hwcfg, Lrst) || !doreset(d, Pmctrl, Phyrst))
|
||||||
return -1;
|
return -1;
|
||||||
if(!setmac)
|
if(!setmac)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue