[Networkmanager] Creating, enabling, disabling wifi access point using libnm-glib

Beniamino Galvani bgalvani at redhat.com
Fri Jan 20 08:23:32 UTC 2023

On Thu, Jan 19, 2023 at 12:07:11AM +0000, VT102 wrote:
> Hello,

> I have been looking through the source code documentation and
> examples but I'm not clear on if it would be possible to create,
> enable, and disable a wifi access point using the libnm-glib API?

Yes, it's possible. Note that "libnm-glib" is the name of an old
library to control NM that has been replaced by "libnm". What you want
to use really is libnm.

> I see that there is an example showing how to see existing AP's
> https://github.com/lcp/NetworkManager/blob/master/examples/C/glib/get-ap-info-libnm-glib.c

This git repo contains very old code, please check out the official
repository at
https://gitlab.freedesktop.org/NetworkManager/NetworkManager .

> I also see there is an NMAccessPoint data type from which I can get
> access point information, but I dont see any way to set it.
> https://developer-old.gnome.org/libnm-glib/stable/NMAccessPoint.html

You need to add new connection profile that contains the hotspot
parameters, and then call nm_client_add_and_activate_connection_async().

You can use the implementation of the "nmcli device wifi hotspot" as a


This article also explain the basic concepts of libnm and how to use
it from Python:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/networkmanager/attachments/20230120/2c619d41/attachment.sig>

More information about the Networkmanager mailing list