From 9d7f5b3d084eee2ccfff721c4beca3e3f34bdc50 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 2 Mar 2009 16:46:55 -0500 Subject: [PATCH] modem: use only usb interface 0 for Option modems driven by 'option' Actual Option cards (not cards by other manufacturers that just happen to use the 'option' driver) are supposed to always use usb interface 0 as the "modem" port, per mail with Option engineering. Only the "modem" port will emit unsolicited responses like CONNECT which of course are required to drive the card. --- src/nm-hal-manager.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/nm-hal-manager.c b/src/nm-hal-manager.c index ad47f08310..c5fbf1c5f4 100644 --- a/src/nm-hal-manager.c +++ b/src/nm-hal-manager.c @@ -570,7 +570,7 @@ modem_device_creator (NMHalManager *self, type_gsm ? "GSM" : "CDMA", udev ? "udev" : "HAL"); - /* Special handling of 'hso' cards (until punted out to a modem manager) */ + /* Special handling of 'hso' cards (until punted to ModemManager) */ if (type_gsm && !strcmp (driver, "hso")) { char *hsotype_path; char *contents = NULL; @@ -595,6 +595,28 @@ modem_device_creator (NMHalManager *self, netdev = get_hso_netdev (priv->hal_ctx, udi); } + /* Special handling of Option cards (until punted to ModemManager). Only + * the first USB interface can be used for control and PPP. + */ + if (type_gsm && !strcmp (driver, "option")) { + char *parent; + guint32 vendor_id = 0, usb_interface = 0; + + parent = libhal_device_get_property_string (priv->hal_ctx, udi, "info.parent", NULL); + if (!parent) + goto out; + + vendor_id = libhal_device_get_property_int (priv->hal_ctx, parent, "usb.vendor_id", NULL); + if (vendor_id == 0x0AF0) { + usb_interface = libhal_device_get_property_int (priv->hal_ctx, parent, "usb.interface.number", NULL); + if (usb_interface > 0) { + g_free (parent); + goto out; + } + } + g_free (parent); + } + if (type_gsm) { if (netdev) device = (GObject *) nm_hso_gsm_device_new (udi, ttyname, NULL, netdev, driver, managed);