uhub2: device problem (was: Bluetooth stack for FreeBSD)

Maksim Yevmenkin m_evmenkin at yahoo.com
Tue May 6 09:45:04 PDT 2003


Hello Bernd

[...]

> > > I know some people collected a lot of debug output and took it to the
> > > current ml, but without much luck or response from the usb specialists
> > > (please correct me if I am wrong here and missed anything). I am a bit
> > > at a loss concerning how to proceed.
> > 
> > well, after looking more into the w2k dumps i put at
> > 
> > http://www.geocities.com/m_evmenkin/usb/
> 
> Which file of these is it?

USB_HUB.LOG - the hub in the docking station is attached to the root hub
BT3C_USB.LOG - 3COM dongle is attached to the hub in the docking station

> I wasn't aware of any available w2k dumps - and FreeBSD dumps only show
> a broken device while I would like to see a workaround.

3COM dongle works fine in w2k and linux, so i got the dumps from w2k to
see if there is obvious workaround. i'm still going though the dumps and
linux USB code trying to understand what is different. 
 
> > i found out that w2k resets USB port twice when new device is attached.
> > why? is it just w2k thing or it is some kind of workaround? any USB guru
> > care to comment?
> 
> That's great news - until now I had no single idea on how to handle
> such broken hardware.
> Sounds like a possible way to go.

well, this "double reset" thing could be a "red herring". it could be the way
windows USB stack works. here is what Anthony Naggs <tony at ubik.demon.co.uk>
said to me

<quote>
This is how the Windows (all flavours) USB stack works: detects device
arrival, signal reset on port, start reading device descriptors to find
out device Class Id, Vendor & Model Id, etc...

Each candidate driver found by the Plug'n'Play system is loaded: the
driver signals another bus reset on the port, reads the device
descriptors itself and decides whether it recognises the device.  This
continues until a driver recognises the device as one it supports, or
all candidates drivers have been tried.
</quote> 

here is the list of things on top of my head:

1) in w2k dumps i noticed that w2k checks USB port status after reset, 
   i.e. the sequence is

   - set port feature RESET
   - check port status
   - clear port feature RESET
   - check port status

2) in linux code the hub interrupt transfer buffer is defined as

   #define USB_MAXCHILDREN         (16)
  
   char buffer[(USB_MAXCHILDREN + 1 + 7) / 8];
   /* add 1 bit for hub status change */
   /* and add 7 bits to round up to byte boundary */

   where in FreeBSD code

   u_int8_t sc_status[1]; /* XXX more ports */

3) in linux code there are some quirks for PIIX4

/*
 * PIIX4 ACPI: Two IO regions pointed to by longwords at
 *      0x40 (64 bytes of ACPI registers)
 *      0x90 (32 bytes of SMB registers)
 */
static void __init quirk_piix4_acpi(struct pci_dev *dev)
{
        u32 region;

        pci_read_config_dword(dev, 0x40, &region);
        quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
        pci_read_config_dword(dev, 0x90, &region);
        quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
}

of course everything above could be irrelevant. i now have another USB
device (Belkin USB dognle) that works just fine with FreeBSD. it does not
matter if i plug it directly into the laptop or in the hub in the docking
station. i now have two datapoints for FreeBSD:

1) 3COM USB dongle (with CSR chip) - does not work in the docking station,
   but works if i plug it directly into the laptop

2) Belkin USB dongle (with Broadcom chip) - works in both configurations

this soft of points to the device itself. but still does not explain why
the device works in w2k and linux.

> Once I know which file to look into (a pointer to a line number would be
> nice too :) I will check on how to implement this workaround.

USB hub port #2, line 338 (URB 14 going down) 
USB hub port #2, line 461 (URB 19 going down)

these dumps are pretty easy to read, but i needed little "memory extension" 
in a form of pencil and paper :)

thanks,
max

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


More information about the freebsd-mobile mailing list