0

I have the following code to retrieve access points information using NetworkManager dbus api:

//---------------------------------------------------------------------------------
    QDBusInterface dbus_iface("org.freedesktop.NetworkManager",                     
                              "/org/freedesktop/NetworkManager/Devices/2",     // path (might be different in other systems)
                              "org.freedesktop.NetworkManager.Device.Wireless",     
                              bus);


    QDBusMessage query = dbus_iface.call("GetAllAccessPoints");

    qDebug() << query;

    if(query.type() == QDBusMessage::ReplyMessage) {

        QDBusArgument arg = query.arguments().at(0).value<QDBusArgument>();
        arg.beginArray();
        while(!arg.atEnd()) {
            QString element = qdbus_cast<QString>(arg);
            netList->append(element);
            showAccessPointProperties(element);
        }
        arg.endArray();
    } else {
        qDebug() << " dbus error: " << query.errorName();
    }

This code works on desktop linux (ubuntu 18.04).

But in raspbian (buster, raspberry pi 3 B/B+) this code doesn't work! The problem is that this call :

dbus_iface.call("GetAllAccessPoints");

returns empty reply.

Is it anything different on how to use NM dbus interface in raspbian and ubuntu?

  • "/org/freedesktop/NetworkManager/Devices/2", : Is that the correct path to the wireless device. That might be correct on your PC (Ubuntu?) but is it the right path on the raspi too? If e.g you ask your network card for all access points, it gives you all it can find: 0. I have not much knowledge on the DBus so I can not tell you how to find the correct device number. For me the comment // path (might be different in other systems) would be sufficient to investigate in that direction. – Peter Paul Kiefer Mar 1 at 14:26
  • Have you added and configured NM on Raspbian, it's not used by default? – Dougie Mar 1 at 15:31
  • @PeterPaulKiefer in my the it is devices/3, I'm aware of the difference of wireless path in different systems as mentioned in the comment. this path is for my PC. My question is that why GetAllAccessPoints returns nothing in Pi? – payman Mar 2 at 5:58
  • @Dougie Yes, I've installed NM myself. Do you aware of any configuration that might be related to this issue? – payman Mar 2 at 6:02
  • 1
    @payman In future you are better off asking these kinds of questions on our larger sibling site, Unix & Linux -- Raspbian is not particularly unusual in this regard, although it uses dhcpcd by default (which I do not think current stock Debian does) -- or Stack Overflow, since it is programming. – goldilocks Mar 9 at 13:09
2

It seems that other network managing packages prevent Network Manager to access wireless.

For me the issue resolved by removing dhcpcd5 and openresolve packages :

sudo apt-get remove --purge dhcpcd5 openresolve

| improve this answer | |
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Mar 6 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.