aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/devices/aries/aries.c
diff options
context:
space:
mode:
Diffstat (limited to 'samsung-ipc/devices/aries/aries.c')
-rw-r--r--samsung-ipc/devices/aries/aries.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c
index c285ba6..321a982 100644
--- a/samsung-ipc/devices/aries/aries.c
+++ b/samsung-ipc/devices/aries/aries.c
@@ -623,11 +623,14 @@ int aries_write(void *data, const void *buffer, size_t length)
return rc;
}
-int aries_poll(void *data, struct timeval *timeout)
+int aries_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout)
{
struct aries_transport_data *transport_data;
- fd_set fds;
+ fd_set set;
int fd;
+ int fd_max;
+ unsigned int i;
+ unsigned int count;
int rc;
if (data == NULL)
@@ -639,10 +642,36 @@ int aries_poll(void *data, struct timeval *timeout)
if (fd < 0)
return -1;
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
+ FD_ZERO(&set);
+ FD_SET(fd, &set);
+
+ fd_max = fd;
+
+ if (fds != NULL && fds->fds != NULL && fds->count > 0) {
+ for (i = 0; i < fds->count; i++) {
+ if (fds->fds[i] >= 0) {
+ FD_SET(fds->fds[i], &set);
+
+ if (fds->fds[i] > fd_max)
+ fd_max = fds->fds[i];
+ }
+ }
+ }
+
+ rc = select(fd_max + 1, &set, NULL, NULL, timeout);
+
+ if (fds != NULL && fds->fds != NULL && fds->count > 0) {
+ count = fds->count;
- rc = select(fd + 1, &fds, NULL, NULL, timeout);
+ for (i = 0; i < fds->count; i++) {
+ if (!FD_ISSET(fds->fds[i], &set)) {
+ fds->fds[i] = -1;
+ count--;
+ }
+ }
+
+ fds->count = count;
+ }
return rc;
}