mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
improve debug msgs
This commit is contained in:
parent
6ac15a5bac
commit
c41ff502b4
2 changed files with 14 additions and 14 deletions
|
|
@ -22,12 +22,11 @@ int get_rssi_from_iwinfo(__uint8_t* client_addr)
|
|||
|
||||
int call_iwinfo(char* client_addr)
|
||||
{
|
||||
// TODO: REFACTOR THIS! USE NET LINK... LOOK AT IWINFO
|
||||
|
||||
FILE *fp;
|
||||
char path[1035];
|
||||
|
||||
/* Open the command for reading. */
|
||||
|
||||
// TODO: refactor this
|
||||
int rssi = INT_MIN;
|
||||
int command_length = 68;
|
||||
char iwinfo_command[command_length];
|
||||
|
|
@ -38,7 +37,6 @@ int call_iwinfo(char* client_addr)
|
|||
iwinfo_command[command_length - 1] = '\0';
|
||||
printf("iwinfo command:\n%s\n", iwinfo_command);
|
||||
|
||||
|
||||
fp = popen(iwinfo_command, "r");
|
||||
if (fp == NULL) {
|
||||
printf("Failed to run command\n" );
|
||||
|
|
@ -65,14 +63,11 @@ int parse_rssi(char* iwinfo_string)
|
|||
int rssi = INT_MIN;
|
||||
if(p_1 != NULL && p_2 != NULL)
|
||||
{
|
||||
printf("Found substring: %s", p_2);
|
||||
printf("Length: %d\n", p_2 - p_1);
|
||||
int length = (int) (p_2 - p_1);
|
||||
char dest[length + 1];
|
||||
memcpy(dest, p_1, (int) (p_2 - p_1));
|
||||
dest[length] = '\0';
|
||||
rssi = atoi(dest);
|
||||
printf("After cutting:\n%s\nInt:%d\n", dest, rssi);
|
||||
}
|
||||
return rssi;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue