Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:56:47+00:00 2026-06-11T11:56:47+00:00

I would like to mount a filesystem using QT and DBUS. I subscribed to

  • 0

I would like to mount a filesystem using QT and DBUS. I subscribed to signal “DeviceAdded” using this small snippet:

 void DBusWatcher::deviceAdded(const QDBusObjectPath &o) {
    QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.UDisks", o.path(), "org.freedesktop.DBus.Properties", "GetAll");

    QList<QVariant> args;
    args.append("org.freedesktop.UDisks.Device");
    call.setArguments(args);

    QDBusPendingReply<QVariantMap> reply = DBusConnection::systemBus().asyncCall(call);
    reply.waitForFinished();

    QVariantMap map = reply.value();

    // ...
}

That works pretty fine. My question is, how do I mount this thing? All I have is something like this – and it does not work at all – and with no errors.

QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.UDisks", "dont know what to put here!", "org.freedesktop.UDisks.Device", "FilesystemMount");

And now, what action should I use on QDBusConnection::systemBus(): call, asyncCall, callWithCallback? What has to be put as second argument into createMethodCall? Nothing works! Really fustrating!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:56:49+00:00Added an answer on June 11, 2026 at 11:56 am

    OK, after struggling for at least 2 days I finally got it! I looked into razer-qt sources, I looked into kdelibs sources but somehow all their dbus stuff did not work. So here is the snippet I’m pretty happy with:

    void DBusWatcher::deviceAdded(const QDBusObjectPath &o) {
        QDBusMessage call = QDBusMessage::createMethodCall("org.freedesktop.UDisks", o.path(), "org.freedesktop.DBus.Properties", "GetAll");
    
        QList<QVariant> args;
        args.append("org.freedesktop.UDisks.Device");
        call.setArguments(args);
    
        QDBusPendingReply<QVariantMap> reply = QDBusConnection::systemBus().asyncCall(call);
        reply.waitForFinished();
    
        QVariantMap map = reply.value();
        // now do what you want with the map ;)
        // You will find all available information to the device attached
    }
    
    // a class wide pointer to the systembus
    // initialized within the constructor of the class
    // and deleted in the destructor
    dbus = new QDBusInterface(
        "org.freedesktop.UDisks",
        "here comes the path from the QDBusObjectPath.path() object",
        "org.freedesktop.UDisks.Device",
        QDBusConnection::systemBus(),
        this
    );
    
    void DbusAction::mountFilesystem() {
        if(dbus->isValid()) {
    
            QList<QVariant> args;
            args << QVariant(QString()) << QVariant(QStringList());
    
            QDBusMessage msg = dbus->callWithArgumentList(QDBus::AutoDetect, "FilesystemMount", args);
            if(msg.type() == QDBusMessage::ReplyMessage) {
                QString path = msg.arguments().at(0).toString();
                if(!path.isEmpty()) {
                    emit deviceMounted(path);
                } else {
                    qDebug() << "sorry, but the path returned is empty";
                }
            } else {
                qDebug() << msg.errorMessage();
            }
        }
    }
    

    I’m using Openbox and the latest Udisk(2) stuff running on x64-ArchLinux. Maybe someone can use it too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to do something like this: chroot /mount-point /path/to/script $var1 $var 2
I would like to mount a trucrypt volume using PHP, but I'm getting the
I would like to Mount a Folder as a Letter using Windows XP. E.g.
I'm using a Mac at work and would like some network shares mounting when
I would like to know how I can run linux command to mount /
I would like to mount a sinatra application in my rails app. But I
Would like to get a list of advantages and disadvantages of using Stored Procedures.
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like someone to take a look at my script and tell me where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.