3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-30 14:22:37 +01:00

scan: Add scan_freq_set_get_bands

This commit is contained in:
Denis Kenzior 2015-10-06 15:23:09 -05:00
parent 9be930442c
commit 22ab0e73a2
2 changed files with 19 additions and 2 deletions

View File

@ -1144,6 +1144,22 @@ bool scan_freq_set_contains(struct scan_freq_set *freqs, uint32_t freq)
return false; return false;
} }
uint32_t scan_freq_set_get_bands(struct scan_freq_set *freqs)
{
uint32_t bands = 0;
uint32_t max;
if (freqs->channels_2ghz)
bands |= SCAN_BAND_2_4_GHZ;
max = l_uintset_get_max(freqs->channels_5ghz);
if (l_uintset_find_min(freqs->channels_5ghz) <= max)
bands |= SCAN_BAND_5_GHZ;
return bands;
}
bool scan_init(struct l_genl_family *in) bool scan_init(struct l_genl_family *in)
{ {
nl80211 = in; nl80211 = in;

View File

@ -28,8 +28,8 @@ enum scan_ssid_security {
}; };
enum scan_band { enum scan_band {
SCAN_BAND_2_4_GHZ, SCAN_BAND_2_4_GHZ = 0x1,
SCAN_BAND_5_GHZ, SCAN_BAND_5_GHZ = 0x2,
}; };
enum scan_state { enum scan_state {
@ -98,6 +98,7 @@ struct scan_freq_set *scan_freq_set_new(void);
void scan_freq_set_free(struct scan_freq_set *freqs); void scan_freq_set_free(struct scan_freq_set *freqs);
bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq); bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq);
bool scan_freq_set_contains(struct scan_freq_set *freqs, uint32_t freq); bool scan_freq_set_contains(struct scan_freq_set *freqs, uint32_t freq);
uint32_t scan_freq_set_get_bands(struct scan_freq_set *freqs);
bool scan_ifindex_add(uint32_t ifindex); bool scan_ifindex_add(uint32_t ifindex);
bool scan_ifindex_remove(uint32_t ifindex); bool scan_ifindex_remove(uint32_t ifindex);