Beispiel #1
0
int input_device_register(struct btd_service *service)
{
    struct btd_device *device = btd_service_get_device(service);
    const char *path = device_get_path(device);
    struct input_device *idev;

    DBG("%s", path);

    idev = input_device_new(service);
    if (!idev)
        return -EINVAL;

    if (g_dbus_register_interface(btd_get_dbus_connection(),
                                  idev->path, INPUT_INTERFACE,
                                  NULL, NULL,
                                  input_properties, idev,
                                  NULL) == FALSE) {
        error("Unable to register %s interface", INPUT_INTERFACE);
        input_device_free(idev);
        return -EINVAL;
    }

    btd_service_set_user_data(service, idev);

    return 0;
}
Beispiel #2
0
int fake_input_register(DBusConnection *conn, struct btd_device *device,
			const char *path, bdaddr_t *src, bdaddr_t *dst,
			const char *uuid, uint8_t channel)
{
	struct input_device *idev;
	struct input_conn *iconn;

	idev = find_device_by_path(devices, path);
	if (!idev) {
		idev = input_device_new(conn, device, path, src, dst, 0);
		if (!idev)
			return -EINVAL;
		devices = g_slist_append(devices, idev);
	}

	iconn = input_conn_new(idev, uuid, "hsp", 0);
	if (!iconn)
		return -EINVAL;

	iconn->fake = g_new0(struct fake_input, 1);
	iconn->fake->ch = channel;
	iconn->fake->connect = rfcomm_connect;
	iconn->fake->disconnect = fake_disconnect;

	idev->connections = g_slist_append(idev->connections, iconn);

	return 0;
}
Beispiel #3
0
int input_device_register(DBusConnection *conn, struct btd_device *device,
			const char *path, const bdaddr_t *src,
			const bdaddr_t *dst, const char *uuid,
			uint32_t handle, int timeout)
{
	struct input_device *idev;
	struct input_conn *iconn;

	idev = find_device_by_path(devices, path);
	if (!idev) {
		idev = input_device_new(conn, device, path, src, dst, handle);
		if (!idev)
			return -EINVAL;
		devices = g_slist_append(devices, idev);
	}

	iconn = input_conn_new(idev, uuid, "hid", timeout);
	if (!iconn)
		return -EINVAL;

	idev->connections = g_slist_append(idev->connections, iconn);

	return 0;
}
Beispiel #4
0
int input_device_register(DBusConnection *conn, struct btd_device *device,
					const char *path, const char *uuid,
					const sdp_record_t *rec, int timeout)
{
	struct input_device *idev;
	struct input_conn *iconn;

	DBG("path %s, uuid %s", path, uuid);

	idev = find_device_by_path(devices, path);
	if (!idev) {
		idev = input_device_new(conn, device, path, rec->handle,
					is_device_sdp_disable(rec));
		if (!idev)
			return -EINVAL;
		devices = g_slist_append(devices, idev);
	}

	iconn = input_conn_new(idev, uuid, timeout);

	idev->connections = g_slist_append(idev->connections, iconn);

	return 0;
}