summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/host/osmocon/osmocon.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
index 10662917..648d4164 100644
--- a/src/host/osmocon/osmocon.c
+++ b/src/host/osmocon/osmocon.c
@@ -655,13 +655,24 @@ static int handle_write_dnload(void)
static int handle_sercomm_write(void)
{
- uint8_t c;
+ uint8_t buffer[256];
+ int i, count = 0, end = 0;
- if (sercomm_drv_pull(&c) != 0) {
- if (write(dnload.serial_fd.fd, &c, 1) != 1)
+ for (i = 0; i < sizeof(buffer); i++) {
+ if (sercomm_drv_pull(&buffer[i]) == 0) {
+ end = 1;
+ break;
+ }
+ count++;
+ }
+
+ if (count) {
+ if (write(dnload.serial_fd.fd, buffer, count) != count)
perror("short write");
- } else
- dnload.serial_fd.when &= ~BSC_FD_WRITE;
+ }
+
+ if (end)
+ dnload.serial_fd.when &= ~BSC_FD_WRITE;
return 0;
}
@@ -1154,13 +1165,13 @@ static int serial_read(struct osmo_fd *fd, unsigned int flags)
if (flags & BSC_FD_READ) {
switch (dnload.mode) {
case MODE_ROMLOAD:
- rc = handle_read_romload();
+ while ((rc = handle_read_romload()) > 0);
break;
case MODE_MTK:
- rc = handle_read_mtk();
+ while ((rc = handle_read_mtk()) > 0);
break;
default:
- rc = handle_read();
+ while ((rc = handle_read()) > 0);
break;
}
if (rc == 0)