mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 02:39:44 +00:00
fixed serial port reading and interface setup bugs.
now crashes when trying to tick packet radio interface.
This commit is contained in:
parent
7287a2d599
commit
a4bfdc6c75
@ -446,7 +446,7 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
// XXX This needs to be parameterised at some point
|
||||
// Make sure it is not in command mode
|
||||
write(interface->alarm.poll.fd,"ATO\r",4);
|
||||
if (config.debug.packetradio)
|
||||
if (config.debug.packetradio)
|
||||
DEBUGF("Sent ATO to make sure we are in on-line mode");
|
||||
}
|
||||
|
||||
@ -454,14 +454,19 @@ overlay_interface_init(const char *name, struct in_addr src_addr, struct in_addr
|
||||
if (interface->type!=OVERLAY_INTERFACE_PACKETRADIO) {
|
||||
interface->alarm.function=overlay_dummy_poll;
|
||||
dummy_poll_stats.name="overlay_dummy_poll";
|
||||
interface->alarm.alarm=gettime_ms()+10;
|
||||
interface->alarm.deadline=interface->alarm.alarm;
|
||||
interface->alarm.stats=&dummy_poll_stats;
|
||||
schedule(&interface->alarm);
|
||||
} else {
|
||||
interface->alarm.function=overlay_packetradio_poll;
|
||||
dummy_poll_stats.name="overlay_packetradio_poll";
|
||||
interface->alarm.poll.events=POLLIN;
|
||||
watch(&interface->alarm);
|
||||
if (config.debug.packetradio)
|
||||
DEBUGF("Watching file descriptor #%d for packet radio interface",
|
||||
interface->alarm.poll.fd);
|
||||
}
|
||||
interface->alarm.alarm=gettime_ms()+10;
|
||||
interface->alarm.deadline=interface->alarm.alarm;
|
||||
interface->alarm.stats=&dummy_poll_stats;
|
||||
schedule(&interface->alarm);
|
||||
|
||||
interface->state=INTERFACE_STATE_UP;
|
||||
if (interface->type!=OVERLAY_INTERFACE_PACKETRADIO)
|
||||
|
@ -17,8 +17,6 @@ int overlay_packetradio_setup_port(overlay_interface *interface)
|
||||
{
|
||||
struct termios t;
|
||||
|
||||
set_nonblock(interface->alarm.poll.fd);
|
||||
|
||||
tcgetattr(interface->alarm.poll.fd, &t);
|
||||
// XXX Speed and options should be configurable
|
||||
cfsetispeed(&t, B57600);
|
||||
@ -29,11 +27,11 @@ int overlay_packetradio_setup_port(overlay_interface *interface)
|
||||
t.c_cflag &= ~CSIZE;
|
||||
t.c_cflag |= CS8;
|
||||
|
||||
// Disable CTS/RTS flow control (for now)
|
||||
// Enable CTS/RTS flow control (for now)
|
||||
#ifndef CNEW_RTSCTS
|
||||
t.c_cflag &= ~CRTSCTS;
|
||||
t.c_cflag |= CRTSCTS;
|
||||
#else
|
||||
t.c_cflag &= ~CNEW_RTSCTS;
|
||||
t.c_cflag |= CNEW_RTSCTS;
|
||||
#endif
|
||||
// and software flow control
|
||||
t.c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
@ -44,6 +42,8 @@ int overlay_packetradio_setup_port(overlay_interface *interface)
|
||||
|
||||
tcsetattr(interface->alarm.poll.fd, TCSANOW, &t);
|
||||
|
||||
set_nonblock(interface->alarm.poll.fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ void overlay_packetradio_poll(struct sched_ent *alarm)
|
||||
interface->last_tick_ms=now;
|
||||
}
|
||||
|
||||
schedule(alarm);
|
||||
watch(alarm);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user