From e75dba639febded0e2878a02f47829cedb6239f7 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Thu, 17 Jan 2013 23:11:09 -0800 Subject: core: add 'hotplugged' flag to indicate if modem is newly plugged in This patch adds a 'hotplugged' flag to MMBaseModem to indicate if a modem is newly plugged in. A plugin can use this information to determine if, for example, the modem needs to be soft reset using the ATZ command. Dan Williams contributed the idea of implementation. --- src/mm-device.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/mm-device.c') diff --git a/src/mm-device.c b/src/mm-device.c index e8330d62..a37b26d5 100644 --- a/src/mm-device.c +++ b/src/mm-device.c @@ -68,6 +68,9 @@ struct _MMDevicePrivate { /* When exported, a reference to the object manager */ GDBusObjectManagerServer *object_manager; + + /* Whether the device was hot-plugged. */ + gboolean hotplugged; }; /*****************************************************************************/ @@ -593,14 +596,24 @@ mm_device_get_port_probe_list (MMDevice *self) return copy; } +gboolean +mm_device_get_hotplugged (MMDevice *self) +{ + return self->priv->hotplugged; +} + /*****************************************************************************/ MMDevice * -mm_device_new (GUdevDevice *udev_device) +mm_device_new (GUdevDevice *udev_device, gboolean hotplugged) { - return MM_DEVICE (g_object_new (MM_TYPE_DEVICE, - MM_DEVICE_UDEV_DEVICE, udev_device, - NULL)); + MMDevice *device; + + device = MM_DEVICE (g_object_new (MM_TYPE_DEVICE, + MM_DEVICE_UDEV_DEVICE, udev_device, + NULL)); + device->priv->hotplugged = hotplugged; + return device; } static void -- cgit v1.2.3-70-g09d2