Re: [9fans] usbd problem
Or just run diskparts(8) again. --- Begin Message --- I'm not having a good day. I said: > Also, after restarting partfs you need to reload the > partition information: > > disk/prep -p /dev/sdXX/data >/dev/sdXX/ctl Of course it should be: disk/fdisk -p /dev/sdXX/data >/dev/sdXX/ctl disk/prep -p /dev/sdXX/plan9 >/dev/sdXX/ctl --- End Message ---
Re: [9fans] usbd problem
>> > ohci. oddly, my uhci ich9r machine doesn't recognize >> > either of my extensive collection of two usb devices. >> >> You may be running the usbd with faulty dump.c. If your >> devices show up in /dev/usb0/1/status with just one >> line and 0x00 for Class/Subclass/Proto, then you're >> almost certainly running the old dump.c. >> >> In dump.c, five lines before the bottom of the file, >> change len = b[0] - 1 into len = b[0] >> >> A new version should already have been posted. >> >> Sape > > unfortunately, that's not the problem. Try usb/usbd -d -1 -V and send me the output. Sape
Re: [9fans] usbd problem
> > ohci. oddly, my uhci ich9r machine doesn't recognize > > either of my extensive collection of two usb devices. > > You may be running the usbd with faulty dump.c. If your > devices show up in /dev/usb0/1/status with just one > line and 0x00 for Class/Subclass/Proto, then you're > almost certainly running the old dump.c. > > In dump.c, five lines before the bottom of the file, > change len = b[0] - 1 into len = b[0] > > A new version should already have been posted. > > Sape unfortunately, that's not the problem. - erik
Re: [9fans] usbd problem
>> Are you killing the old usbd before starting a new one? > > yes. > >> And is this uhci or ohci? > > ohci. oddly, my uhci ich9r machine doesn't recognize > either of my extensive collection of two usb devices. You may be running the usbd with faulty dump.c. If your devices show up in /dev/usb0/1/status with just one line and 0x00 for Class/Subclass/Proto, then you're almost certainly running the old dump.c. In dump.c, five lines before the bottom of the file, change len = b[0] - 1 into len = b[0] A new version should already have been posted. Sape
Re: [9fans] usbd problem
> We added booting via the BIOS to 9load specifically for USB Oh yes, I had forgotten that. None of my machines seem to be willing to boot from any of my usb flash drives. However I have just successfully resurrected my experiment with using a kfs on usb disk as root - see /contrib/miller/usb/boot for info. It should work for fossil as well but I haven't tried that.
Re: [9fans] usbd problem
> Sorry, I have no ohci hardware so I don't think I can > help. Did the uhci machine recognise your devices > before the recent update to add ohci support? just got the machine monday. i don't think i have any older kernels with usb compiled in, but i'll see what i can find. i'd like to rule out bios problem, first. - erik
Re: [9fans] usbd problem
> ohci. oddly, my uhci ich9r machine doesn't recognize > either of my extensive collection of two usb devices. Sorry, I have no ohci hardware so I don't think I can help. Did the uhci machine recognise your devices before the recent update to add ohci support?
Re: [9fans] usbd problem
> Are you killing the old usbd before starting a new one? yes. > And is this uhci or ohci? ohci. oddly, my uhci ich9r machine doesn't recognize either of my extensive collection of two usb devices. - erik
Re: [9fans] usbd problem
> i've got things pretty wedged now -- usbd won't start Are you killing the old usbd before starting a new one? And is this uhci or ohci?
Re: [9fans] usbd problem
I'm not having a good day. I said: > Also, after restarting partfs you need to reload the > partition information: > > disk/prep -p /dev/sdXX/data >/dev/sdXX/ctl Of course it should be: disk/fdisk -p /dev/sdXX/data >/dev/sdXX/ctl disk/prep -p /dev/sdXX/plan9 >/dev/sdXX/ctl
Re: [9fans] usbd problem
>> Where is 9fat, fs and nvram created by disk/prep? > > Did you forget the 'w' command? Also, after restarting partfs you need to reload the partition information: disk/prep -p /dev/sdXX/data >/dev/sdXX/ctl
Re: [9fans] usbd problem
Oh yes, I misread the situation: term% disk/prep /dev/sdXX/plan9 empty0 2 (2 sectors, 1.00 KB) 9fat 2 3 (29998 sectors, 14.64 MB) fs 3 256913(226913 sectors, 110.79 MB) nvram 256913 256914(1 sectors, 512 B ) >>> q Thanks. Kenji Arisawa On 2008/02/13, at 17:25, Richard Miller wrote: Where is 9fat, fs and nvram created by disk/prep? Did you forget the 'w' command?
Re: [9fans] usbd problem
> Where is 9fat, fs and nvram created by disk/prep? Did you forget the 'w' command?
Re: [9fans] usbd problem
Hello, Thank you for working for usb support. In trying usb/disk I have a question: term% usb/disk term% disk/partfs /n/disk/0/data term% disk/mbr /dev/sdXX/data term% disk/fdisk -baw /dev/sdXX/data term% disk/prep /dev/sdXX/plan9 empty0 2 (2 sectors, 1.00 KB) 9fat 2 3 (29998 sectors, 14.64 MB) fs 3 256913(226913 sectors, 110.79 MB) nvram 256913 256914(1 sectors, 512 B ) >>> q term% ls -l /dev/sdXX /dev/sdXX/ctl /dev/sdXX/data /dev/sdXX/plan9 term% Where is 9fat, fs and nvram created by disk/prep? Kenji Arisawa
Re: [9fans] usbd problem
thanks for the update. i have switched to a slightly more agreeable key but i have a new way to fail. the key works the first time. but the second time i connect the same key, i get ; usbfat: setupreq: write err: No response usb/disk: describedevice: error writing usb device request: get device descriptor: No response No response mount: mount /n/usb: unknown format initially in this state, i could restart usbd and got this information. ; usb/usbd -fvD usbd: probing usb2/0.1 usbd: probing usb3/0.1 usbd: probing usb4/0.1 usbd: probing usb0/0.1 out 5 [8] 80 06 00 01 00 00 08 00 in 5 [8] 12 01 00 02 00 00 00 40 usb1/0.1 maxpkt: 64 out 5 [8] 00 05 02 00 00 00 00 00 describedevice out 24 [8] 80 06 00 01 00 00 18 00 in 24 [18] 12 01 00 02 00 00 00 40 ec 08 08 00 00 01 01 02 03 01 loadconfig out 24 [8] 80 06 00 02 00 00 ff 03 in 24 [32] 09 02 20 00 01 01 00 80 64 09 04 00 00 02 08 06 50 00 07 05 81 02 40 00 00 07 05 02 02 40 00 00 out 24 [8] 00 09 01 00 00 00 00 00 checking usb1/0.1 ... but two devices (1 and 2) with the identical status files existed. i've got things pretty wedged now -- usbd won't start so it's hard to get much more information. but i did get two "done > started, 1 0" messages on the console. sorry for the poor bug report. - erik
Re: [9fans] usbd problem
We added booting via the BIOS to 9load specifically for USB (though it may have other uses), so that we wouldn't have to add to 9load and maintain 8,000 lines, and growing, of complex USB code (though that's likely due to the inherent complexity of USB rather than being the fault of those who have contributed USB code). See sdB0 and bios0 in 9load(8). The BIOSes have been somewhat uncooperative, but if you make a USB floppy or USB disk be the first item in your BIOS boot order, remove *nobiosload=something from your plan9.ini, see the example in prep(8) for how to prepare such a USB disk, and the phase of the moon is right, it should work. It's worked here for us. If we get an EHCI driver written, this will all become much more interesting.
Re: [9fans] usbd problem
> geoff pointed out that usb/disk pulls in a lot of stuff and might need > some work to run in the kernel. Usb root can be done by putting usb/disk and usb/usbd into /boot and hacking /sys/src/9/boot/local.c a bit. I tried it once and it worked albeit slowly. However, getting 9load to use usb disk would be a bigger task.
Re: [9fans] usbd problem
> Do you mean why doesn't the ctl file accept partition commands? > You can always use fs(3) for that. But usb root is not very > practical anyway, at least with uhci, because of a stubborn > bug in the driver which makes transfers very very slow. Now > there's ohci support I would be interested to know if that works > at more like normal usb speed. you're assuming that i want to continue to do i/o once i've booted. :-) the basic problem is that, e.g., ich9r boards have no pata at all. it used to be easy to boot from CF or a DOM. but that's becoming more of a problem. booting from usb might be the only cheep solid-state choice. geoff pointed out that usb/disk pulls in a lot of stuff and might need some work to run in the kernel. so perhaps i don't fully appreciate how interconnected /dev/usb?, usb/usbd, and usb/disk. i was under the impression that usb/disk was just a bit of glue that turns an endpoint into a block device. - erik
Re: [9fans] usbd problem
> Actually, partfs(8) provides devsd-compatible partitions Cool - I hadn't noticed when that appeared.
Re: [9fans] usbd problem
Actually, partfs(8) provides devsd-compatible partitions and is probably a better choice for this than fs(3). It wasn't cited in usbdisk(4)'s SEE ALSO, but it is now.
Re: [9fans] usbd problem
> one final question, is there an advantage to usb/disk creating a fs > that's incompatable with devsd? it would seem to make booting > from usb root difficult. Do you mean why doesn't the ctl file accept partition commands? You can always use fs(3) for that. But usb root is not very practical anyway, at least with uhci, because of a stubborn bug in the driver which makes transfers very very slow. Now there's ohci support I would be interested to know if that works at more like normal usb speed.
Re: [9fans] usbd problem
Warning!, the dump.c I sent Sape has a bug. search for "len = b[0]-1", in pdesc(), replace that with "len = b[0]". sorry for the mistake. > From: [EMAIL PROTECTED] > To: 9fans@cse.psu.edu > Reply-To: 9fans@cse.psu.edu > Date: Tue Feb 12 15:36:36 CET 2008 > Subject: Re: [9fans] usbd problem > > >> Nemo found a bug in usb/lib/dump.c that may well account for > >> this. I incorporated his change (and fixed a bug in his code :-). > >> I'll ask Geoff to push it out today. > >> > >> Sape > > > > excellent. i'll give it a shot. > > > > - erik > > Give it a shot now: > /sys/src/cmd/usb/lib/dump.c > > > !— dump.c.txt > > #include > #include > #include > #include > #include "usb.h" > > int verbose; > > typedef struct Flags Flags; > typedef struct Classes Classes; > > struct Flags { > int bit; > char* name0; > char* name1; > }; > > struct Classes { > char* name; > struct { > char* name; > char* proto[4]; > } subclass[4]; > }; > > static Classes classname[] = { > [CL_AUDIO] {"audio", {[1]{"control"}, [2]{"stream"}, > [3]{"midi"}}}, > [CL_COMMS] {"comms", {[1] {"abstract", {[1]"AT", > [CL_HID]{"hid", {[1] {"boot", {[1]"kbd", [2]"mouse", > [CL_PRINTER]{"printer", {[1]"printer", {[1]"uni", [2]"bi"}}}, > [CL_HUB]{"hub", {[1]{"hub"}}}, > [CL_DATA] {"data"}, > }; > > static voidpflag(Flags*, uint); > > char * > sclass(char *p, char *e, ulong csp) > { > Classes *cs; > int c, s, pr; > > c = Class(csp); > s = Subclass(csp); > pr = Proto(csp); > if(c < 0 || c >= nelem(classname) || (cs = &classname[c])->name == nil) > return seprint(p, e, "%d.%d.%d", c, s, pr); > p = seprint(p, e, "%s.", cs->name); > if(s < 0 || s >= nelem(cs->subclass) || cs->subclass[s].name == nil) > p = seprint(p, e, "%d.%d", s, pr); > else{ > p = seprint(p, e, "%s.", cs->subclass[s].name); > if(pr < 0 || pr >= nelem(cs->subclass[s].proto) || > cs->subclass[s].proto[pr] == nil) > p = seprint(p, e, "%d", pr); > else > p = seprint(p, e, "%s", cs->subclass[s].proto[pr]); > } > return p; > } > > void > pdevice(Device *, int, ulong, void *b, int n) > { > DDevice *d; > char scbuf[64]; > > if(n < DDEVLEN) > return; > d = b; > if(debug & Dbginfo) { > fprint(2, "usb (bcd)%c%c%c%c", > '0'+((d->bcdUSB[1]>>4)&0xf), > '0'+(d->bcdUSB[1]&0xf), > '0'+((d->bcdUSB[0]>>4)&0xf), > '0'+(d->bcdUSB[0]&0xf)); > sclass(scbuf, scbuf + sizeof scbuf, > CSP(d->bDeviceClass, d->bDeviceSubClass, > d->bDeviceProtocol)), > fprint(2, " class %d subclass %d proto %d [%s] max0 %d", > d->bDeviceClass, d->bDeviceSubClass, d->bDeviceProtocol, > scbuf, > d->bMaxPacketSize0); > fprint(2, " vendor %#x product %#x device (bcd)%c%c%c%c", > GET2(d->idVendor), GET2(d->idProduct), > '0'+((d->bcdDevice[1]>>4)&0xf), > '0'+(d->bcdDevice[1]&0xf), > '0'+((d->bcdDevice[0]>>4)&0xf), > '0'+(d->bcdDevice[0]&0xf)); > fprint(2, " man %d prod %d serial %d nconfig %d", > d->iManufacturer, d->iProduct, d->iSerialNumber, > d->bNumConfigurations); > } > } > > void > phid(Device *, int, ulong, void *b, int n) > { > DHid *d; > > if(n < DHIDLEN){ > fprint(2, "%s: hid too short\n", argv0); > return; > } > d = b; >
Re: [9fans] usbd problem
>> Nemo found a bug in usb/lib/dump.c that may well account for >> this. I incorporated his change (and fixed a bug in his code :-). >> I'll ask Geoff to push it out today. >> >> Sape > > excellent. i'll give it a shot. > > - erik Give it a shot now: /sys/src/cmd/usb/lib/dump.c #include #include #include #include #include "usb.h" int verbose; typedef struct Flags Flags; typedef struct Classes Classes; struct Flags { int bit; char* name0; char* name1; }; struct Classes { char* name; struct { char* name; char* proto[4]; } subclass[4]; }; static Classes classname[] = { [CL_AUDIO] {"audio", {[1]{"control"}, [2]{"stream"}, [3]{"midi"}}}, [CL_COMMS] {"comms", {[1] {"abstract", {[1]"AT", [CL_HID]{"hid", {[1] {"boot", {[1]"kbd", [2]"mouse", [CL_PRINTER]{"printer", {[1]"printer", {[1]"uni", [2]"bi"}}}, [CL_HUB]{"hub", {[1]{"hub"}}}, [CL_DATA] {"data"}, }; static voidpflag(Flags*, uint); char * sclass(char *p, char *e, ulong csp) { Classes *cs; int c, s, pr; c = Class(csp); s = Subclass(csp); pr = Proto(csp); if(c < 0 || c >= nelem(classname) || (cs = &classname[c])->name == nil) return seprint(p, e, "%d.%d.%d", c, s, pr); p = seprint(p, e, "%s.", cs->name); if(s < 0 || s >= nelem(cs->subclass) || cs->subclass[s].name == nil) p = seprint(p, e, "%d.%d", s, pr); else{ p = seprint(p, e, "%s.", cs->subclass[s].name); if(pr < 0 || pr >= nelem(cs->subclass[s].proto) || cs->subclass[s].proto[pr] == nil) p = seprint(p, e, "%d", pr); else p = seprint(p, e, "%s", cs->subclass[s].proto[pr]); } return p; } void pdevice(Device *, int, ulong, void *b, int n) { DDevice *d; char scbuf[64]; if(n < DDEVLEN) return; d = b; if(debug & Dbginfo) { fprint(2, "usb (bcd)%c%c%c%c", '0'+((d->bcdUSB[1]>>4)&0xf), '0'+(d->bcdUSB[1]&0xf), '0'+((d->bcdUSB[0]>>4)&0xf), '0'+(d->bcdUSB[0]&0xf)); sclass(scbuf, scbuf + sizeof scbuf, CSP(d->bDeviceClass, d->bDeviceSubClass, d->bDeviceProtocol)), fprint(2, " class %d subclass %d proto %d [%s] max0 %d", d->bDeviceClass, d->bDeviceSubClass, d->bDeviceProtocol, scbuf, d->bMaxPacketSize0); fprint(2, " vendor %#x product %#x device (bcd)%c%c%c%c", GET2(d->idVendor), GET2(d->idProduct), '0'+((d->bcdDevice[1]>>4)&0xf), '0'+(d->bcdDevice[1]&0xf), '0'+((d->bcdDevice[0]>>4)&0xf), '0'+(d->bcdDevice[0]&0xf)); fprint(2, " man %d prod %d serial %d nconfig %d", d->iManufacturer, d->iProduct, d->iSerialNumber, d->bNumConfigurations); } } void phid(Device *, int, ulong, void *b, int n) { DHid *d; if(n < DHIDLEN){ fprint(2, "%s: hid too short\n", argv0); return; } d = b; if(debug & Dbginfo) fprint(2, "HID (bcd)%c%c%c%c country %d nhidclass %d classdtype %#x dlen %d\n", '0'+((d->bcdHID[1]>>4)&0xf), '0'+(d->bcdHID[1]&0xf), '0'+((d->bcdHID[0]>>4)&0xf), '0'+(d->bcdHID[0]&0xf), d->bCountryCode, d->bNumDescriptors, d->bClassDescriptorType, GET2(d->wItemLength)); } static Flags ioflags[] = { {0, "Data", "Constant"}, {1, "Array", "Variable"}, {2, "Absolute", "Relative"}, {3, "NoWrap", "Wrap"}, {4, "Linear", "NonLinear"}, {5, "PreferredState", "No Preferred State"}, {6, "No Null position", "Null state"}, {7, "Non Volatile", "Volatile"}, {8, "Bit Field", "Buffered Bytes"}, {-1, nil, nil}, }; static void pflag(Flags *tab, uint v) { char buf[200], *s; int n; n = 0; buf[0] = 0; for(; tab->name0 != nil; tab++){ if(v & (1name1; else s = tab->name0; if(s != nil && *s) n += snprint(buf+n, sizeof(buf)-n, ", %s", s); } if((debug & Dbginfo) && buf[0]) fprint(2, "[%s]", buf+2); } void preport(Device *, int, ulong, byte *b, int n) { byte *s, *es; int tag, nb, i, indent; int v; Flags *tab; s = b+2; es = b+n; indent = 0; w
Re: [9fans] usbd problem
> Nemo found a bug in usb/lib/dump.c that may well account for > this. I incorporated his change (and fixed a bug in his code :-). > I'll ask Geoff to push it out today. > > Sape excellent. i'll give it a shot. - erik
Re: [9fans] usbd problem
> usbd is exiting when i have a camera which is off > attached: > > ; usb/usbd -v > ; echo $status > usbd 1827: usbd: setup0: usb0/1: transaction error > > - erik Nemo found a bug in usb/lib/dump.c that may well account for this. I incorporated his change (and fixed a bug in his code :-). I'll ask Geoff to push it out today. Sape
Re: [9fans] usbd problem
> Looking at /sys/src/cmd/usb/usbd/usbd.c, I wonder whether > your problem has something to do with these lines? > > //unconscionable kludge (testing camera) > if(d->class == 10) setup0(d, RH2D|Rinterface, SET_INTERFACE, 10, 0, 0); thanks for the suggestion, but the camera was a red herring. it was actually the usb key that i'd plugged in. the key works fine with xp. so i engineered a swap of usb keys. it was dying in setup0 with Estalled. shouldn't usbd be resistant to badly-behaving devices? it seems that any error on any endpoint will topple usbd, at least during configure. one final question, is there an advantage to usb/disk creating a fs that's incompatable with devsd? it would seem to make booting from usb root difficult. - erik
Re: [9fans] usbd problem
Looking at /sys/src/cmd/usb/usbd/usbd.c, I wonder whether your problem has something to do with these lines? //unconscionable kludge (testing camera) if(d->class == 10) setup0(d, RH2D|Rinterface, SET_INTERFACE, 10, 0, 0);
Re: [9fans] usbd problem
> ; usb/usbd -v Try 'usb/usbd -d1' for more information.
[9fans] usbd problem
usbd is exiting when i have a camera which is off attached: ; usb/usbd -v ; echo $status usbd 1827: usbd: setup0: usb0/1: transaction error - erik