Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 131603 - app-mobilephone/obexftp hangs when sending file to Sony Ericsson z520 over usb cable using cdc_acm
Summary: app-mobilephone/obexftp hangs when sending file to Sony Ericsson z520 over us...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Andrej Kacian (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-28 13:19 UTC by Simon Ruggier
Modified: 2006-05-05 23:08 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
obexftp-cablewriteretry.patch (obexftp-cablewriteretry.patch,2.64 KB, patch)
2006-04-28 13:20 UTC, Simon Ruggier
Details | Diff
obexftp-0.18.ebuild (obexftp-0.18.ebuild,1.23 KB, text/plain)
2006-04-28 13:22 UTC, Simon Ruggier
Details
obexftp-0.19.ebuild (obexftp-0.19.ebuild,1.27 KB, text/plain)
2006-04-28 13:23 UTC, Simon Ruggier
Details
obexftp-0.19-cobex_write.patch (obexftp-0.19-cobex_write.patch,2.24 KB, patch)
2006-04-29 11:19 UTC, Alin Năstac (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Ruggier 2006-04-28 13:19:29 UTC
I had trouble sending files to my phone where it would hang at the 'Sending "<file>".../' line, so I tracked down the issue and wrote a patch for it.

It looks like one could consider this a workaround for fixing the relevant driver itself ( I haven't bothered to figure this out), but my patch just adds a retry loop to the function that writes data to the cable driver, which was failing because the write() call was only writing part of what was requested.  Should be completely safe from infinite looping, but if I'm wrong (say write perpetually returns 0, if that's even possible), the results are not catastrophic by any means, because there's a usleep(1) call in the loop as part of the workaround.  So in short, applying this patch can only be good, and may perhaps fix issues with more than just my specific model of phone.
Comment 1 Simon Ruggier 2006-04-28 13:20:52 UTC
Created attachment 85692 [details, diff]
obexftp-cablewriteretry.patch

This will apply cleanly to 0.18 as well as 0.19
Comment 2 Simon Ruggier 2006-04-28 13:22:51 UTC
Created attachment 85693 [details]
obexftp-0.18.ebuild
Comment 3 Simon Ruggier 2006-04-28 13:23:31 UTC
Created attachment 85695 [details]
obexftp-0.19.ebuild
Comment 4 Alin Năstac (RETIRED) gentoo-dev 2006-04-29 08:32:32 UTC
100 tries seems a bit much and also you didn't took into account the fact that write() could always return 0 (which IMO is an error by itself). 
I will change the patch in such way to abort after 3 _consecutive_ errors. That sounds OK?
Comment 5 Simon Ruggier 2006-04-29 10:22:04 UTC
(In reply to comment #4)
> 100 tries seems a bit much and also you didn't took into account the fact that
> write() could always return 0 (which IMO is an error by itself). 
> I will change the patch in such way to abort after 3 _consecutive_ errors. That
> sounds OK?
> 

The reason I set it to 100 was to make sure that transfers don't fail because of "Resource temporarily unavailable" errors, which is quite possible if the fail threshold is less than 5 errors.  Making it consecutive would alleviate that issue, but I don't think making the number high is a problem, cause worst case, the loop would run for less than 5 secs if it encountered 100 write() errors (based on my highly unscientific observations), and this is an unlikely circumstance.  I tried to unplug my phone during a transfer a few times to trigger it, and it didn't happen, the connection was terminated and obexftp promptly closed.  Also, failing this, there still is the option for the user to send an interrupt to the program, which would terminate it immediately.  Even if you make it keep track of consecutive errors, which is a good thing, my opinion is that the fail threshold should be set significantly higher than 3.
Comment 6 Alin Năstac (RETIRED) gentoo-dev 2006-04-29 11:19:53 UTC
Created attachment 85776 [details, diff]
obexftp-0.19-cobex_write.patch

Please try this patch.
Comment 7 Alin Năstac (RETIRED) gentoo-dev 2006-05-02 01:04:03 UTC
well, does it work for you?
Comment 8 Simon Ruggier 2006-05-03 08:41:28 UTC
Hey, sorry about the delay, I've been busy in the past few days, moving to school, etc., and haven't checked my email.  I'll try to remember to try it tonight.
Comment 9 Simon Ruggier 2006-05-04 13:53:20 UTC
Seems to work, which I would expect, given its similarity to the original working patch.  I've tested a 9kB HTML file as well as a 3888kB file.
Comment 10 Alin Năstac (RETIRED) gentoo-dev 2006-05-05 23:08:34 UTC
fixed in 0.19-r1.
thanks!