Example #1
0
static int
mk3_init(void) {

	int err;

	DBG("");


	err = connman_network_driver_register(&network_driver);
	if(err < 0) {

		connman_error("Register network driver");
		return err;
	}

	err = connman_device_driver_register(&mk3_driver);
	if(err < 0) {

		connman_error("Register device driver");
		connman_network_driver_unregister(&network_driver);
		return err;
	}

	err = connman_technology_driver_register(&tech_driver);
	if(err < 0) {

		connman_error("Register technology driver");
		connman_network_driver_unregister(&network_driver);
		connman_device_driver_unregister(&mk3_driver);

		return err;
	}

	return 0;
}
Example #2
0
static int ethernet_init(void)
{
    int err;

    err = connman_technology_driver_register(&eth_driver);
    if (err < 0)
        return err;

    err = connman_network_driver_register(&cable_driver);
    if (err < 0)
        return err;

    err = connman_device_driver_register(&ethernet_driver);
    if (err < 0) {
        connman_network_driver_unregister(&cable_driver);
        return err;
    }

    err = connman_technology_driver_register(&tech_driver);
    if (err < 0) {
        connman_device_driver_unregister(&ethernet_driver);
        connman_network_driver_unregister(&cable_driver);
        return err;
    }

    return 0;
}
Example #3
0
static void bluetooth_exit(void)
{
	g_dbus_remove_watch(connection, watch);
	g_dbus_remove_watch(connection, added_watch);
	g_dbus_remove_watch(connection, removed_watch);
	g_dbus_remove_watch(connection, adapter_watch);
	g_dbus_remove_watch(connection, device_removed_watch);
	g_dbus_remove_watch(connection, device_watch);
	g_dbus_remove_watch(connection, network_watch);

	/*
	 * We unset the disabling of the Bluetooth device when shutting down
	 * so that non-PAN BT connections are not affected.
	 */
	bluetooth_driver.disable = NULL;

	bluetooth_disconnect(connection, NULL);

	connman_technology_driver_unregister(&tech_driver);

	connman_device_driver_unregister(&bluetooth_driver);
	connman_network_driver_unregister(&pan_driver);

	dbus_connection_unref(connection);
}
Example #4
0
static void ethernet_exit(void)
{
    connman_technology_driver_unregister(&eth_driver);

    connman_technology_driver_unregister(&tech_driver);

    connman_network_driver_unregister(&cable_driver);

    connman_device_driver_unregister(&ethernet_driver);
}
Example #5
0
static void
mk3_exit(void) {

	DBG("");

	connman_device_driver_unregister(&mk3_driver);
	connman_network_driver_unregister(&network_driver);
	connman_technology_driver_register(&tech_driver);


}
Example #6
0
static void bluetooth_exit(void)
{
	connman_network_driver_unregister(&network_driver);
	g_hash_table_destroy(networks);

	connman_device_driver_unregister(&device_driver);
	g_hash_table_destroy(devices);

	connman_technology_driver_unregister(&tech_driver);
	dbus_connection_unref(connection);
}
Example #7
0
static int mbm_init(void)
{
	int err;

	err = connman_network_driver_register(&network_driver);
	if (err < 0)
		return err;

	err = connman_device_driver_register(&mbm_driver);
	if (err < 0) {
		connman_network_driver_unregister(&network_driver);
		return err;
	}

	return 0;
}
Example #8
0
static void bluetooth_exit(void)
{
	/*
	 * We unset the disabling of the Bluetooth device when shutting down
	 * so that non-PAN BT connections are not affected.
	 */
	device_driver.disable = NULL;

	g_dbus_client_unref(client);

	connman_network_driver_unregister(&network_driver);
	g_hash_table_destroy(networks);

	connman_device_driver_unregister(&device_driver);
	g_hash_table_destroy(devices);

	connman_technology_driver_unregister(&tech_driver);
	dbus_connection_unref(connection);
}
Example #9
0
static void bluetooth_exit(void)
{
	g_dbus_remove_watch(connection, watch);
	g_dbus_remove_watch(connection, added_watch);
	g_dbus_remove_watch(connection, removed_watch);
	g_dbus_remove_watch(connection, adapter_watch);
	g_dbus_remove_watch(connection, device_removed_watch);
	g_dbus_remove_watch(connection, device_watch);
	g_dbus_remove_watch(connection, network_watch);

	bluetooth_disconnect(connection, NULL);

	connman_technology_driver_unregister(&tech_driver);

	connman_device_driver_unregister(&bluetooth_driver);
	connman_network_driver_unregister(&pan_driver);

	dbus_connection_unref(connection);
}
Example #10
0
static void qmi_exit(void)
{
	DBG("");

	/* Remove all watching signals */
	g_dbus_remove_watch(connection, watch_service);
	g_dbus_remove_watch(connection, watch_property_changed);
	g_dbus_remove_watch(connection, watch_state_changed);
	g_dbus_remove_watch(connection, watch_technology_changed);

	/* Close all opened qmi devices, do this before unref all D-Bus connections */
	if(qmi_hash) {

		g_hash_table_foreach(qmi_hash, close_modem, NULL);

	}

	qmi_service_connected = FALSE;

	/* Unregister all drivers */
	connman_device_driver_unregister(&qmi_driver);
	connman_network_driver_unregister(&network_driver);
	connman_technology_driver_unregister(&tech_driver);

	g_dbus_proxy_unref(qmi_proxy_manager);
	g_dbus_client_unref(qmi_client);
	dbus_connection_unref(connection);

	sem_post(&new_device_sem);
	pthread_join(init_modems_id, NULL);
	sem_destroy(&new_device_sem);

	/* Free all devices and its allocated memory */
	if(qmi_hash) {

		g_hash_table_destroy(qmi_hash);
		qmi_hash = NULL;
	}

}
Example #11
0
static int qmi_init(void)
{
	int err = 0;

	DBG("");

	err = sem_init(&new_device_sem, 0, 0);
	if(err == -1) {

		connman_error("Failure init semaphore, error %d", errno);
		return -errno;
	}

	/* Create new hash table to store all connecting devices */
	qmi_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free_hash_values);
	if(qmi_hash == NULL) {

		connman_error("Hash table could not be created.");
		return -ENOMEM;
	}

	connection = connman_dbus_get_connection();
	if(connection == NULL) {

		connman_error("D-Bus connection failed");
		return -EIO;
	}

	/* Create new D-Bus client to address qmi-dbus server */
	qmi_client = g_dbus_client_new(	connection,
									QMI_SERVICE,
									QMI_PATH);
	if(qmi_client == NULL) {

		connman_error("D-Bus client not created");
		return -EIO;
	}

	/* Create new proxy client to address qmi-dbus manager interface */
	qmi_proxy_manager = g_dbus_proxy_new(	qmi_client,
											QMI_MANAGER_PATH,
											QMI_MANAGER_INTERFACE);

	if(qmi_proxy_manager == NULL) {

		connman_error("QMI proxy manager not created");
		g_dbus_client_unref(qmi_client);
		return -EIO;
	}

	/* Watch appearing qmi-dbus */
	watch_service = g_dbus_add_service_watch(	connection,
												QMI_SERVICE,
												on_handle_qmi_connect,
												on_handle_qmi_disconnect,
												NULL, NULL);

	/* Watching qmi-dbus signals */
	watch_property_changed = g_dbus_add_signal_watch(	connection,
														QMI_SERVICE, NULL,
														QMI_DEVICE_INTERFACE, PROPERTY_CHANGED,
														on_handle_property_changed,
														NULL, NULL);

	watch_state_changed = g_dbus_add_signal_watch(	connection,
													QMI_SERVICE, NULL,
													QMI_DEVICE_INTERFACE, STATE_CHANGED,
													on_handle_state_changed,
													NULL, NULL);

	watch_technology_changed = g_dbus_add_signal_watch(	connection,
														QMI_SERVICE, NULL,
														QMI_DEVICE_INTERFACE, TECHNOLOGY_CHANGED,
														on_handle_technology_changed,
														NULL, NULL);


	if((watch_service == 0) ||
		(watch_property_changed == 0) ||
		(watch_state_changed == 0) ||
		(watch_technology_changed == 0))	{

		connman_error("Adding service or signal watch");
		err = -EIO;
		goto remove;
	}

	err = connman_network_driver_register(&network_driver);
	if(err < 0) {

		connman_error("Register network driver");
		goto remove;
	}

	err = connman_device_driver_register(&qmi_driver);
	if(err < 0) {

		connman_error("Register device driver");
		connman_network_driver_unregister(&network_driver);
		goto remove;
	}

	err = connman_technology_driver_register(&tech_driver);
	if(err < 0) {

		connman_error("Register technology driver");
		connman_network_driver_unregister(&network_driver);
		connman_device_driver_unregister(&qmi_driver);
		goto remove;
	}

	return 0;

