mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-31 20:38:27 +08:00
committed by
GitHub
parent
6c4426824e
commit
3365fa9e69
@@ -61,8 +61,15 @@ void nps_flightgear_init(const char *host, unsigned int port, unsigned int port
|
||||
if (port_in > 0) {
|
||||
struct sockaddr_in addr_in;
|
||||
flightgear.socket_in = socket(PF_INET, SOCK_DGRAM, pte->p_proto);
|
||||
setsockopt(flightgear.socket_in, SOL_SOCKET, SO_REUSEADDR,
|
||||
&so_reuseaddr, sizeof(so_reuseaddr));
|
||||
if (flightgear.socket_in < 0) {
|
||||
perror("nps_flightgear_init socket()");
|
||||
exit(errno);
|
||||
}
|
||||
if ( setsockopt(flightgear.socket_in, SOL_SOCKET, SO_REUSEADDR,
|
||||
&so_reuseaddr, sizeof(so_reuseaddr)) == -1) {
|
||||
perror("nps_flightgear_init setsockopt()");
|
||||
exit(errno);
|
||||
}
|
||||
addr_in.sin_family = PF_INET;
|
||||
addr_in.sin_port = htons(port_in);
|
||||
addr_in.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
|
||||
@@ -369,7 +369,7 @@ static bool nps_main_parse_options(int argc, char **argv)
|
||||
nps_main.host_time_factor = atof(optarg); break;
|
||||
case 8:
|
||||
nps_main.fg_fdm = 1; break;
|
||||
case 9:
|
||||
case 9:
|
||||
nps_main.fg_port_in = atoi(optarg); break;
|
||||
}
|
||||
break;
|
||||
@@ -383,7 +383,7 @@ static bool nps_main_parse_options(int argc, char **argv)
|
||||
fprintf(stderr, usage, argv[0]);
|
||||
exit(0);
|
||||
|
||||
default: /* $B!G(B?$B!G(B */
|
||||
default:
|
||||
printf("?? getopt returned character code 0%o ??\n", c);
|
||||
fprintf(stderr, usage, argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
@@ -38,9 +38,13 @@ int nps_radio_control_spektrum_init(const char *device)
|
||||
termios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | INPCK | ISTRIP | INLCR | IGNCR
|
||||
| ICRNL | IUCLC | IXON | IXANY | IXOFF | IMAXBEL);
|
||||
termios.c_iflag |= IGNPAR;
|
||||
|
||||
termios.c_cflag = 0; // properly initialize variable
|
||||
/* control modes*/
|
||||
termios.c_cflag &= ~(CSIZE | PARENB | CRTSCTS | PARODD | HUPCL);
|
||||
termios.c_cflag |= CREAD | CS8 | CSTOPB | CLOCAL;
|
||||
|
||||
termios.c_lflag = 0; // properly initialize variable
|
||||
/* local modes */
|
||||
termios.c_lflag &= ~(ISIG | ICANON | IEXTEN | ECHO | FLUSHO | PENDIN);
|
||||
termios.c_lflag |= NOFLSH;
|
||||
|
||||
Reference in New Issue
Block a user