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) {
|
||||
errno = 0;
|
||||
status = write (fd, &buf[i], 1);
|
||||
if (status < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
status = write (fd, &buf[i], len - i);
|
||||
if (status <= 0) {
|
||||
if (errno == EAGAIN || status == 0) {
|
||||
eagain_count--;
|
||||
if (eagain_count <= 0)
|
||||
return FALSE;
|
||||
} else
|
||||
assert (errno == 0);
|
||||
} else
|
||||
i++;
|
||||
i += status;
|
||||
|
||||
usleep (1000);
|
||||
}
|
||||
|
||||
@@ -95,16 +95,16 @@ qcdm_send (int fd, char *buf, size_t len)
|
||||
|
||||
while (i < len) {
|
||||
errno = 0;
|
||||
status = write (fd, &buf[i], 1);
|
||||
if (status < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
status = write (fd, &buf[i], len - i);
|
||||
if (status <= 0) {
|
||||
if (errno == EAGAIN || status == 0) {
|
||||
eagain_count--;
|
||||
if (eagain_count <= 0)
|
||||
return FALSE;
|
||||
} else
|
||||
assert (errno == 0);
|
||||
} else
|
||||
i++;
|
||||
i += status;
|
||||
|
||||
usleep (1000);
|
||||
}
|
||||
|
||||
@@ -96,16 +96,16 @@ qcdm_send (int fd, char *buf, size_t len)
|
||||
|
||||
while (i < len) {
|
||||
errno = 0;
|
||||
status = write (fd, &buf[i], 1);
|
||||
if (status < 0) {
|
||||
if (errno == EAGAIN) {
|
||||
status = write (fd, &buf[i], len - i);
|
||||
if (status <= 0) {
|
||||
if (errno == EAGAIN || status == 0) {
|
||||
eagain_count--;
|
||||
if (eagain_count <= 0)
|
||||
return FALSE;
|
||||
} else
|
||||
assert (errno == 0);
|
||||
} else
|
||||
i++;
|
||||
i += status;
|
||||
|
||||
usleep (1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user