Ahh, that's better

This commit is contained in:
XANTRONIX Development 2015-08-09 10:09:28 -05:00 committed by XANTRONIX Industrial
parent 35f42464c3
commit 53791bf21d
3 changed files with 9 additions and 21 deletions

View file

@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@ -195,7 +196,7 @@ int patty_ax25_next_event(patty_ax25 *ax25, patty_ax25_event *ev) {
memcpy(&ax25->unix_fds_pending_write, &ax25->unix_fds, sizeof(ax25->unix_fds)); memcpy(&ax25->unix_fds_pending_write, &ax25->unix_fds, sizeof(ax25->unix_fds));
memcpy(&ax25->unix_fds_pending_error, &ax25->unix_fds, sizeof(ax25->unix_fds)); memcpy(&ax25->unix_fds_pending_error, &ax25->unix_fds, sizeof(ax25->unix_fds));
if (select(ax25->unix_fdmax + 1, if (select(ax25->unix_fdmax,
&ax25->unix_fds_pending_read, &ax25->unix_fds_pending_read,
&ax25->unix_fds_pending_write, &ax25->unix_fds_pending_write,
&ax25->unix_fds_pending_error, &ax25->unix_fds_pending_error,

View file

@ -241,8 +241,8 @@ int patty_ax25_add_if(patty_ax25 *ax25, patty_ax25_if *iface) {
if ((fd = patty_kiss_tnc_fd_unix(iface->tnc)) >= 0) { if ((fd = patty_kiss_tnc_fd_unix(iface->tnc)) >= 0) {
FD_SET(fd, &ax25->unix_fds); FD_SET(fd, &ax25->unix_fds);
if (ax25->unix_fdmax < fd) { if (ax25->unix_fdmax < fd + 1) {
ax25->unix_fdmax = fd; ax25->unix_fdmax = fd + 1;
} }
} }

View file

@ -35,7 +35,7 @@ int iface_callback(patty_ax25_if *iface, void *ctx) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
patty_ax25 ax25; patty_ax25 ax25;
patty_ax25_if *iface; patty_ax25_if *iface;
int fd; patty_ax25_event ev;
if (argc != 2) { if (argc != 2) {
usage(argc, argv, "No TNC device provided"); usage(argc, argv, "No TNC device provided");
@ -65,22 +65,9 @@ int main(int argc, char **argv) {
exit(127); exit(127);
} }
if ((fd = patty_ax25_socket(&ax25)) < 0) { if (patty_ax25_next_event(&ax25, &ev) >= 0) {
perror("Unable to create new socket"); printf("Got event %d on fd %d\n",
ev.type, ev.fd);
exit(127);
}
if (patty_ax25_bind(&ax25, fd, "WX3RKR", 0) < 0) {
perror("Unable to bind socket to local address");
exit(127);
}
if (patty_ax25_connect(&ax25, fd, "N5TX", 0) < 0) {
perror("Unable to connect");
exit(127);
} }
patty_ax25_stop(&ax25); patty_ax25_stop(&ax25);