Re: Help with debugging no-callback problem with IrDA USB dongle

Alex Villací­s Lasso <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Alan Stern escribió:
> On Tue, 1 May 2007 [email protected] wrote:
>
>   
>> After a big delay, I am now trying to write a driver for my USB-to-Irda
>> dongle.
>> This device reports the following in lsusb:
>>
>> Bus 002 Device 002: ID 07c0:4200 Code Mercenaries Hard- und Software GmbH
>> Device Descriptor:
>>   bLength                18
>>   bDescriptorType         1
>>   bcdUSB               1.10
>>     
>
> What version of the Linux kernel are you using?  If you turn on
> CONFIG_USB_DEBUG, what shows up in the dmesg log?
>
>   
All of this was tested with vanilla 2.6.21 from kernel.org. I will try 
enabling CONFIG_USB_DEBUG when I get home.
>> submit the interrupt urbs for either endpoint in the driver code, my callback
>> code never gets called at all - not even to signal an error while
>> submitting the
>> urb.
>>     
>
> That never happens.  The callback routine is invoked when the URB
> completes, and if the submission failed then the URB wasn't accepted so of
> course it can never complete.
>
>   
Hmm... I was under the impression that if usb_submit_urb() returned 0, 
then the callback routine would eventually get called, either because it 
completed, or because an error occurred in submission - such as a timeout.
>> However, when the irda0 network interface is brought down manually
>> (ifconfig irda0 down), I do get calls to my callbacks, with errors
>> corresponding
>> to the device being shut down. I have a suspicion that this is caused by the
>> required urb teardown in kingsun_net_close.
>>
>> Here is a dump of usbmon when my driver takes control of the dongle:
>>
>> Plugin of the dongle:
>>
>> ddf58140 410742248 C Ii:001:01 0 1 = 02
>> ddf58140 410742276 S Ii:001:01 -115 2 <
>> cb8ebb40 410793172 S Ci:001:00 s a3 00 0000 0001 0004 4 <
>> cb8ebb40 410793182 C Ci:001:00 0 4 = 01030100
>>     
>
> So this is a low-speed device, right?
>
>   
Yes.
> ...
>   
>> da870b40 411151178 S Ci:007:00 s 80 06 0302 0409 00ff 255 <
>> da870b40 416154270 C Ci:007:00 -2 24 = 18035500 53004200 20007400 6f002000
>> 49007200 64006100
>>     
>
> This shouldn't happen!  Reception of a short message should never fail 
> with a timeout.  Something must be wrong with your host controller or its 
> driver.  The dmesg log might provide a clue.
>
> ...
>   
>> da87f140 421243731 S Co:007:00 s 00 09 0001 0000 0000 0
>> da87f140 421246338 C Co:007:00 0 0
>>     
>
> Apparently your driver doesn't send anything to the device when it is 
> probed.
>
>   
The stir4200 driver also doesn't do anything to the device, other than 
usb_reset_configuration(). What kind of operation might be necessary to 
do at the probe function?
>> ifconfig irda0 up
>>
>> da87fec0 474705925 S Co:007:00 s 02 01 0000 0081 0000 0
>> da87fec0 474708443 C Co:007:00 0 0
>> da87fec0 474708548 S Co:007:00 s 02 01 0000 0002 0000 0
>> da87fec0 474711422 C Co:007:00 0 0
>>     
>
> Why does your driver bother to do a Clear-Halt?  It should not be needed.
>
>   
Again, because stir4200 does it and I was taking it as one of the models 
for writing my driver. I thought this was a required part of the setup. 
I will try removing it at home and see if it makes any difference.
>> da87fec0 474711537 S Ii:007:01 -115 8 <
>> da870b40 475671204 S Io:007:02 -115 30 = ffffffff ffffffff ffffffff
>> c0ff3f01 c5257160 ffffffff 01000064 d2c1
>>
>> ifconfig irda0 down
>>
>> da870b40 533710546 C Io:007:02 -2 0
>> da87fec0 533711539 C Ii:007:01 -2 0
>>
>> Please notice that usbmon does log the IrDA discovery packet (the one that
>> starts with ffffffff), only my code does not get called for any response
>> on the
>> send.
>>     
>
> It gets logged because your driver submitted the URB to be sent.  The 
> completion handler doesn't get called because the device never accepted 
> the data.
>
> Like Oliver said, you probably need to do some sort of initialization of 
> the device before it will start working.
>
> Alan Stern
>
>   
Maybe, but I could not find any evidence of such an initialization 
sequence in the SnoopyPro dump done under Windows XP (attached). I 
deduced that no initialization sequence was needed. So, I am not looking 
hard enough, or SnoopyPro is buggy / hides information from me.

-- 
perl -e '$x = 2.4; print sprintf("%.0f + %.0f = %.0f\n", $x, $x, $x + $x);'

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
DS620_2_p_trim.xml.bz2 (application/x-bzip2, 51.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.