X-Git-Url: http://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fdata%2Fdatapump.c;h=4eede531207c6edc88523fc63a52edb95bacbbee;hp=adb201d6dffdec726387179b029529f0282e460f;hb=0484268a27be1ab830d087847d830bc0ec734016;hpb=975a83d253eea8aa37bf3dfd7e026df3027db4ff diff --git a/common/data/datapump.c b/common/data/datapump.c index adb201d..4eede53 100644 --- a/common/data/datapump.c +++ b/common/data/datapump.c @@ -14,8 +14,6 @@ */ -#include "config.h" - #define __data_datapump_c @@ -29,9 +27,7 @@ #include #include #include -#ifndef UCLINUX #include -#endif #include @@ -47,17 +43,18 @@ 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: