9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] qemu usb flash drive (stick)
@ 2011-09-19  8:34 faif
  2011-09-20  9:07 ` faif
  2011-11-29 10:16 ` faif
  0 siblings, 2 replies; 15+ messages in thread
From: faif @ 2011-09-19  8:34 UTC (permalink / raw)
  To: 9fans

It seems that I have the same problem with https://groups.google.com/forum/#!searchin/comp.os.plan9/usb/comp.os.plan9/dBpkbPyQrzw/0TagYRLa02MJ

term% usb/usbd
usb/usbd: /dev/usb: no hubs

`ls #u' works (but why is that important?)

I'm also missing the /srv/usb file:
term% usbfat:
mount: can't open /srv/usb: '/srv/usb' does not exist
cannot mount /srv/usb

Any tips?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-19  8:34 [9fans] qemu usb flash drive (stick) faif
@ 2011-09-20  9:07 ` faif
  2011-09-20  9:38   ` Richard Miller
  2011-09-21  8:36   ` faif
  2011-11-29 10:16 ` faif
  1 sibling, 2 replies; 15+ messages in thread
From: faif @ 2011-09-20  9:07 UTC (permalink / raw)
  To: 9fans

I removed the similar topic, sorry for posting twice but the delay was long thus I assumed that this one never reached the group.

I found out that `ls #u' is useful since #u is the short name bound to the usb directory. So if it works it means that usbd is up? Nevertheless the problem still remains, so I'm waiting for your tips :)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-20  9:07 ` faif
@ 2011-09-20  9:38   ` Richard Miller
  2011-09-21  8:36   ` faif
  1 sibling, 0 replies; 15+ messages in thread
From: Richard Miller @ 2011-09-20  9:38 UTC (permalink / raw)
  To: comp.os.plan9, 9fans

> I found out that `ls #u' is useful since #u is the short name bound to the usb directory. So if it works it means that usbd is up?

No, the existence of '#u' just shows that the kernel usb driver exists
and a usb interface has been found.  The user-level usbd program is
needed in order to connect and enumerate any devices.  You can use
the ps(1) command to see whether usbd is running.

	term% ps|grep usbd
	miller            5    0:06   4:02      492K Sleep    usbd
	miller            7    0:05   0:15      492K Pread    usbd
	miller            8    0:00   0:00      492K Pread    usbd
	miller            9    0:00   0:00      492K Rendez   usbd
	miller           10    0:00   0:00      492K Rendez   usbd
	miller           68    0:00   0:00      492K Rendez   usbd

You said you had seen the error message 'no hubs' when starting usb/usbd.
It's often useful to explore the source code to find more information
about an error message:

	term% src -n usb/usbd
	/sys/src/cmd/usb/usbd/usbd.c:809
	term% grep 'no hubs' /sys/src/cmd/usb/usbd/*.c
	/sys/src/cmd/usb/usbd/usbd.c:			sysfatal("/dev/usb: no hubs");

Sysfatal exits after printing a message, so that explains why usbd is
not running, and therefore isn't providing the /srv/usb service.

To look for more clues about what's going wrong:

- try 'ls -d /dev/usb' to see if '#u' is bound in /dev
- try 'cat /dev/usb/ctl' to see what the state of your usb interfaces is
- look in /dev/kmesg to see if there are any boot-time error messages
  relating to usb




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-20  9:07 ` faif
  2011-09-20  9:38   ` Richard Miller
@ 2011-09-21  8:36   ` faif
  2011-09-21 10:18     ` Richard Miller
  1 sibling, 1 reply; 15+ messages in thread
From: faif @ 2011-09-21  8:36 UTC (permalink / raw)
  To: 9fans

Thanks for the tips. By trying to avoid thinking about UNIX when I'm on Plan 9 I forgot that some userspace utilities are the same :)

> No, the existence of '#u' just shows that the kernel usb driver exists
> and a usb interface has been found.  The user-level usbd program is
> needed in order to connect and enumerate any devices.  You can use
> the ps(1) command to see whether usbd is running.
>
> 	term% ps|grep usbd
> 	miller            5    0:06   4:02      492K Sleep    usbd
> 	miller            7    0:05   0:15      492K Pread    usbd
> 	miller            8    0:00   0:00      492K Pread    usbd
> 	miller            9    0:00   0:00      492K Rendez   usbd
> 	miller           10    0:00   0:00      492K Rendez   usbd
> 	miller           68    0:00   0:00      492K Rendez   usbd

There is one instance of usbd appearing at the output of ps

>
> You said you had seen the error message 'no hubs' when starting usb/usbd.
> It's often useful to explore the source code to find more information
> about an error message:
>
> 	term% src -n usb/usbd
> 	/sys/src/cmd/usb/usbd/usbd.c:809
> 	term% grep 'no hubs' /sys/src/cmd/usb/usbd/*.c
> 	/sys/src/cmd/usb/usbd/usbd.c:			sysfatal("/dev/usb: no hubs");
>
> Sysfatal exits after printing a message, so that explains why usbd is
> not running, and therefore isn't providing the /srv/usb service.

Thanks, the src command (together with sig) rocks. Yes, the code reaches the sysfatal part and exits. But then I'm wondering how usbd is shown on the ps output?

>
> To look for more clues about what's going wrong:
>
> - try 'ls -d /dev/usb' to see if '#u' is bound in /dev

Assuming that I'm getting some output how can I know if it is correct? Are there any userspace commands to see what is bound where? bind doesn't seem to support listings, only namespace modifications.

> - try 'cat /dev/usb/ctl' to see what the state of your usb interfaces is

The file is empty

> - look in /dev/kmesg to see if there are any boot-time error messages
>   relating to usb

Same message here: `/boot:usbd: /dev/usb: no hubs'

