python-sdbus / python-sdbus-networkmanager

python-sdbus binds for NetworkManager
GNU Lesser General Public License v2.1
30 stars 6 forks source link

Enable/disable wireless interface #53

Closed thesems closed 1 year ago

thesems commented 1 year ago

I'm trying to enable the wireless device/interface via this library. However, I believe it is not implemented.

File: networkmanager/interfaces_other.py

@dbus_property_async('b')
    def wireless_enabled(self) -> bool:
        """Whether wireless enabled or not"""
        raise NotImplementedError

This suggests its read-only. There is also a method NetworkManager.enable() but it is not capable of turning on the wireless interface. It would appear that a @dbus_method_async is necessary.

Any plans to implement it or is it enabled in some other way?

Best regards.

igo95862 commented 1 year ago

Hello,

According to upstream NetworkManager documentation:

https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html#gdbus-property-org-freedesktop-NetworkManager.WirelessEnabled

The wireless_enabled should be read/write property.

~The python-sdbus determines if it is writeable by the presence of setter which is obviously missing. This is an issue I would need to fix in the interface file generator.~

~Meanwhile you can try add the setter yourself. It can have raise NotImplementedError as implementation is not important.~

~See example setter:~

https://github.com/python-sdbus/python-sdbus/blob/ae7bda2aba53de25228fc0839f1afa90a357119f/test/test_sd_bus_async.py#L121-L132

igo95862 commented 1 year ago

Disregard the part about adding setter.

Just call set_async with True or False and await on result. The presence of setter is not checked for a remote objects.

thesems commented 1 year ago

Thank you, you are right.