serial_read first-time-read issue fixed + added a basic README
This commit is contained in:
parent
3122de719f
commit
5c3794a3b3
7
README
7
README
|
@ -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)
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue