ref: b43de8eb1fb64d545b12b987646a5823d2e42caf
parent: e5bab1dd9fd644ef800d9371a9d0a1b3fb30d59f
author: cinap_lenrek <cinap_lenrek@localhost>
date: Sun Jul 31 22:36:02 EDT 2011
nusb: fix usage inconsitency, shr names
--- a/sys/src/9/boot/nusbrc
+++ b/sys/src/9/boot/nusbrc
@@ -17,7 +17,7 @@
}
}
fn detach {
- rm '#σc/usb/'*'-'^$1
+ rm -f '#σc/usb/'^$1.*
}
rc < '#σ/usb/usbevent' &
}
--- a/sys/src/cmd/nusb/disk/disk.c
+++ b/sys/src/cmd/nusb/disk/disk.c
@@ -979,7 +979,7 @@
static void
usage(void)
{
- fprint(2, "usage: usb/disk [-d] devid");
+ fprint(2, "usage: %s [-d] devid\n", argv0);
exits("usage");
}
@@ -1047,7 +1047,7 @@
snprint(lun->name, sizeof(lun->name), "sdU%d.%d", dev->id, i);
makeparts(lun);
}
- snprint(buf, sizeof buf, "disk-%s", *argv);
+ snprint(buf, sizeof buf, "%d.disk", dev->id);
postsharesrv(&diskfs, nil, "usb", buf);
exits(nil);
}
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -157,9 +157,9 @@
Dev *dev;
if(sts != nil)
- fprint(2, "kb: fatal: %s\n", sts);
+ fprint(2, "%s: fatal: %s\n", argv0, sts);
else
- fprint(2, "kb: exiting\n");
+ fprint(2, "%s: exiting\n", argv0);
if(kd->repeatc != nil)
nbsendul(kd->repeatc, Diemsg);
dev = kd->dev;
@@ -269,7 +269,7 @@
if(c > 3 && buf[3] == -1) /* down */
b |= 0x10;
if(kbdebug > 1)
- fprint(2, "kb: m%11d %11d %11d\n", x, y, b);
+ fprint(2, "%s: m%11d %11d %11d\n", argv0, x, y, b);
seprint(mbuf, mbuf+sizeof(mbuf), "m%11d %11d %11d", x, y,b);
if(write(mfd, mbuf, strlen(mbuf)) < 0)
kbfatal(f, "mousein i/o");
@@ -468,7 +468,7 @@
assert(f->ep != nil);
if(c < 0){
rerrstr(err, sizeof(err));
- fprint(2, "kb: %s: read: %s\n", f->ep->dir, err);
+ fprint(2, "%s: %s: read: %s\n", argv0, f->ep->dir, err);
if(strstr(err, "babble") != 0 && ++nerrs < 3){
recoverkb(f);
continue;
@@ -506,7 +506,6 @@
}
qunlock(&inlck);
}
- dprint(2, "freekdev\n");
free(kd);
}
@@ -519,7 +518,7 @@
if(in->fd < 0){
in->fd = open(in->name, OWRITE);
if(in->fd < 0){
- fprint(2, "kb: %s: %r\n", in->name);
+ fprint(2, "%s: %s: %r\n", argv0, in->name);
qunlock(&inlck);
return;
}
@@ -531,17 +530,17 @@
kd->in = in;
kd->dev = d;
if(setbootproto(kd, ep->id) < 0){
- fprint(2, "kb: %s: bootproto: %r\n", d->dir);
+ fprint(2, "%s: %s: bootproto: %r\n", argv0, d->dir);
return;
}
kd->accel = accel;
kd->ep = openep(d, ep->id);
if(kd->ep == nil){
- fprint(2, "kb: %s: openep %d: %r\n", d->dir, ep->id);
+ fprint(2, "%s: %s: openep %d: %r\n", argv0, d->dir, ep->id);
return;
}
if(opendevdata(kd->ep, OREAD) < 0){
- fprint(2, "kb: %s: opendevdata: %r\n", kd->ep->dir);
+ fprint(2, "%s: %s: opendevdata: %r\n", argv0, kd->ep->dir);
closedev(kd->ep);
kd->ep = nil;
return;
@@ -553,7 +552,7 @@
static void
usage(void)
{
- werrstr("usage: usb/kb [-dkm] [-a n] [-N nb]");
+ fprint(2, "usage: %s [-d] [-a n] devid\n", argv0);
threadexits("usage");
}
--- a/sys/src/cmd/nusb/serial/serial.c
+++ b/sys/src/cmd/nusb/serial/serial.c
@@ -729,7 +729,7 @@
static void
usage(void)
{
- fprint(2, "usage: usb/serial [-dD] [-m mtpt] [-s srv] devid\n");
+ fprint(2, "usage: %s [-d] devid\n", argv0);
threadexitsall("usage");
}
@@ -789,8 +789,8 @@
Serial *ser;
Dev *dev;
char buf[50];
- int i, devid;
Serialport *p;
+ int i;
ARGBEGIN{
case 'd':
@@ -801,8 +801,7 @@
}ARGEND
if(argc != 1)
usage();
- devid = atoi(*argv);
- dev = getdev(devid);
+ dev = getdev(atoi(*argv));
if(dev == nil)
sysfatal("getdev: %r");
@@ -852,13 +851,13 @@
if(p->isjtag){
snprint(p->name, sizeof p->name, "jtag");
dsprint(2, "serial: JTAG interface %d %p\n", i, p);
- snprint(p->name, sizeof p->name, "jtag%d.%d", devid, i);
+ snprint(p->name, sizeof p->name, "jtag%d.%d", dev->id, i);
} else {
snprint(p->name, sizeof p->name, "eiaU");
if(i == 0)
- snprint(p->name, sizeof p->name, "eiaU%d", devid);
+ snprint(p->name, sizeof p->name, "eiaU%d", dev->id);
else
- snprint(p->name, sizeof p->name, "eiaU%d.%d", devid, i);
+ snprint(p->name, sizeof p->name, "eiaU%d.%d", dev->id, i);
}
fprint(2, "%s...", p->name);
incref(dev);
@@ -870,7 +869,7 @@
qunlock(ser);
if(nports > 0){
- snprint(buf, sizeof buf, "serial-%d", devid);
+ snprint(buf, sizeof buf, "%d.serial", dev->id);
threadpostsharesrv(&serialfs, nil, "usb", buf);
}
}