serial_read first-time-read issue fixed + added a basic README

This commit is contained in:
Thomas Bertani 2012-08-19 09:54:54 +02:00
parent 3122de719f
commit 5c3794a3b3
2 changed files with 9 additions and 3 deletions

7
README
View File

@ -0,0 +1,7 @@
* ot290-gsmtap
This is a command line utility which reads the trace frames sent by the Sagem OT-290 trough the serial line and forwards the GSM L2/L3 and GPRS RLC/MAC messages to a host as GSMTAP packets so that you can use Wireshark to analyze them.
In order for this tool to run, you have to set on the phone the Trace or Data/Trace mode (Main Menu -> Test Tool -> Info & Settings -> Serial links setup).
Usage: ./ot290-gsmtap <serialDevice> <host> (e.g.: ./ot290-gsmtap /dev/ttyUSB0 224.0.0.1)

View File

@ -26,7 +26,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
//#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
@ -66,10 +65,10 @@ static int serial_init(const char *serial_port)
static int serial_read(void *buf, size_t nbytes)
{
fd_set readfds;
int actual;
FD_ZERO(&readfds);
FD_SET(serial_fd, &readfds);
actual = select(serial_fd+1, &readfds, NULL, NULL, NULL);
struct timeval timeout = {0, 1000000};
int actual = select(serial_fd+1, &readfds, NULL, NULL, &timeout);
if(actual > 0)
{
actual = read(serial_fd, buf, nbytes);