aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Busch <morphis@gravedo.de>2012-01-24 18:14:00 +0100
committerSimon Busch <morphis@gravedo.de>2012-01-24 18:14:00 +0100
commit4a65fbd958fe2f88db8973768bde5f824dee3272 (patch)
tree9ff26a1e2de2e3665e5f0260028e299ca1ac7277 /tools
parent1122ae786d5f51fc6f7cf367306e1c1493ded7c3 (diff)
downloadexternal_libsamsung-ipc-4a65fbd958fe2f88db8973768bde5f824dee3272.zip
external_libsamsung-ipc-4a65fbd958fe2f88db8973768bde5f824dee3272.tar.gz
external_libsamsung-ipc-4a65fbd958fe2f88db8973768bde5f824dee3272.tar.bz2
tools: forward: use modem_io structure to determine size of data we read
Signed-off-by: Simon Busch <morphis@gravedo.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/forward.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/forward.c b/tools/forward.c
index 822d986..cf0eb78 100644
--- a/tools/forward.c
+++ b/tools/forward.c
@@ -37,6 +37,13 @@
#define IOCTL_MODEM_SEND _IO('o', 0x23)
#define IOCTL_MODEM_RECV _IO('o', 0x24)
+struct modem_io {
+ uint32_t size;
+ uint32_t id;
+ uint32_t cmd;
+ void *data;
+};
+
void forward_data(int modem_fd, int remote_fd)
{
fd_set rfds;
@@ -57,9 +64,10 @@ void forward_data(int modem_fd, int remote_fd)
}
else if (rc) {
if (FD_ISSET(modem_fd, &rfds)) {
- ssize_t size = ioctl(modem_fd, IOCTL_MODEM_RECV, &buf);
+ rc = ioctl(modem_fd, IOCTL_MODEM_RECV, &buf);
if (rc < 0)
break;
+ ssize_t size = ((struct modem_io*) &buf)->size;
printf("Sending from modem %ld\n", size);
ssize_t written = write(remote_fd, &buf, size);
}