ref: f9846213d1877bac1931d6b8a17dfc51bb44bdd4
parent: 9d49fcdb377f698366ba0bd7f45efd85a607652b
author: cinap_lenrek <cinap_lenrek@localhost>
date: Sat Jul 30 03:23:26 EDT 2011
nusb: change usbevent format, put nusbrc in bootfs
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -152,10 +152,7 @@
aux/kbdfs -s cons $a
}
-if(test -e '#u' && test -x /bin/usb/usbd){
- bind -a '#u' /dev
- usb/usbd
-}
+nusbrc
# bind in an ip interface
for(i in I l^(0 1 2 3))
--- /dev/null
+++ b/sys/src/9/boot/nusbrc
@@ -1,0 +1,18 @@
+#!/bin/rc
+
+if(! bind -a '#u' /dev)
+ exit
+if(! nusb/usbd)
+ exit
+
+fn dev {
+ switch($4){
+ case *03
+ nusb/kb $1
+ case *08
+ nusb/disk $1
+ }
+}
+rc </dev/usbevent &
+
+bind -a '#σ/usb' /dev
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -30,8 +30,10 @@
srv
test
unmount
- usb
+ nusb
usbd
+ disk
+ kb
xd
rc
lib
@@ -41,5 +43,6 @@
bin
fstype
diskparts
+ nusbrc 555 sys sys ../boot/nusbrc
bootrc 555 sys sys ../boot/bootrc
tmp
--- a/sys/src/cmd/nusb/usbd/usbd.c
+++ b/sys/src/cmd/nusb/usbd/usbd.c
@@ -208,8 +208,7 @@
Usbdev *u;
u = d->usb;
- return smprint("in id %d vid 0x%.4x did 0x%.4x csp 0x%.8lx\n",
- d->id, u->vid, u->did, u->csp);
+ return smprint("dev %d %.4x %.4x %.8lx\n", d->id, u->vid, u->did, u->csp);
}
static void
@@ -333,8 +332,10 @@
{
int fd, i, nd;
Dir *d;
-
- argc--; argv++;
+
+ ARGBEGIN {
+ } ARGEND;
+
initevent();
rfork(RFNOTEG);
switch(rfork(RFPROC|RFMEM)){
@@ -358,4 +359,5 @@
rendezvous(work, strdup(argv[i]));
rendezvous(work, nil);
postsharesrv(&usbdsrv, nil, "usb", "usbd", "b");
+ exits(nil);
}