Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 85692 Details for
Bug 131603
app-mobilephone/obexftp hangs when sending file to Sony Ericsson z520 over usb cable using cdc_acm
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
obexftp-cablewriteretry.patch
obexftp-cablewriteretry.patch (text/plain), 2.64 KB, created by
Simon Ruggier
on 2006-04-28 13:20:52 UTC
(
hide
)
Description:
obexftp-cablewriteretry.patch
Filename:
MIME Type:
Creator:
Simon Ruggier
Created:
2006-04-28 13:20:52 UTC
Size:
2.64 KB
patch
obsolete
>--- obexftp-0.19/multicobex/multi_cobex.c 2005-11-24 09:55:11.000000000 -0500 >+++ obexftp-0.19/multicobex/multi_cobex_new.c 2006-04-28 15:44:11.000000000 -0400 >@@ -126,7 +126,7 @@ int cobex_disconnect(obex_t *self, void > /* Called from OBEX-lib when data needs to be written */ > int cobex_write(obex_t *self, void *data, uint8_t *buffer, int length) > { >- int actual; >+ int written; > cobex_t *c; > return_val_if_fail (self != NULL, -1); > return_val_if_fail (data != NULL, -1); >@@ -137,24 +137,46 @@ int cobex_write(obex_t *self, void *data > DEBUG(3, "%s() Data %d bytes\n", __func__, length); > > if (c->type == CT_ERICSSON || c->type == CT_SIEMENS) { >- actual = write(c->fd, buffer, length); >- if (actual < length) { >- DEBUG(1, "Error writing to port (%d expected %d)\n", actual, length); >- return actual; /* or -1? */ >+ written = write(c->fd, buffer, length); >+ if (written < length) >+ { >+ DEBUG(1, "Error writing to port: %d written, expected %d; retrying...\n", written, length); >+ int i, retval=-1, oldretval, fail = 0; >+ for (i = 0;written < length;++i) >+ { >+ usleep(1); // This mysteriously avoids a resource not available error on write() >+ oldretval = retval; >+ retval = write(c->fd, buffer+written, length-written); >+ if (retval < 0) >+ { >+ DEBUG(1, "%sError writing to port: %s\n", oldretval>=0?"\n":"",strerror(errno)); >+ ++fail; >+ if (fail == 100) // to avoid infinite looping if something is really wrong >+ { >+ return written; >+ } >+ } >+ else >+ { >+ written += retval; >+ DEBUG(1, "Wrote %d bytes out of %d in %d retries%s\r", written,length, i+1, written==length?" - success!\n":""); >+ } >+ } > } >- return actual; >+ >+ return written; > } > > if (c->seq == 0){ >- actual = bfb_send_first(c->fd, buffer, length); >- DEBUG(2, "%s() Wrote %d first packets (%d bytes)\n", __func__, actual, length); >+ written = bfb_send_first(c->fd, buffer, length); >+ DEBUG(2, "%s() Wrote %d first packets (%d bytes)\n", __func__, written, length); > } else { >- actual = bfb_send_next(c->fd, buffer, length, c->seq); >- DEBUG(2, "%s() Wrote %d packets (%d bytes)\n", __func__, actual, length); >+ written = bfb_send_next(c->fd, buffer, length, c->seq); >+ DEBUG(2, "%s() Wrote %d packets (%d bytes)\n", __func__, written, length); > } > c->seq++; > >- return actual; >+ return written; > } > > /* Called when input data is needed */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 131603
:
85692
|
85693
|
85695
|
85776