9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Lonnie Mendez <lmendez19@austin.rr.com>
To: 9fans@cse.psu.edu
Subject: [9fans] problem with usbd (hub.c) and qemu
Date: Thu,  4 May 2006 18:30:30 -0500	[thread overview]
Message-ID: <445A8E96.7040203@austin.rr.com> (raw)

   I had a go with qemu, plan9, and usb again.  This time it's 
progressing much farther except another wall has been hit.  usbstart got 
things going up to a certain point.  Running /bin/usb/usbd -d yielded 
this information:

usbd: usb0/0.1: hub 1 attached
pdesc 1.-1 [10]
desc 1.-1 [9] 0x29: nport 8 charac 0x000a pwr 2ms current 0mA remov 0x00
usbd: hub descriptor too small
%

   To me qemu's hub descriptor size calculation is sane.  Looking at

http://cm.bell-labs.com/sources/plan9/sys/src/cmd/usb/usbd/hub.c:newhub()

    pdesc(d, -1, -1, buf, nr);
    dd = (DHub*)buf;
    nport = dd->bNbrPorts;
    nmap = 1 + nport/8;
    if(nr < 7 + 2*nmap) {
        fprint(2, "usbd: hub descriptor too small\n");
        free(h);
        return nil;
    }

   the hub size for a hub with 8+ ports isn't being calculated 
correctly.  In this instance for a hub with 8 ports the code expects 11 
bytes when the hub descriptor size is 10 bytes.  Please see usb_20 
11.23.2.1 or usb11 11.15.2 concerning DeviceRemovable and 
PortPwrCtrlMask.  Source for the qemu hub is located here:

http://cvs.savannah.nongnu.org/viewcvs/qemu/hw/usb-hub.c?rev=1.3&root=qemu&view=markup

   usb_hub_handle_control() - switch case GetHubDescriptor


             reply	other threads:[~2006-05-04 23:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 23:30 Lonnie Mendez [this message]
2006-05-05 14:31 ` Lonnie Mendez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=445A8E96.7040203@austin.rr.com \
    --to=lmendez19@austin.rr.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).