mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-01 22:34:07 +01:00
scan: Implement scan_channel_to_freq
This function does the inverse of scan_freq_to_channel
This commit is contained in:
parent
911aebc844
commit
c4941a82a4
21
src/scan.c
21
src/scan.c
@ -1092,6 +1092,27 @@ uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t scan_channel_to_freq(uint8_t channel, enum scan_band band)
|
||||||
|
{
|
||||||
|
if (band == SCAN_BAND_2_4_GHZ) {
|
||||||
|
if (channel >= 1 && channel <= 13)
|
||||||
|
return 2407 + 5 * channel;
|
||||||
|
|
||||||
|
if (channel == 14)
|
||||||
|
return 2484;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (band == SCAN_BAND_5_GHZ) {
|
||||||
|
if (channel >= 1 && channel <= 179)
|
||||||
|
return 5000 + 5 * channel;
|
||||||
|
|
||||||
|
if (channel >= 181 && channel <= 199)
|
||||||
|
return 4000 + 5 * channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
struct scan_freq_set {
|
struct scan_freq_set {
|
||||||
uint16_t channels_2ghz;
|
uint16_t channels_2ghz;
|
||||||
struct l_uintset *channels_5ghz;
|
struct l_uintset *channels_5ghz;
|
||||||
|
@ -86,6 +86,7 @@ void bss_get_supported_ciphers(struct scan_bss *bss,
|
|||||||
uint16_t *group_ciphers);
|
uint16_t *group_ciphers);
|
||||||
|
|
||||||
uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band);
|
uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band);
|
||||||
|
uint32_t scan_channel_to_freq(uint8_t channel, enum scan_band band);
|
||||||
|
|
||||||
struct scan_freq_set *scan_freq_set_new(void);
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user