~binli/ubuntu/vivid/modemmanager/lp1441095

« back to all changes in this revision

Viewing changes to plugins/x22x/mm-plugin-x22x.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Guido Günther, Michael Biebl
  • Date: 2014-06-25 02:23:09 UTC
  • mfrom: (20.2.2 sid)
  • Revision ID: package-import@ubuntu.com-20140625022309-43papaenj5ikbx3y
Tags: 1.2.0-1
[ Guido Günther ]
* New upstream version 1.2.0 (Closes: #731851)
* Update patches
* Install locale files
* Require newer libqmi
* Update symbols file
* Ship gobject introspection data
* Ship vala bindings

[ Michael Biebl ]
* Use canonical URI for Vcs-Git
* Use gir dh addon
* Update extendend package description (Closes: #744180)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "mm-plugin-x22x.h"
27
27
#include "mm-broadband-modem-x22x.h"
28
28
 
 
29
#if defined WITH_QMI
 
30
#include "mm-broadband-modem-qmi.h"
 
31
#endif
 
32
 
29
33
G_DEFINE_TYPE (MMPluginX22x, mm_plugin_x22x, MM_TYPE_PLUGIN)
30
34
 
31
35
int mm_plugin_major_version = MM_PLUGIN_MAJOR_VERSION;
185
189
              GList *probes,
186
190
              GError **error)
187
191
{
 
192
#if defined WITH_QMI
 
193
    if (mm_port_probe_list_has_qmi_port (probes)) {
 
194
        mm_dbg ("QMI-powered X22X modem found...");
 
195
        return MM_BASE_MODEM (mm_broadband_modem_qmi_new (sysfs_path,
 
196
                                                          drivers,
 
197
                                                          mm_plugin_get_name (self),
 
198
                                                          vendor,
 
199
                                                          product));
 
200
    }
 
201
#endif
 
202
 
188
203
    return MM_BASE_MODEM (mm_broadband_modem_x22x_new (sysfs_path,
189
204
                                                       drivers,
190
205
                                                       mm_plugin_get_name (self),
205
220
    port = mm_port_probe_peek_port (probe);
206
221
    ptype = mm_port_probe_get_port_type (probe);
207
222
 
208
 
    /* Look for port type hints; just probing can't distinguish which port should
209
 
     * be the data/primary port on these devices.  We have to tag them based on
210
 
     * what the Windows .INF files say the port layout should be.
211
 
     */
212
 
    if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_MODEM")) {
213
 
        mm_dbg ("x22x: AT port '%s/%s' flagged as primary",
214
 
                mm_port_probe_get_port_subsys (probe),
215
 
                mm_port_probe_get_port_name (probe));
216
 
        pflags = MM_AT_PORT_FLAG_PRIMARY;
217
 
    } else if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_AUX")) {
218
 
        mm_dbg ("x22x: AT port '%s/%s' flagged as secondary",
219
 
                mm_port_probe_get_port_subsys (probe),
220
 
                mm_port_probe_get_port_name (probe));
221
 
        pflags = MM_AT_PORT_FLAG_SECONDARY;
222
 
    } else {
223
 
        /* If the port was tagged by the udev rules but isn't a primary or secondary,
224
 
         * then ignore it to guard against race conditions if a device just happens
225
 
         * to show up with more than two AT-capable ports.
 
223
    if (ptype == MM_PORT_TYPE_AT) {
 
224
        /* Look for port type hints; just probing can't distinguish which port should
 
225
         * be the data/primary port on these devices.  We have to tag them based on
 
226
         * what the Windows .INF files say the port layout should be.
226
227
         */
227
 
        ptype = MM_PORT_TYPE_IGNORED;
 
228
        if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_MODEM")) {
 
229
            mm_dbg ("x22x: AT port '%s/%s' flagged as primary",
 
230
                    mm_port_probe_get_port_subsys (probe),
 
231
                    mm_port_probe_get_port_name (probe));
 
232
            pflags = MM_AT_PORT_FLAG_PRIMARY;
 
233
        } else if (g_udev_device_get_property_as_boolean (port, "ID_MM_X22X_PORT_TYPE_AUX")) {
 
234
            mm_dbg ("x22x: AT port '%s/%s' flagged as secondary",
 
235
                    mm_port_probe_get_port_subsys (probe),
 
236
                    mm_port_probe_get_port_name (probe));
 
237
            pflags = MM_AT_PORT_FLAG_SECONDARY;
 
238
        } else {
 
239
            /* If the port was tagged by the udev rules but isn't a primary or secondary,
 
240
             * then ignore it to guard against race conditions if a device just happens
 
241
             * to show up with more than two AT-capable ports.
 
242
             */
 
243
            ptype = MM_PORT_TYPE_IGNORED;
 
244
        }
228
245
    }
229
246
 
230
247
    return mm_base_modem_grab_port (modem,
240
257
G_MODULE_EXPORT MMPlugin *
241
258
mm_plugin_create (void)
242
259
{
243
 
    static const gchar *subsystems[] = { "tty", NULL };
 
260
    static const gchar *subsystems[] = { "tty", "net", "usb", NULL };
244
261
    /* Vendors: TAMobile and Olivetti */
245
262
    static const guint16 vendor_ids[] = { 0x1bbb, 0x0b3c, 0 };
246
263
    /* Only handle X22X tagged devices here. */
259
276
                      MM_PLUGIN_ALLOWED_SUBSYSTEMS, subsystems,
260
277
                      MM_PLUGIN_ALLOWED_VENDOR_IDS, vendor_ids,
261
278
                      MM_PLUGIN_ALLOWED_AT,         TRUE,
 
279
                      MM_PLUGIN_ALLOWED_QMI,        TRUE,
262
280
                      MM_PLUGIN_ALLOWED_UDEV_TAGS,  udev_tags,
263
281
                      MM_PLUGIN_CUSTOM_INIT,        &custom_init,
264
282
                      NULL));