2

I'm currently building an application that leverages NetworkManager for providing network configuration functionalities. The application uses the DBus API to communicate with NetworkManager.

I'm now stuck on the following problem: I want to have a UI element that lists the WiFi channels/frequencies that the user can select when setting up a WiFi access point but I'm not able to find a way to ask NetworkManager for this information. If I understand correctly the supported channel/frequencies depend on the network card capabilities and the country code set for the system.

When I use nmtui the channel selector is a text box and when I select an unsupported channel it throws an error. It looks like this information is available somewhere but I can't access it.

I know that I can retrieve this info from iwlist but, as per their documentation, that command output is not meant to be parsed and is not stable.

I tried skimming through the wpa_supplicant DBus API but it doesn't seem to provide this information either.

Is there a service/API I can use for retrieving this information?

AdminBee
  • 21,637
  • 21
  • 47
  • 71
mattdibi
  • 121
  • 1
  • I don't think NM has access to that information. Have a look at [`getChannelInfo`](https://github.com/llazzaro/python3-wifi/blob/master/pythonwifi/iwlibs.py#L256) from `python-wifi` (which hasn't been maintained for quite some years...) – don_crissti Feb 24 '23 at 14:36
  • @don_crissti Thanks for the feedback. Apparently `python-wifi` uses `iwlib` under the hood, which essentially means using `iwlist`. I didn't know about `iwlib` and can be interesting using it but the effort is high. – mattdibi Feb 24 '23 at 14:59
  • Well, afaik it's either `iwlib` (python, haskell etc) or parsing the `iw` output (which is still considered work in progress...) – don_crissti Feb 24 '23 at 15:05

1 Answers1

0

You can try LinSSID which will provide you the list of SSIDs and channel they use.

Romeo Ninov
  • 16,541
  • 5
  • 32
  • 44
  • I don't think that's what op asks for - they want a list of locally legal and technically possible wifi channels, not a list of available networks. – Marcus Müller Feb 24 '23 at 10:33
  • Yup, I'm trying to find the channels that a WiFi device supports not the APs seen by the device. The equivalent of `iwlist channel` but from a service providing a stable API since, as per `iw` documentation, you should "_NOT screenscrape this tool, we don't consider its output stable_" – mattdibi Feb 24 '23 at 14:54