Skip to content

Commit

Permalink
print_wireless_info: On OpenBSD fetch the nominal channel bitrate
Browse files Browse the repository at this point in the history
  • Loading branch information
cgohla committed Jan 1, 2021
1 parent 30a32cc commit 0786e7e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/print_wireless_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ typedef struct {
double frequency;
} wireless_info_t;

#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
// Like iw_print_bitrate, but without the dependency on libiw.
static void print_bitrate(char *buffer, int buflen, int bitrate, const char *format_bitrate) {
const int kilo = 1e3;
Expand Down Expand Up @@ -473,6 +473,7 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
info->signal_level_max = nr.nr_max_rssi;

info->flags |= WIRELESS_INFO_FLAG_HAS_SIGNAL;
info->bitrate = (nr.nr_rates[nr.nr_txrate] & IEEE80211_RATE_VAL) / 2 * 1000 * 1000;
}
}
}
Expand Down Expand Up @@ -604,7 +605,7 @@ void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface,

snprintf(string_ip, STRING_SIZE, "%s", ip_address);

#if defined(__linux__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
print_bitrate(string_bitrate, sizeof(string_bitrate), info.bitrate, format_bitrate);
#endif

Expand Down

0 comments on commit 0786e7e

Please sign in to comment.