Commit bfe38c1b authored by Thomas Haller's avatar Thomas Haller
Browse files

wwan: make NM_MODEM_DATA_PORT not a construct property

The property was never set at construct time. Don't make
it a construct property.
parent 8209e421
......@@ -629,11 +629,7 @@ set_modem (NMDeviceModem *self, NMModem *modem)
g_signal_connect (modem, NM_MODEM_STATE_CHANGED, G_CALLBACK (modem_state_cb), self);
g_signal_connect (modem, NM_MODEM_REMOVED, G_CALLBACK (modem_removed_cb), self);
/* In the old ModemManager the data port is known from the very beginning;
* while in the new ModemManager the data port is set afterwards when the bearer gets
* created */
g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
g_signal_connect (modem, "notify::" NM_MODEM_DEVICE_ID, G_CALLBACK (ids_changed_cb), self);
g_signal_connect (modem, "notify::" NM_MODEM_SIM_ID, G_CALLBACK (ids_changed_cb), self);
g_signal_connect (modem, "notify::" NM_MODEM_SIM_OPERATOR_ID, G_CALLBACK (ids_changed_cb), self);
......@@ -706,9 +702,9 @@ nm_device_modem_init (NMDeviceModem *self)
NMDevice *
nm_device_modem_new (NMModem *modem)
{
NMDevice *self;
NMDeviceModemCapabilities caps = NM_DEVICE_MODEM_CAPABILITY_NONE;
NMDeviceModemCapabilities current_caps = NM_DEVICE_MODEM_CAPABILITY_NONE;
NMDevice *device;
const char *data_port;
g_return_val_if_fail (NM_IS_MODEM (modem), NULL);
......@@ -716,26 +712,26 @@ nm_device_modem_new (NMModem *modem)
/* Load capabilities */
nm_modem_get_capabilities (modem, &caps, &current_caps);
device = (NMDevice *) g_object_new (NM_TYPE_DEVICE_MODEM,
NM_DEVICE_UDI, nm_modem_get_path (modem),
NM_DEVICE_IFACE, nm_modem_get_uid (modem),
NM_DEVICE_DRIVER, nm_modem_get_driver (modem),
NM_DEVICE_TYPE_DESC, "Broadband",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_MODEM,
NM_DEVICE_RFKILL_TYPE, RFKILL_TYPE_WWAN,
NM_DEVICE_MODEM_MODEM, modem,
NM_DEVICE_MODEM_CAPABILITIES, caps,
NM_DEVICE_MODEM_CURRENT_CAPABILITIES, current_caps,
NULL);
self = g_object_new (NM_TYPE_DEVICE_MODEM,
NM_DEVICE_UDI, nm_modem_get_path (modem),
NM_DEVICE_IFACE, nm_modem_get_uid (modem),
NM_DEVICE_DRIVER, nm_modem_get_driver (modem),
NM_DEVICE_TYPE_DESC, "Broadband",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_MODEM,
NM_DEVICE_RFKILL_TYPE, RFKILL_TYPE_WWAN,
NM_DEVICE_MODEM_MODEM, modem,
NM_DEVICE_MODEM_CAPABILITIES, caps,
NM_DEVICE_MODEM_CURRENT_CAPABILITIES, current_caps,
NULL);
/* If the data port is known, set it as the IP interface immediately */
data_port = nm_modem_get_data_port (modem);
if (data_port) {
nm_device_set_ip_iface (device, data_port);
nm_device_ipv6_sysctl_set (device, "disable_ipv6", "1");
nm_device_set_ip_iface (self, data_port);
nm_device_ipv6_sysctl_set (self, "disable_ipv6", "1");
}
return device;
return self;
}
static void
......
......@@ -1409,35 +1409,34 @@ nm_modem_broadband_init (NMModemBroadband *self)
NMModem *
nm_modem_broadband_new (GObject *object, GError **error)
{
NMModem *modem;
MMObject *modem_object;
MMModem *modem_iface;
gchar *drivers;
const char *const*drivers;
gs_free char *driver = NULL;
g_return_val_if_fail (MM_IS_OBJECT (object), NULL);
modem_object = MM_OBJECT (object);
/* Ensure we have the 'Modem' interface and the primary port at least */
modem_iface = mm_object_peek_modem (modem_object);
g_return_val_if_fail (!!modem_iface, NULL);
g_return_val_if_fail (!!mm_modem_get_primary_port (modem_iface), NULL);
g_return_val_if_fail (modem_iface, NULL);
g_return_val_if_fail (mm_modem_get_primary_port (modem_iface), NULL);
/* Build a single string with all drivers listed */
drivers = g_strjoinv (", ", (gchar **)mm_modem_get_drivers (modem_iface));
modem = g_object_new (NM_TYPE_MODEM_BROADBAND,
NM_MODEM_PATH, mm_object_get_path (modem_object),
NM_MODEM_UID, mm_modem_get_primary_port (modem_iface),
NM_MODEM_CONTROL_PORT, mm_modem_get_primary_port (modem_iface),
NM_MODEM_DATA_PORT, NULL, /* We don't know it until bearer created */
NM_MODEM_IP_TYPES, mm_ip_family_to_nm (mm_modem_get_supported_ip_families (modem_iface)),
NM_MODEM_STATE, (int) mm_state_to_nm (mm_modem_get_state (modem_iface)),
NM_MODEM_DEVICE_ID, mm_modem_get_device_identifier (modem_iface),
NM_MODEM_BROADBAND_MODEM, modem_object,
NM_MODEM_DRIVER, drivers,
NULL);
g_free (drivers);
return modem;
drivers = mm_modem_get_drivers (modem_iface);
if (drivers)
driver = g_strjoinv (", ", (char **) drivers);
return g_object_new (NM_TYPE_MODEM_BROADBAND,
NM_MODEM_PATH, mm_object_get_path (modem_object),
NM_MODEM_UID, mm_modem_get_primary_port (modem_iface),
NM_MODEM_CONTROL_PORT, mm_modem_get_primary_port (modem_iface),
NM_MODEM_IP_TYPES, mm_ip_family_to_nm (mm_modem_get_supported_ip_families (modem_iface)),
NM_MODEM_STATE, (int) mm_state_to_nm (mm_modem_get_state (modem_iface)),
NM_MODEM_DEVICE_ID, mm_modem_get_device_identifier (modem_iface),
NM_MODEM_BROADBAND_MODEM, modem_object,
NM_MODEM_DRIVER, driver,
NULL);
}
static void
......
......@@ -1690,7 +1690,7 @@ constructed (GObject *object)
priv = NM_MODEM_GET_PRIVATE (NM_MODEM (object));
g_return_if_fail (priv->data_port || priv->control_port);
g_return_if_fail (priv->control_port);
}
/*****************************************************************************/
......@@ -1767,7 +1767,7 @@ nm_modem_class_init (NMModemClass *klass)
obj_properties[PROP_DATA_PORT] =
g_param_spec_string (NM_MODEM_DATA_PORT, "", "",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT |
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
obj_properties[PROP_IP_IFINDEX] =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment