plugin: if no grab_port() method given, use the default one
This commit is contained in:
@@ -598,13 +598,25 @@ mm_plugin_create_modem (MMPlugin *self,
|
|||||||
/* Grab each port */
|
/* Grab each port */
|
||||||
for (l = port_probes; l; l = g_list_next (l)) {
|
for (l = port_probes; l; l = g_list_next (l)) {
|
||||||
GError *inner_error = NULL;
|
GError *inner_error = NULL;
|
||||||
|
MMPortProbe *probe = MM_PORT_PROBE (l->data);
|
||||||
|
gboolean grabbed;
|
||||||
|
|
||||||
/* If grabbing a port fails, just warn. We'll decide if the modem is
|
/* If grabbing a port fails, just warn. We'll decide if the modem is
|
||||||
* valid or not when all ports get organized */
|
* valid or not when all ports get organized */
|
||||||
if (!MM_PLUGIN_GET_CLASS (self)->grab_port (MM_PLUGIN (self),
|
|
||||||
|
if (MM_PLUGIN_GET_CLASS (self)->grab_port)
|
||||||
|
grabbed = MM_PLUGIN_GET_CLASS (self)->grab_port (MM_PLUGIN (self),
|
||||||
modem,
|
modem,
|
||||||
MM_PORT_PROBE (l->data),
|
probe,
|
||||||
&inner_error)) {
|
&inner_error);
|
||||||
|
else
|
||||||
|
grabbed = mm_base_modem_grab_port (modem,
|
||||||
|
mm_port_probe_get_port_subsys (probe),
|
||||||
|
mm_port_probe_get_port_name (probe),
|
||||||
|
mm_port_probe_get_port_type (probe),
|
||||||
|
MM_AT_PORT_FLAG_NONE,
|
||||||
|
&inner_error);
|
||||||
|
if (!grabbed) {
|
||||||
mm_warn ("Could not grab port (%s/%s): '%s'",
|
mm_warn ("Could not grab port (%s/%s): '%s'",
|
||||||
mm_port_probe_get_port_subsys (MM_PORT_PROBE (l->data)),
|
mm_port_probe_get_port_subsys (MM_PORT_PROBE (l->data)),
|
||||||
mm_port_probe_get_port_name (MM_PORT_PROBE (l->data)),
|
mm_port_probe_get_port_name (MM_PORT_PROBE (l->data)),
|
||||||
|
@@ -75,10 +75,8 @@ struct _MMPlugin {
|
|||||||
struct _MMPluginClass {
|
struct _MMPluginClass {
|
||||||
GObjectClass parent;
|
GObjectClass parent;
|
||||||
|
|
||||||
/* Mandatory subclass functions */
|
|
||||||
|
|
||||||
/* Plugins need to provide a method to create a modem object given
|
/* Plugins need to provide a method to create a modem object given
|
||||||
* a list of port probes */
|
* a list of port probes (Mandatory) */
|
||||||
MMBaseModem *(*create_modem) (MMPlugin *plugin,
|
MMBaseModem *(*create_modem) (MMPlugin *plugin,
|
||||||
const gchar *sysfs_path,
|
const gchar *sysfs_path,
|
||||||
const gchar *driver,
|
const gchar *driver,
|
||||||
@@ -88,7 +86,7 @@ struct _MMPluginClass {
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/* Plugins need to provide a method to grab independent ports
|
/* Plugins need to provide a method to grab independent ports
|
||||||
* identified by port probes */
|
* identified by port probes (Optional) */
|
||||||
gboolean (*grab_port) (MMPlugin *plugin,
|
gboolean (*grab_port) (MMPlugin *plugin,
|
||||||
MMBaseModem *modem,
|
MMBaseModem *modem,
|
||||||
MMPortProbe *probe,
|
MMPortProbe *probe,
|
||||||
|
Reference in New Issue
Block a user