udev: move device probing and detection to udev
Get rid of dependency on HAL, using libgudev instead. Fix up the plugin API to no longer use either HAL or udev defines, but let plugins use whatever mechanism they want for getting more information out of the device given the subsystem and device node name. Modems are now defined as "master" devices which "own" a one or more ports. A port could be a serial tty device or a network device or whatever. The plugin figures out whether it supports a given port or not and then assigns it to a new or existing modem. Modems now have a 'valid' property that should be set to TRUE when the modem has enough ports to operate correctly. For devices (ex. 'hso') that use a network device for data transfer, the modem would need to grab at least one TTY and the network device associated with that physical device to be 'valid'. Also move the generic modem support code to a plugin like other modem plugins, and change the I-support-this-device mechanism to return a number indicating the level of support. For example, the generic plugin would return a quite low number if the device indicates via probing that it can do GSM or CDMA, but a more specific plugin can indicate better support for the device, and thus the more specific plugin would win control.
This commit is contained in:
+32
-22
@@ -4,10 +4,9 @@
|
||||
#define MM_PLUGIN_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <libhal.h>
|
||||
#include <mm-modem.h>
|
||||
|
||||
#define MM_PLUGIN_MAJOR_VERSION 1
|
||||
#define MM_PLUGIN_MAJOR_VERSION 2
|
||||
#define MM_PLUGIN_MINOR_VERSION 0
|
||||
|
||||
#define MM_TYPE_PLUGIN (mm_plugin_get_type ())
|
||||
@@ -23,33 +22,44 @@ struct _MMPlugin {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/* Methods */
|
||||
const char *(*get_name) (MMPlugin *self);
|
||||
const char *(*get_name) (MMPlugin *self);
|
||||
|
||||
char **(*list_supported_udis) (MMPlugin *self,
|
||||
LibHalContext *hal_ctx);
|
||||
/* Check whether a plugin supports a particular modem port, and what level
|
||||
* of support the plugin has for the device. The plugin should return a
|
||||
* value between 0 and 100 inclusive, where 0 means the plugin has no
|
||||
* support for the device, and 100 means the plugin has full support for the
|
||||
* device.
|
||||
*/
|
||||
guint32 (*supports_port) (MMPlugin *self,
|
||||
const char *subsys,
|
||||
const char *name);
|
||||
|
||||
gboolean (*supports_udi) (MMPlugin *self,
|
||||
LibHalContext *hal_ctx,
|
||||
const char *udi);
|
||||
|
||||
MMModem *(*create_modem) (MMPlugin *self,
|
||||
LibHalContext *hal_ctx,
|
||||
const char *udi);
|
||||
/* Will only be called if the plugin returns a value greater than 0 for
|
||||
* the supports_port() method for this port. The plugin should create and
|
||||
* return a new modem for the port's device if there is no existing modem
|
||||
* to handle the port's hardware device, or should add the port to an
|
||||
* existing modem and return that modem object. If an error is encountered
|
||||
* while claiming the port, the error information should be returned in the
|
||||
* error argument, and the plugin should return NULL.
|
||||
*/
|
||||
MMModem * (*grab_port) (MMPlugin *self,
|
||||
const char *subsys,
|
||||
const char *name,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
GType mm_plugin_get_type (void);
|
||||
|
||||
const char *mm_plugin_get_name (MMPlugin *plugin);
|
||||
const char *mm_plugin_get_name (MMPlugin *plugin);
|
||||
|
||||
char **mm_plugin_list_supported_udis (MMPlugin *plugin,
|
||||
LibHalContext *hal_ctx);
|
||||
guint32 mm_plugin_supports_port (MMPlugin *plugin,
|
||||
const char *subsys,
|
||||
const char *name);
|
||||
|
||||
gboolean mm_plugin_supports_udi (MMPlugin *plugin,
|
||||
LibHalContext *hal_ctx,
|
||||
const char *udi);
|
||||
|
||||
MMModem *mm_plugin_create_modem (MMPlugin *plugin,
|
||||
LibHalContext *hal_ctx,
|
||||
const char *udi);
|
||||
MMModem *mm_plugin_grab_port (MMPlugin *plugin,
|
||||
const char *subsys,
|
||||
const char *name,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_PLUGIN_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user