On Thu, Dec 12, 2002 at 01:44:21PM -0500, Johannes Erdfelt wrote: > On Thu, Dec 12, 2002, Oliver Kurth <[EMAIL PROTECTED]> wrote: > > I am currently trying to write a driver for a wireless usb adapter. There > > already is a driver existing, but it is buggy, the code is messy, and > > so I do not even want to try to fix it. So I thought this is a good > > opportunity to learn writing device drivers. > > > > The driver needs to load a (propritary) firmware to the device. I do > > this in the probe() function, and the first part of it works. After > > downloading, it has to call usb_reset_device() (at least the old > > driver does). When I do this, the driver hangs. > > > > Before the reset, there are a lot of calls to usb_control_msg(), all > > of them work as expected. Then it sleeps for 2 seconds, using > > > > set_current_state(TASK_INTERRUPTIBLE); > > schedule_timeout(2*HZ); > > > > Shortly after that, usb_reset_device() is called, and it hangs. > > > > I haven't set any locks. > > By "it", do you mean the device or the kernel?
Neither, it is the driver and the usb subsystem. I can still work (and
write mail ;-)). The driver gives a lot of debugging information, I look
at it the through /var/log/kern.log, but at the reset it stops. It should
give a message after the reset, but that does not happen.
Well, I cannot say if the _device_ hangs. I need the firmware upload
before I can do anything with it. Furthermore, the fw is divided in two
parts, the second part should be uploaded after the reset, but I never get
That far.
I also tried to live without a reset, but in that case I get timeouts
or EPIPE on each usb_control_msg().
For more developing on the driver the system is unusable until the next
reboot. Eg. another insmod hangs in D state.
After unplugging the device, I get these errors:
Dec 12 20:26:06 blue kernel: uhci.c: root-hub INT complete: port1: 48a port2: 495
data: 2
Dec 12 20:26:37 blue last message repeated 121 times
Dec 12 20:27:38 blue last message repeated 244 times
Dec 12 20:28:39 blue last message repeated 244 times
Dec 12 20:29:40 blue last message repeated 244 times
Dec 12 20:30:41 blue last message repeated 244 times
Dec 12 20:31:11 blue last message repeated 123 times
Dec 12 20:31:12 blue kernel: uhci.c: uhci_result_control() failed with status 440000
Dec 12 20:31:12 blue kernel: [df1530c0] link (1f153062) element (17208000)
Dec 12 20:31:12 blue kernel: 0: [d7208000] link (17208030) e0 Stalled CRC/Timeo
Length=7 MaxLen=7 DT0 EndPt=0 Dev=6, PID=2d(SETUP) (buf=082718c0)
Dec 12 20:31:12 blue kernel: 1: [d7208030] link (17208060) e3 SPD Active Length=0
MaxLen=7 DT1 EndPt=0 Dev=6, PID=69(IN) (buf=07884000)
Dec 12 20:31:12 blue kernel: 2: [d7208060] link (17208090) e3 SPD Active Length=0
MaxLen=7 DT0 EndPt=0 Dev=6, PID=69(IN) (buf=07884008)
Dec 12 20:31:12 blue kernel: 3: [d7208090] link (172080c0) e3 SPD Active Length=0
MaxLen=7 DT1 EndPt=0 Dev=6, PID=69(IN) (buf=07884010)
Dec 12 20:31:12 blue kernel: 4: [d72080c0] link (172080f0) e3 SPD Active Length=0
MaxLen=7 DT0 EndPt=0 Dev=6, PID=69(IN) (buf=07884018)
Dec 12 20:31:12 blue kernel: 5: [d72080f0] link (17208120) e3 SPD Active Length=0
MaxLen=7 DT1 EndPt=0 Dev=6, PID=69(IN) (buf=07884020)
Dec 12 20:31:12 blue kernel: 6: [d7208120] link (17208150) e3 SPD Active Length=0
MaxLen=7 DT0 EndPt=0 Dev=6, PID=69(IN) (buf=07884028)
Dec 12 20:31:12 blue kernel: 7: [d7208150] link (17208180) e3 SPD Active Length=0
MaxLen=7 DT1 EndPt=0 Dev=6, PID=69(IN) (buf=07884030)
Dec 12 20:31:12 blue kernel: 8: [d7208180] link (172081b0) e3 SPD Active Length=0
MaxLen=7 DT0 EndPt=0 Dev=6, PID=69(IN) (buf=07884038)
Dec 12 20:31:12 blue kernel: 9: [d72081b0] link (172081e0) e3 SPD Active Length=0
MaxLen=7 DT1 EndPt=0 Dev=6, PID=69(IN) (buf=07884040)
Dec 12 20:31:12 blue kernel: 10: [d72081e0] link (17208210) e3 SPD Active Length=0
MaxLen=7 DT0 EndPt=0 Dev=6, PID=69(IN) (buf=07884048)
Dec 12 20:31:12 blue kernel: [skipped 22 active TD's]
Dec 12 20:31:12 blue kernel: 33: [d7208630] link (00000001) e3 IOC Active Length=0
MaxLen=7ff DT1 EndPt=0 Dev=6, PID=e1(OUT) (buf=00000000)
Dec 12 20:31:12 blue kernel:
Dec 12 20:31:12 blue kernel: usbdevfs: USBDEVFS_CONTROL failed dev 6 rqt 128 rq 6 len
256 ret -110
Dec 12 20:31:12 blue kernel: uhci.c: root-hub INT complete: port1: 48a port2: 495
data: 2
Dec 12 20:31:12 blue kernel: uhci.c: uhci_result_control() failed with status 440000
and so on...
> > Where do I have to search for the problem? Is it the device (maybe
> > the firmware isn't uploaded correctly (though I have checked
> > repeatedly)). BTW, is it true that the 'data' argument in usb_control_msg()
> > has to point to kmalloc'ed memory? I previously used static memory, but I
> > got problems.
>
> It needs to be DMA capable memory. That happens to be most commonly
> memory obtained from kmalloc().
I see. I do not see that documented anywhere, but a comment in another
driver gave me a hint.
> > I am searching for two full days now...
> >
> > I am using the uhci driver, kernel 2.4.20, same probs with 2.4.19.
Greetings,
Oliver
--
Oh my, the stars!
me, first time I stared at the night sky with my new contact lenses
msg09972/pgp00000.pgp
Description: PGP signature
