Skip to content
Snippets Groups Projects
Commit 013440ee authored by f4grx's avatar f4grx
Browse files

Merge branch 'master' of https://github.com/f4grx/hn70ap

parents 01e2b891 624692ce
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ int config_list(void)
else if(type == EECONFIG_TYPE_IP)
{
struct in_addr val;
ret = hn70ap_eeconfig_getip(name, &val);
ret = hn70ap_eeconfig_getip(name, &val.s_addr);
if(ret == OK)
{
printf("%s\n", inet_ntoa(val));
......
......@@ -425,6 +425,7 @@ int hn70ap_lcd_drawchar(int row, int col, char ch)
errcode);
}
#endif
return 0;
}
/****************************************************************************
......
......@@ -149,6 +149,10 @@ void *hn70ap_radio_rxthread(void *arg)
//syslog(LOG_ERR, "radio rx failed -> errno=%d\n", errno);
}
} //callback defined
else
{
pthread_yield();
}
} //radio alive
syslog(LOG_INFO, "Stopped radio RX thread\n");
return NULL;
......@@ -170,8 +174,9 @@ int hn70ap_radio_devinit(struct radio_s *radio, const char *dev)
goto lret;
}
radio->callback = NULL;
radio->alive = true;
ret = pthread_create(&radio->rxthread, NULL, hn70ap_radio_rxthread, NULL);
ret = pthread_create(&radio->rxthread, NULL, hn70ap_radio_rxthread, radio);
if(ret < 0)
{
syslog(LOG_ERR, "Failed to start the receive thread\n");
......
......@@ -110,9 +110,9 @@ int hn70ap_system_init(void)
}
strncpy(tunname, "uhf0", IFNAMSIZ);
#if 0
#if 1
ret = hn70ap_tun_devinit(tunname);
if(ret != 0)
if(ret < 0)
{
syslog(LOG_ERR, "WARNING: Failed to initialize TUN interface\n");
}
......
......@@ -35,6 +35,7 @@
#include <nuttx/config.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
......@@ -92,6 +93,10 @@ void *hn70ap_tun_rxthread(void *arg)
//syslog(LOG_ERR, "tunnel rx failed -> errno=%d\n", errno);
}
} //callback defined
else
{
pthread_yield();
}
} //tunnel alive
syslog(LOG_INFO, "Stopped tunnel RX thread\n");
return NULL;
......@@ -153,7 +158,7 @@ int hn70ap_tun_devinit(char name[IFNAMSIZ])
return -1;
}
if ((fd = open("/dev/tun", O_RDWR | O_NONBLOCK)) < 0)
if ((fd = open("/dev/tun", O_RDWR)) < 0)
{
return fd;
}
......@@ -165,7 +170,8 @@ int hn70ap_tun_devinit(char name[IFNAMSIZ])
strncpy(ifr.ifr_name, name, IFNAMSIZ);
}
if ((errcode = ioctl(fd, TUNSETIFF, (unsigned long)&ifr)) < 0)
errcode = ioctl(fd, TUNSETIFF, (unsigned long)&ifr);
if(errcode < 0)
{
close(fd);
return errcode;
......@@ -177,6 +183,7 @@ int hn70ap_tun_devinit(char name[IFNAMSIZ])
//Start RX thread
tunnel->alive = true;
tunnel->callback = NULL;
ret = pthread_create(&tunnel->rxthread, NULL, hn70ap_tun_rxthread, tunnel);
if(ret < 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment