*/
-#include "config.h"
-
#define __data_datapump_c
#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;
}
-static int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
+int DP_CallBack(RLP_UserInds ind, u8 *buffer, int length)
{
int temp;
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);
return temp;
}
return 0;
- } break;
+ break;
default: