示例#1
0
static void mk3_remove(struct connman_device *device) {

	struct mk3_data *mk3 = NULL;

	DBG("device %p", device);

	g_return_if_fail(device);

	mk3 = connman_device_get_data(device);
	if(!mk3) {

		connman_error("Could not get device data");
		return;
	}

	DBG("device %p data %p", device, mk3);

	delete_network(mk3);

	connman_device_set_data(device, NULL);
	connman_device_unref(mk3->device);

	g_free(mk3->devname);
	g_free(mk3->group);
	g_free(mk3->name);
	g_free(mk3->ident);

	g_free(mk3);

}
示例#2
0
文件: wifi.c 项目: cshnick/rpmFromGit
static int wifi_probe(struct connman_device *device)
{
	struct wifi_data *wifi;

	DBG("device %p", device);

	wifi = g_try_new0(struct wifi_data, 1);
	if (wifi == NULL)
		return -ENOMEM;

	wifi->connected = FALSE;
	wifi->disconnecting = FALSE;
	wifi->tethering = FALSE;
	wifi->bridged = FALSE;
	wifi->bridge = NULL;
	wifi->state = G_SUPPLICANT_STATE_INACTIVE;

	connman_device_set_data(device, wifi);
	wifi->device = connman_device_ref(device);

	wifi->index = connman_device_get_index(device);
	wifi->flags = 0;

	wifi->watch = connman_rtnl_add_newlink_watch(wifi->index,
							wifi_newlink, device);

	iface_list = g_list_append(iface_list, wifi);

	return 0;
}
示例#3
0
/**
* @brief Create a new qmi device, set default values and insert it in the hash table.
*/
static int qmi_probe(struct connman_device *device)
{
	struct qmi_data *qmi;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	qmi = g_try_new0(struct qmi_data, 1);
	if(qmi == NULL) {

		connman_error("Allocation error, no memory available.");
		return -ENOMEM;
	}

	DBG("device %p data %p", device, qmi);

	connman_device_set_data(device, qmi);

	qmi->device = connman_device_ref(device);
	qmi->network = NULL;
	qmi->qmi_proxy_device = NULL;
	qmi->modem_opening = FALSE;
	qmi->modem_connected = FALSE;
	qmi->modem_opened = FALSE;

	qmi->imsi = NULL;
	qmi->apn = NULL;
	/* Group has to be "IMSI_qmi" */
	qmi->group = NULL;

	qmi->strength = 0;
	/* Name of the provider e.g "o2" */
	qmi->provider = NULL;
	/* Name of the specific QMI-Device e.g. wwan0 */
	qmi->devname = g_strdup(connman_device_get_string(device, "Interface"));
	/* Index of the specific QMI-Device */
	qmi->index = connman_device_get_index(device);

	qmi->devpath = get_device_path_from_name(qmi->devname);
	qmi->object_path = NULL;
	qmi->qmi_proxy_device = NULL;
	DBG("device name %s path %s", qmi->devname, qmi->devpath);
	if(qmi->devpath == NULL) {

		connman_error("No device path available");
		return -ENODEV;
	}

	connman_device_set_string(device, "Path", qmi->devpath);

	g_hash_table_insert(qmi_hash, qmi->devpath, qmi);

	/* Signal to init thread a new connected modem is available. */
	sem_post(&new_device_sem);

	return 0;
}
示例#4
0
文件: bluetooth.c 项目: igaw/connman
static void device_free(gpointer data)
{
	struct connman_device *device = data;
	GDBusProxy *proxy = connman_device_get_data(device);

	connman_device_set_data(device, NULL);
	if (proxy)
		g_dbus_proxy_unref(proxy);

	connman_device_unregister(device);
	connman_device_unref(device);
}
示例#5
0
static void ethernet_remove(struct connman_device *device)
{
	struct ethernet_data *ethernet = connman_device_get_data(device);

	_DBG_ETHERNET("device %p", device);

	connman_device_set_data(device, NULL);

	connman_rtnl_remove_watch(ethernet->watch);

	g_free(ethernet);
}
示例#6
0
文件: mbm.c 项目: wenhann/chromiumos
static void mbm_remove(struct connman_device *device)
{
	struct mbm_data *data = connman_device_get_data(device);

	_DBG_MBM("device %p", device);

	connman_device_set_data(device, NULL);

	connman_rtnl_remove_watch(data->watch);

	g_free(data);
}
示例#7
0
static int mk3_probe(struct connman_device *device) {

	struct mk3_data *mk3;
	gint i;
	GString *str;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	mk3 = g_try_new0(struct mk3_data, 1);
	if(mk3 == NULL) {

		connman_error("Allocation error, no memory available.");
		return -ENOMEM;
	}

	DBG("device %p data %p", device, mk3);

	connman_device_set_data(device, mk3);
	mk3->device = connman_device_ref(device);

	/* Index of the specific QMI-Device */
	mk3->index = connman_device_get_index(device);
	/* Name of the specific Device  tun_mk3 */
	mk3->devname = g_strdup(connman_device_get_string(device, "Interface"));
	mk3->name = g_strdup("car2car");
	mk3->group = g_strdup("none");

	str = g_string_new(NULL);
	for(i = 0; i < strlen(mk3->devname); i++) {

		g_string_append_printf(str, "%02x", mk3->devname[i]);
	}

	g_string_append_c(str, '_');

	for(i = 0; i < strlen(mk3->name); i++) {

		g_string_append_printf(str, "%02x", mk3->name[i]);
	}

	mk3->ident = g_string_free(str, FALSE);
	connman_device_set_ident(mk3->device, mk3->ident);



	return 0;
}
示例#8
0
static int ethernet_probe(struct connman_device *device)
{
	struct ethernet_data *ethernet;

	_DBG_ETHERNET("device %p", device);

	ethernet = g_try_new0(struct ethernet_data, 1);
	if (ethernet == NULL)
		return -ENOMEM;

	connman_device_set_data(device, ethernet);

	ethernet->index = connman_device_get_index(device);
	ethernet->flags = 0;

	ethernet->watch = connman_rtnl_add_newlink_watch(ethernet->index,
						ethernet_newlink, device);

	return 0;
}
示例#9
0
文件: mbm.c 项目: wenhann/chromiumos
static int mbm_probe(struct connman_device *device)
{
	struct mbm_data *data;
	int index;

	_DBG_MBM("device %p", device);

	data = g_try_new0(struct mbm_data, 1);
	if (data == NULL)
		return -ENOMEM;

	connman_device_set_data(device, data);

	index = connman_device_get_index(device);

	data->watch = connman_rtnl_add_newlink_watch(index,
						mbm_newlink, device);

	return 0;
}
示例#10
0
文件: bluetooth.c 项目: igaw/connman
static void device_create(GDBusProxy *proxy)
{
	struct connman_device *device = NULL;
	const char *path = g_dbus_proxy_get_path(proxy);
	const char *address;
	char ident[BLUETOOTH_ADDR_LEN * 2 + 1];
	bool powered;

	address = proxy_get_string(proxy, "Address");
	if (!address)
		return;

	address2ident(address, ident);

	device = connman_device_create("bluetooth",
			CONNMAN_DEVICE_TYPE_BLUETOOTH);
	if (!device)
		return;

	connman_device_set_data(device, g_dbus_proxy_ref(proxy));
	connman_device_set_ident(device, ident);

	g_hash_table_replace(devices, g_strdup(path), device);

	DBG("device %p %s device powered %d adapter powered %d", device,
			path, connman_device_get_powered(device),
			proxy_get_bool(proxy, "Powered"));

	if (connman_device_register(device) < 0) {
		g_hash_table_remove(devices, device);
		return;
	}

	g_dbus_proxy_set_property_watch(proxy, adapter_property_change, NULL);

	powered = proxy_get_bool(proxy, "Powered");
	connman_device_set_powered(device, powered);

	if (proxy_get_role(proxy) && !bluetooth_tethering)
		tethering_create(path, NULL, NULL, false);
}
示例#11
0
文件: wifi.c 项目: cshnick/rpmFromGit
static void wifi_remove(struct connman_device *device)
{
	struct wifi_data *wifi = connman_device_get_data(device);

	DBG("device %p wifi %p", device, wifi);

	if (wifi == NULL)
		return;

	iface_list = g_list_remove(iface_list, wifi);

	remove_networks(device, wifi);

	connman_device_set_powered(device, FALSE);
	connman_device_set_data(device, NULL);
	connman_device_unref(wifi->device);
	connman_rtnl_remove_watch(wifi->watch);

	g_supplicant_interface_set_data(wifi->interface, NULL);

	g_free(wifi->autoscan);
	g_free(wifi->identifier);
	g_free(wifi);
}