remove:

	g_dbus_remove_watch(connection, watch_service);
	g_dbus_remove_watch(connection, watch_property_changed);
	g_dbus_remove_watch(connection, watch_state_changed);
	g_dbus_remove_watch(connection, watch_technology_changed);
	g_dbus_proxy_unref(qmi_proxy_manager);
	g_dbus_client_unref(qmi_client);
	dbus_connection_unref(connection);

	return err;
}
Example #12
0
static int bluetooth_init(void)
{
	int err;

	connection = connman_dbus_get_connection();
	if (connection == NULL)
		return -EIO;

	watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
			bluetooth_connect, bluetooth_disconnect, NULL, NULL);

	added_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
						BLUEZ_MANAGER_INTERFACE,
						ADAPTER_ADDED, adapter_added,
						NULL, NULL);

	removed_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
						BLUEZ_MANAGER_INTERFACE,
						ADAPTER_REMOVED, adapter_removed,
						NULL, NULL);

	adapter_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE,
						NULL, BLUEZ_ADAPTER_INTERFACE,
						PROPERTY_CHANGED, adapter_changed,
						NULL, NULL);

	device_removed_watch = g_dbus_add_signal_watch(connection,
						BLUEZ_SERVICE, NULL,
						BLUEZ_ADAPTER_INTERFACE,
						DEVICE_REMOVED, device_removed,
						NULL, NULL);

	device_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE, NULL,
						BLUEZ_DEVICE_INTERFACE,
						PROPERTY_CHANGED, device_changed,
						NULL, NULL);

	network_watch = g_dbus_add_signal_watch(connection, BLUEZ_SERVICE,
						NULL, BLUEZ_NETWORK_INTERFACE,
						PROPERTY_CHANGED, network_changed,
						NULL, NULL);

	if (watch == 0 || added_watch == 0 || removed_watch == 0
			|| adapter_watch == 0 || network_watch == 0
				|| device_watch == 0
					|| device_removed_watch == 0) {
		err = -EIO;
		goto remove;
	}

	err = connman_network_driver_register(&pan_driver);
	if (err < 0)
		goto remove;

	err = connman_device_driver_register(&bluetooth_driver);
	if (err < 0) {
		connman_network_driver_unregister(&pan_driver);
		goto remove;
	}

	err = connman_technology_driver_register(&tech_driver);
	if (err < 0) {
		connman_device_driver_unregister(&bluetooth_driver);
		connman_network_driver_unregister(&pan_driver);
		goto remove;
	}

	return 0;

remove:
	g_dbus_remove_watch(connection, watch);
	g_dbus_remove_watch(connection, added_watch);
	g_dbus_remove_watch(connection, removed_watch);
	g_dbus_remove_watch(connection, adapter_watch);
	g_dbus_remove_watch(connection, device_removed_watch);
	g_dbus_remove_watch(connection, device_watch);
	g_dbus_remove_watch(connection, network_watch);

	dbus_connection_unref(connection);

	return err;
}