manager: new ScanDevices() d-bus method to request a new device scan loop

This commit is contained in:
Aleksander Morgado
2011-05-10 09:48:59 +02:00
parent df0d9b480c
commit 3fb53d3348
2 changed files with 22 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> <node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.ModemManager"> <interface name="org.freedesktop.ModemManager">
<method name="EnumerateDevices"> <method name="EnumerateDevices">
<tp:docstring> <tp:docstring>
Get the list of modem devices. Get the list of modem devices.
@@ -14,6 +15,13 @@
</arg> </arg>
</method> </method>
<method name="ScanDevices">
<tp:docstring>
Start a new scan for connected modem devices.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_scan_devices"/>
</method>
<signal name="DeviceAdded"> <signal name="DeviceAdded">
<tp:docstring> <tp:docstring>
A device was added to the system. A device was added to the system.

View File

@@ -30,6 +30,8 @@ static gboolean impl_manager_enumerate_devices (MMManager *manager,
GPtrArray **devices, GPtrArray **devices,
GError **err); GError **err);
static gboolean impl_manager_scan_devices (MMManager *manager);
#include "mm-manager-glue.h" #include "mm-manager-glue.h"
G_DEFINE_TYPE (MMManager, mm_manager, G_TYPE_OBJECT) G_DEFINE_TYPE (MMManager, mm_manager, G_TYPE_OBJECT)
@@ -951,6 +953,14 @@ handle_uevent (GUdevClient *client,
device_removed (self, device); device_removed (self, device);
} }
static gboolean
impl_manager_scan_devices (MMManager *manager)
{
/* Relaunch manager start, which does device scanning */
mm_manager_start (manager);
return TRUE;
}
void void
mm_manager_start (MMManager *manager) mm_manager_start (MMManager *manager)
{ {
@@ -960,6 +970,8 @@ mm_manager_start (MMManager *manager)
g_return_if_fail (manager != NULL); g_return_if_fail (manager != NULL);
g_return_if_fail (MM_IS_MANAGER (manager)); g_return_if_fail (MM_IS_MANAGER (manager));
mm_dbg ("Starting device scan...");
priv = MM_MANAGER_GET_PRIVATE (manager); priv = MM_MANAGER_GET_PRIVATE (manager);
devices = g_udev_client_query_by_subsystem (priv->udev, "tty"); devices = g_udev_client_query_by_subsystem (priv->udev, "tty");
@@ -975,6 +987,8 @@ mm_manager_start (MMManager *manager)
g_object_unref (G_OBJECT (iter->data)); g_object_unref (G_OBJECT (iter->data));
} }
g_list_free (devices); g_list_free (devices);
mm_dbg ("Finished device scan...");
} }
typedef struct { typedef struct {