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 <dcbw@redhat.com> contributed the idea of implementation.
This commit is contained in:
Ben Chan
2013-01-17 23:11:09 -08:00
committed by Aleksander Morgado
parent 2550cb20a9
commit e75dba639f
6 changed files with 52 additions and 12 deletions

View File

@@ -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