Perhaps it's time to look at the source code of usbd? :)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-21  8:36   ` faif
@ 2011-09-21 10:18     ` Richard Miller
  2011-09-21 18:10       ` Bakul Shah
  2011-09-26  8:42       ` faif
  0 siblings, 2 replies; 15+ messages in thread
From: Richard Miller @ 2011-09-21 10:18 UTC (permalink / raw)
  To: 9fans

>> - try 'ls -d /dev/usb' to see if '#u' is bound in /dev
>
> Assuming that I'm getting some output how can I know if it is correct? Are there any userspace commands to see what is bound where? bind doesn't seem to support listings, only namespace modifications.

ns(1) command shows bindings.

> Perhaps it's time to look at the source code of usbd? :)

I don't think the problem is within usbd.  The 'no hubs' message
really does mean what it says -- it seems the kernel hasn't succeeded
in initialising the usb host interface to the extent where it sees
the built-in hub which usbd needs to enumerate devices.

I think you need input from a qemu expert here -- I've never tried qemu
myself.  What version of qemu are you using, on what OS?  Maybe there's
a trick to configuring usb on qemu, or maybe that version of qemu just
doesn't emulate usb in quite the way that Plan 9 wants to see.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-21 10:18     ` Richard Miller
@ 2011-09-21 18:10       ` Bakul Shah
  2011-09-22  8:32         ` faif
  2011-09-26  8:42       ` faif
  1 sibling, 1 reply; 15+ messages in thread
From: Bakul Shah @ 2011-09-21 18:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> I don't think the problem is within usbd.  The 'no hubs' message
> really does mean what it says -- it seems the kernel hasn't succeeded
> in initialising the usb host interface to the extent where it sees
> the built-in hub which usbd needs to enumerate devices.
>
> I think you need input from a qemu expert here -- I've never tried qemu
> myself.  What version of qemu are you using, on what OS?  Maybe there's
> a trick to configuring usb on qemu, or maybe that version of qemu just
> doesn't emulate usb in quite the way that Plan 9 wants to see.

Haven't used qemu much lately.  There must be plenty of
examples on the web but from what I remember, you have to tell
qemu a few things.

$ qemu -usb -monitor stdio ...

To find vendor/product ids for a device you want, use lsusb on
linux or usbconfig on freebsd.  The host *must not* load any
driver for this device. Tell qemu about it either via command
line with "-usbdevice host:<vendor><product>" or later via its
monitor shell on stdio with "usb_add host:<vendor><product>"



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-21 18:10       ` Bakul Shah
@ 2011-09-22  8:32         ` faif
  0 siblings, 0 replies; 15+ messages in thread
From: faif @ 2011-09-22  8:32 UTC (permalink / raw)
  To: 9fans

Thank you for guiding me to the right path guys. The problem was with qemu which needs special settings (http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu#using_an_usb_device_in_qemu) for recognizing USB devices



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-21 10:18     ` Richard Miller
  2011-09-21 18:10       ` Bakul Shah
@ 2011-09-26  8:42       ` faif
  2011-09-26  9:00         ` Richard Miller
                           ` (3 more replies)
  1 sibling, 4 replies; 15+ messages in thread
From: faif @ 2011-09-26  8:42 UTC (permalink / raw)
  To: 9fans

Hmmm... I'm still missing something. If usb support is fine and usbd
is running, do I need any other commands than 'usbfat:'? The latter
gives the output 'no usb disks found'.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9fans] qemu usb flash drive (stick)
  2011-09-26  8:42       ` faif
@ 2011-09-26  9:00         ` Richard Miller
  2011-11-28  9:38         ` faif
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Richard Miller @ 2011-09-26  9:00 UTC (permalink / raw)
  To: 9fans

Try usb/probe to see what devices are seen to be attached.

Also check on the host system to see if the usb stick is
attached there instead.  You may need to do something to
get the device assigned to qemu instead of to the host system.




^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-09-26  8:42       ` faif
  2011-09-26  9:00         ` Richard Miller
@ 2011-11-28  9:38         ` faif
  2011-11-28 10:06           ` cinap_lenrek at gmx.de
  2011-11-28 13:19           ` erik quanstrom
  2011-11-29 10:15         ` faif
  2011-11-29 10:15         ` faif
  3 siblings, 2 replies; 15+ messages in thread
