Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print_wireless_info: On OpenBSD fetch the nominal channel bitrate #444

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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