Changeset 16178 in vbox for trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
- Timestamp:
- Jan 22, 2009 3:39:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r16137 r16178 79 79 extern void VBoxHalShutdown (DBusConnection *pConnection); 80 80 extern void VBoxHalShutdownPrivate (DBusConnection *pConnection); 81 extern void VBoxDBusConnectionUnref(DBusConnection *pConnection); 82 extern void VBoxDBusConnectionCloseAndUnref(DBusConnection *pConnection); 83 extern void VBoxDBusMessageUnref(DBusMessage *pMessage); 81 84 82 85 static int halInit(RTMemAutoPtr <DBusConnection, VBoxHalShutdown> *pConnection); … … 109 112 #if defined(RT_OS_LINUX) 110 113 #ifdef VBOX_WITH_DBUS 111 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing()))114 if (RT_SUCCESS (rc) && RT_SUCCESS(VBoxLoadDBusLib()) && (!success || testing())) 112 115 rc = getDriveInfoFromHal(&mDVDList, true /* isDVD */, &success); 113 116 #endif /* VBOX_WITH_DBUS defined */ … … 154 157 #if defined(RT_OS_LINUX) 155 158 #ifdef VBOX_WITH_DBUS 156 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 159 if ( RT_SUCCESS (rc) 160 && RT_SUCCESS(VBoxLoadDBusLib()) 161 && (!success || testing())) 157 162 rc = getDriveInfoFromHal(&mFloppyList, false /* isDVD */, &success); 158 163 #endif /* VBOX_WITH_DBUS defined */ … … 197 202 #if defined(RT_OS_LINUX) 198 203 #ifdef VBOX_WITH_DBUS 199 if (RT_SUCCESS (rc) && VBoxDBusCheckPresence() && (!success || testing())) 204 if ( RT_SUCCESS (rc) 205 && RT_SUCCESS(VBoxLoadDBusLib()) 206 && (!success || testing())) 200 207 rc = getUSBDeviceInfoFromHal(&mDeviceList, &halSuccess); 201 208 /* Try the old API if the new one *succeeded* as only one of them will … … 226 233 /** A flag to say that we wish to interrupt the current wait. */ 227 234 bool mInterrupt; 235 /** Constructor */ 236 Context() : mTriggered(false), mInterrupt(false) {} 228 237 #endif /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */ 229 238 }; … … 238 247 int rc = VINF_SUCCESS; 239 248 240 if (VBoxDBusCheckPresence())241 {242 mContext = new Context;249 mContext = new Context; 250 if (RT_SUCCESS(VBoxLoadDBusLib())) 251 { 243 252 for (unsigned i = 0; RT_SUCCESS(rc) && i < 5 && !mContext->mConnection; ++i) 244 253 { … … 617 626 autoDBusError dbusError; 618 627 619 RTMemAutoPtr <DBusConnection, VBoxDBusConnection Unref> dbusConnection;628 RTMemAutoPtr <DBusConnection, VBoxDBusConnectionCloseAndUnref> dbusConnection; 620 629 dbusConnection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &dbusError.get()); 621 630 if (!dbusConnection) … … 650 659 * @param pConnection the connection handle 651 660 */ 652 /* static*/661 /* extern */ 653 662 void VBoxHalShutdown (DBusConnection *pConnection) 654 663 { … … 672 681 * @param pConnection the connection handle 673 682 */ 674 /* static*/683 /* extern */ 675 684 void VBoxHalShutdownPrivate (DBusConnection *pConnection) 676 685 { … … 689 698 LogFlowFunc(("returning\n")); 690 699 dbusError.FlowLog(); 700 } 701 702 /** Wrapper around dbus_connection_unref. We need this to use it as a real 703 * function in auto pointers, as a function pointer won't wash here. */ 704 /* extern */ 705 void VBoxDBusConnectionUnref(DBusConnection *pConnection) 706 { 707 dbus_connection_unref(pConnection); 708 } 709 710 /** 711 * This function closes and unrefs a private connection to dbus. It should 712 * only be called once no-one else is referencing the connection. 713 */ 714 /* extern */ 715 void VBoxDBusConnectionCloseAndUnref(DBusConnection *pConnection) 716 { 717 dbus_connection_close(pConnection); 718 dbus_connection_unref(pConnection); 719 } 720 721 /** Wrapper around dbus_message_unref. We need this to use it as a real 722 * function in auto pointers, as a function pointer won't wash here. */ 723 /* extern */ 724 void VBoxDBusMessageUnref(DBusMessage *pMessage) 725 { 726 dbus_message_unref(pMessage); 691 727 } 692 728
Note:
See TracChangeset
for help on using the changeset viewer.