From: faif @ 2011-11-28  9:38 UTC (permalink / raw)


Back after some (actually a long) idle time... :)

FTR: My host system is GNU/Linux and i found out that apart from unmounting the usb drive I also need to execute qemu with full privileges to make the device available. An example:

>sudo qemu -usb -usbdevice host:0e34:1025 plan9.img

Now... It seems that I have a file permission problem.

usbfat:
/n/sdV0.0

touch /n/sdV0.0/a ... create prohibited

I tried to access the drive both with glenda and the custom user that I added some time ago. ls -l says that the /n/sdV0.0 user is bill and the group trog

Tried to log on as adm but rio fails to start (some settings are missing). I noticed that there is no user bill and group trog in /adm/users. Is this the next step?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-11-28  9:38         ` faif
@ 2011-11-28 10:06           ` cinap_lenrek at gmx.de
  2011-11-28 13:19           ` erik quanstrom
  1 sibling, 0 replies; 15+ messages in thread
From: cinap_lenrek at gmx.de @ 2011-11-28 10:06 UTC (permalink / raw)


dossrv doesnt know about users, bill trog is some
dummy name and probably some inside joke.

the /adm/users file is for fossil/kfs/cwfs and unrelated
to your problem.

usbfat: mounts the device with -c, so creating files
in the root should work on this part.

i'v seen this before and it might be a bug in
dossrv itself on fat32 partitions. it only happend
on the filesystem root directory. run a filesystem
check on the drive with some other operating system.

once followed the exact codepath for that error,
but can't remember.

reformating the drive (with FAT16) fixed the problem.

--
cinap



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-11-28  9:38         ` faif
  2011-11-28 10:06           ` cinap_lenrek at gmx.de
@ 2011-11-28 13:19           ` erik quanstrom
  1 sibling, 0 replies; 15+ messages in thread
From: erik quanstrom @ 2011-11-28 13:19 UTC (permalink / raw)


> Back after some (actually a long) idle time... :)
> 
> FTR: My host system is GNU/Linux and i found out that apart from unmounting the usb drive I also need to execute qemu with full privileges to make the device available. An example:
> 
> >sudo qemu -usb -usbdevice host:0e34:1025 plan9.img
> 
> Now... It seems that I have a file permission problem.
> 
> usbfat:
> /n/sdV0.0
> 
> touch /n/sdV0.0/a ... create prohibited

it appears that you paraphrased the output.  did you type 9fat:
and touch in the same rio window?  that looks like the output
you'd get if there were no mounted disk.

the output of ns(1) would help see what's mounted on /n.

- erik



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-09-26  8:42       ` faif
  2011-09-26  9:00         ` Richard Miller
  2011-11-28  9:38         ` faif
@ 2011-11-29 10:15         ` faif
  2011-11-29 10:15         ` faif
  3 siblings, 0 replies; 15+ messages in thread
From: faif @ 2011-11-29 10:15 UTC (permalink / raw)


Hi Erik,

The output might not be 100% correct since I manually copied it. Using qemu and still investigating how to achieve copy-pasting in the clipboard between guest-host... 

AFAIU you mean that if I mounted the drive on one rio window and tried to do anything with it on another it won't work because of the different namespaces. I think that I used the same rio window for everything but I'll make sure that this is the case.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-09-26  8:42       ` faif
                           ` (2 preceding siblings ...)
  2011-11-29 10:15         ` faif
@ 2011-11-29 10:15         ` faif
  3 siblings, 0 replies; 15+ messages in thread
From: faif @ 2011-11-29 10:15 UTC (permalink / raw)


Thanks cinap, interesting. I'll retry with fat16 and see if the joke still insists :)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [9fans] qemu usb flash drive (stick)
  2011-09-19  8:34 [9fans] qemu usb flash drive (stick) faif
  2011-09-20  9:07 ` faif
@ 2011-11-29 10:16 ` faif
  1 sibling, 0 replies; 15+ messages in thread
From: faif @ 2011-11-29 10:16 UTC (permalink / raw)


OK that was silly. I noticed that instead of /n/sdU0.0 I was typing /n/sdV0.0 Those rio fonts look so alike! And lc /n/sdU0.0 is not complaining so at first I didn't notice that this directory doesn't exist at all :)

Thanks everyone



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-11-29 10:16 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19  8:34 [9fans] qemu usb flash drive (stick) faif
2011-09-20  9:07 ` faif
2011-09-20  9:38   ` Richard Miller
2011-09-21  8:36   ` faif
2011-09-21 10:18     ` Richard Miller
2011-09-21 18:10       ` Bakul Shah
2011-09-22  8:32         ` faif
2011-09-26  8:42       ` faif
2011-09-26  9:00         ` Richard Miller
2011-11-28  9:38         ` faif
2011-11-28 10:06           ` cinap_lenrek at gmx.de
2011-11-28 13:19           ` erik quanstrom
2011-11-29 10:15         ` faif
2011-11-29 10:15         ` faif
2011-11-29 10:16 ` faif

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).