Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Aug 2005 12:12:55 -0700
From:      Maksim Yevmenkin <maksim.yevmenkin@gmail.com>
To:        hselasky@c2i.net
Cc:        Julian Elischer <julian@elischer.org>, freebsd-usb@freebsd.org
Subject:   Re: weird usb problem
Message-ID:  <bb4a86c70508091212613b10b@mail.gmail.com>
In-Reply-To: <200508092040.50084.hselasky@c2i.net>
References:  <bb4a86c7050808140175d0134a@mail.gmail.com> <200508090156.09985.hselasky@c2i.net> <bb4a86c70508091026565ddcd1@mail.gmail.com> <200508092040.50084.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[...]

> > > From a quick glimpse, you need to add something like
> > >
> > > "ehci_pcd(sc, sc->sc_intrxfer);" after "ehci_pcd_able(sc, 1);".
> > >
> > > In the middle you have to add something like this:
> > >
> > >         /* acknowledge any PCD interrupt */
> > >         EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_PCD);
> > >
> > > Just look at the code in my USB driver, and if it fixes the problem, =
just
> > > backport it.
> >
> > well, i tried a naive thing like this
> >
> > beetle% diff -u10 ehci.c.orig ehci.c
> > --- ehci.c.orig Sat May 28 21:42:27 2005
> > +++ ehci.c      Tue Aug  9 09:53:13 2005
> > @@ -632,20 +632,21 @@
> >                 sc->sc_eintrs &=3D ~EHCI_STS_PCD;
> >         EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
> >  }
> >
> >  void
> >  ehci_pcd_enable(void *v_sc)
> >  {
> >         ehci_softc_t *sc =3D v_sc;
> >
> >         ehci_pcd_able(sc, 1);
>=20
> You need to clear the PCD interrupt bit here, because it is possibly stil=
l
> set, and enabling bits in the interrupt mask does not generate another
> interrupt!
>=20
>          /* acknowledge any PCD interrupt */
>          EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_PCD);
>=20
> > +       ehci_pcd(sc, sc->sc_intrxfer);
> >  }

oops, my bad. i did not realize i have to use  EHCI_USBSTS and not
EHCI_USBINTR (as in ehci_pcd_able()), so the diff  looks like

beetle% diff -u10 ehci.c.orig ehci.c
--- ehci.c.orig Sat May 28 21:42:27 2005
+++ ehci.c      Tue Aug  9 11:47:17 2005
@@ -632,20 +632,25 @@
                sc->sc_eintrs &=3D ~EHCI_STS_PCD;
        EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
 }
=20
 void
 ehci_pcd_enable(void *v_sc)
 {
        ehci_softc_t *sc =3D v_sc;
=20
        ehci_pcd_able(sc, 1);
+
+       /* acknowledge any PCD interrupt */
+       EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_PCD);
+
+       ehci_pcd(sc, sc->sc_intrxfer);
 }
=20
 void
  ehci_pcd(ehci_softc_t *sc, usbd_xfer_handle xfer)
 {
        usbd_pipe_handle pipe;
        u_char *p;
        int i, m;
=20
        if (xfer =3D=3D NULL) {

=3D=3D

does it look right to you?

> > other usb slots are connected to the uhub5 ports 2 to 4 and the usb
> > 2.0 device is _not_ working when plugged into these slots.
> >
> > usb 1.0 devices work in every usb slot.
>=20
> If you have got your source tree in another directory, which makes instal=
ling
> to "/usr/src" difficult, you can set the variable "S" in the Makefile to =
that
> director and it will install there.
>=20
> Do like this:
>=20
> sysctl hw.usb.ehci.debug=3D15
>=20
> Then plug your device.
>=20
> sysctl hw.usb.ehci.debug=3D0
>=20
> If you see a pcd change message your device is detected. But just watch a=
nd
> you will see that it stops interrupting.
>=20
> The problem is the same with OHCI.

ok, i have tried this and  *nothing* happened when i plug the usb 2.0
device. no debug output whatsoever.

so, i started looking at my usb 2.0 device, and guess what. the
frigging usb connector on my usb 2.0 jump drive device is a about 2-3
millimeters short than on my other usb devices!!! also there is a
little bit of extra plastic molding around usb socket, so there was no
electrical connection!!!

i just got an usb extension cable with _proper_sized_ usb plug and
tried it, and it just worked. i will make a clean build without any
ehci(4) changes to see if the problem still there.

thanks,
max



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bb4a86c70508091212613b10b>