14
14
#include "nm-device-wifi.h"
15
15
#include "nm-device-ethernet.h"
16
16
#include "nm-gsm-device.h"
17
#include "nm-hso-gsm-device.h"
17
18
#include "nm-cdma-device.h"
19
20
/* Killswitch poll frequency in seconds */
225
get_hso_netdev (LibHalContext *ctx, const char *udi)
227
char *serial_parent, *netdev = NULL;
231
/* Get the serial interface's originating device UDI, used to find the
232
* originating device's netdev.
234
serial_parent = libhal_device_get_property_string (ctx, udi, "serial.originating_device", NULL);
236
serial_parent = libhal_device_get_property_string (ctx, udi, "info.parent", NULL);
240
/* Look for the originating device's netdev */
241
netdevs = libhal_find_device_by_capability (ctx, "net", &num, NULL);
242
for (i = 0; netdevs && !netdev && (i < num); i++) {
243
char *netdev_parent, *tmp;
245
netdev_parent = libhal_device_get_property_string (ctx, netdevs[i], "net.originating_device", NULL);
247
netdev_parent = libhal_device_get_property_string (ctx, netdevs[i], "net.physical_device", NULL);
251
if (!strcmp (netdev_parent, serial_parent)) {
253
tmp = libhal_device_get_property_string (ctx, netdevs[i], "net.interface", NULL);
255
netdev = g_strdup (tmp);
256
libhal_free_string (tmp);
260
libhal_free_string (netdev_parent);
262
libhal_free_string_array (netdevs);
263
libhal_free_string (serial_parent);
224
269
modem_device_creator (NMHalManager *self, const char *udi, gboolean managed)
231
276
char **capabilities, **iter;
232
277
gboolean type_gsm = FALSE;
233
278
gboolean type_cdma = FALSE;
235
281
serial_device = libhal_device_get_property_string (priv->hal_ctx, udi, "serial.device", NULL);
274
320
g_strfreev (capabilities);
278
device = (GObject *) nm_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed);
323
/* Special handling of 'hso' cards (until punted out to a modem manager) */
324
if (type_gsm && !strcmp (driver_name, "hso"))
325
netdev = get_hso_netdev (priv->hal_ctx, udi);
329
device = (GObject *) nm_hso_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, netdev, driver_name, managed);
331
device = (GObject *) nm_gsm_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed);
332
} else if (type_cdma)
280
333
device = (GObject *) nm_cdma_device_new (udi, serial_device + strlen ("/dev/"), NULL, driver_name, managed);
303
356
/* Wireless device */
304
357
creator = g_slice_new0 (DeviceCreator);
305
creator->device_type_name = g_strdup ("wireless (802.11)");
358
creator->device_type_name = g_strdup ("802.11 WiFi");
306
359
creator->capability_str = g_strdup ("net.80211");
307
360
creator->is_device_fn = is_wireless_device;
308
361
creator->creator_fn = wireless_device_creator;