Results 1 to 4 of 4

Thread: HAL & DBusConnection & Qt main loop integration

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2007
    Posts
    11
    Thanks
    4

    Question HAL & DBusConnection & Qt main loop integration

    Hello,
    I'm playing with HAL and writing a console application in order to write a message when plugging a usb pendrive.

    The problem is that libhal must be initialized with a call to the following function (from the HAL API):
    Qt Code:
    1. bool libhal_ctx_set_dbus_connection (LibHalContext *ctx, DBusConnection *conn);
    To copy to clipboard, switch view to plain text mode 
    so a DBusConnection instance is needed.

    I can create one the "standard" way, by calling (from the D-Bus API):
    Qt Code:
    1. DBusConnection* dbus_bus_get(DBusBusType type, DBusError *error);
    To copy to clipboard, switch view to plain text mode 
    but then this DBusConnection is not integrated with the Qt main loop, so later in the code, when calling "return app.exec()" my program enters the main loop and nothing shows up in the console.

    I thought about using the DBusConnection created inside QDBusConnection::systemBus(), because I expect it to be integrated with the Qt main loop (but then maybe I'm wrong), maybe using the "Unique Connection Name" of the connection (given by QDBusConnection::baseService()), but then I would need some method like "DBusConnection* dbus_bus_get_by_unique_name(char* name)", and that doesn't seem to exist in the D-Bus API.

    Am I facing this issue the wrong way? Any comments or suggestions are truly appreciated
    Last edited by juannm; 14th January 2009 at 20:05. Reason: updated contents

Similar Threads

  1. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10
  2. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  3. While statement inside the main loop
    By OnionRingOfDoom in forum Qt Programming
    Replies: 4
    Last Post: 8th February 2006, 18:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.