This is a simple code I have that I wrote using the documentation of wpa_supplicant's D-Bus API.
from pydbus import SystemBus
bus = SystemBus()
proxy = bus.get('fi.w1.wpa_supplicant1','/fi/w1/wpa_supplicant1')
print(proxy.Interfaces)
As per the documentation, it should return the following:
An array with paths to D-Bus objects representing controlled interfaces each.
However, it returns an empty array, while I would expect to see a path to my wlan0 interface.
I feel like I am missing a previous step but I am completely lost on what it is.
A few more things that might be useful:
- Running
wpa_cli interface_list
returns nothing. - Running
ls /var/run/wpa_supplicant/
returnsp2p-dev-wlan0 wlan0
- I am not sure how relevant this is, but I am running this on a Raspberry Pi Zero W.
EDIT: It seems like wpa_supplicant has no clue about what a wlan0 is.
I switched to the dbus-python
package to see if it was any different and received the following error when trying to get the wlan0
interface.
import dbus
bus = dbus.SystemBus()
wpas_obj = bus.get_object('fi.w1.wpa_supplicant1','/fi/w1/wpa_supplicant1')
wpas = dbus.Interface(wpas_obj, 'fi.w1.wpa_supplicant1')
path = wpas.GetInterface('wlan0')
Error: wpa_supplicant knows nothing about this interface