This commit was manufactured by cvs2svn to create tag
[gnokii.git] / common / data / datapump.c
index adb201d..4eede53 100644 (file)
@@ -14,8 +14,6 @@
 
 */
 
-#include "config.h"
-
 #define                __data_datapump_c
 
 
@@ -29,9 +27,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifndef UCLINUX
 #include <sys/poll.h>
-#endif
 #include <unistd.h>
 
 
 extern bool CommandMode;
 
 /* Local variables */
-extern int             PtyRDFD;        /* File descriptor for reading and writing to/from */
-extern int             PtyWRFD;        /* pty interface - only different in debug mode. */ 
-static u8 pluscount;
-static bool connected;
-
-static int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length);
+int            PtyRDFD;        /* File descriptor for reading and writing to/from */
+int            PtyWRFD;        /* pty interface - only different in debug mode. */ 
+struct pollfd ufds;
+u8 pluscount;
+bool connected;
 
 bool DP_Initialise(int read_fd, int write_fd)
 {
        PtyRDFD = read_fd;
        PtyWRFD = write_fd;
+       ufds.fd=PtyRDFD;
+       ufds.events=POLLIN;
        RLP_Initialise(GSM->SendRLPFrame, DP_CallBack);
        RLP_SetUserRequest(Attach_Req,true);
        pluscount=0;
@@ -66,7 +63,7 @@ bool DP_Initialise(int read_fd, int write_fd)
 }
 
 
-static int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
+int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
 {
        int temp;
 
@@ -94,23 +91,15 @@ static int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
        case Reset_Ind:
                RLP_SetUserRequest(Reset_Resp,true);
                break;
-       case GetData: {
-               fd_set readfds;
-               struct timeval timeout;
-
-               FD_ZERO(&readfds);
-               FD_SET(PtyRDFD,&readfds);
-               timeout.tv_sec=0;
-               timeout.tv_usec=0;
-
-               if (select(PtyRDFD+1,&readfds,NULL/*writefds*/,NULL/*exceptfds*/,&timeout)) {
+       case GetData:
+               if (poll(&ufds,1,0)) {
 
                        /* Check if the program has closed */
                        /* Return to command mode */
                        /* Note that the call will still be in progress, */
                        /* as with a normal modem (I think) */
 
-                       if (!FD_ISSET(PtyRDFD,&readfds)) { 
+                       if (ufds.revents!=POLLIN) { 
                                CommandMode=true;
                                /* Set the call passup back to the at emulator */
                                GSM->DialData(NULL,-1,&ATEM_CallPassup);
@@ -148,7 +137,7 @@ static int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
                        return temp;
                }
                return 0;
-               break;
+               break;
 
        default: