libqcdm,tests: fix qcdm_send method for wwan
The qcdm wwan device does not cope well with writing single bytes, while it does not have any issue if longer chunks are written. Fix qcdm_send accordingly, since it should not hurt the previously supported devices. Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
This commit is contained in:
committed by
Dan Williams
parent
cc29b5dac2
commit
a838d3b98f
@@ -95,16 +95,16 @@ qcdm_send (int fd, char *buf, size_t len)
|
|||||||
|
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
status = write (fd, &buf[i], 1);
|
status = write (fd, &buf[i], len - i);
|
||||||
if (status < 0) {
|
if (status <= 0) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN || status == 0) {
|
||||||
eagain_count--;
|
eagain_count--;
|
||||||
if (eagain_count <= 0)
|
if (eagain_count <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
assert (errno == 0);
|
assert (errno == 0);
|
||||||
} else
|
} else
|
||||||
i++;
|
i += status;
|
||||||
|
|
||||||
usleep (1000);
|
usleep (1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,16 +95,16 @@ qcdm_send (int fd, char *buf, size_t len)
|
|||||||
|
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
status = write (fd, &buf[i], 1);
|
status = write (fd, &buf[i], len - i);
|
||||||
if (status < 0) {
|
if (status <= 0) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN || status == 0) {
|
||||||
eagain_count--;
|
eagain_count--;
|
||||||
if (eagain_count <= 0)
|
if (eagain_count <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
assert (errno == 0);
|
assert (errno == 0);
|
||||||
} else
|
} else
|
||||||
i++;
|
i += status;
|
||||||
|
|
||||||
usleep (1000);
|
usleep (1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,16 +96,16 @@ qcdm_send (int fd, char *buf, size_t len)
|
|||||||
|
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
status = write (fd, &buf[i], 1);
|
status = write (fd, &buf[i], len - i);
|
||||||
if (status < 0) {
|
if (status <= 0) {
|
||||||
if (errno == EAGAIN) {
|
if (errno == EAGAIN || status == 0) {
|
||||||
eagain_count--;
|
eagain_count--;
|
||||||
if (eagain_count <= 0)
|
if (eagain_count <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
assert (errno == 0);
|
assert (errno == 0);
|
||||||
} else
|
} else
|
||||||
i++;
|
i += status;
|
||||||
|
|
||||||
usleep (1000);
|
usleep (1000);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user