static struct input_device *input_device_new(struct btd_service *service) { struct btd_device *device = btd_service_get_device(service); struct btd_profile *p = btd_service_get_profile(service); const char *path = device_get_path(device); const sdp_record_t *rec = btd_device_get_record(device, p->remote_uuid); struct btd_adapter *adapter = device_get_adapter(device); struct input_device *idev; if (!rec) return NULL; idev = g_new0(struct input_device, 1); bacpy(&idev->src, btd_adapter_get_address(adapter)); bacpy(&idev->dst, device_get_address(device)); idev->service = btd_service_ref(service); idev->device = btd_device_ref(device); idev->path = g_strdup(path); idev->handle = rec->handle; idev->disable_sdp = is_device_sdp_disable(rec); /* Initialize device properties */ extract_hid_props(idev, rec); return idev; }
static void policy_disconnect(struct policy_data *data, struct btd_service *service) { struct btd_profile *profile = btd_service_get_profile(service); DBG("%s profile %s", device_get_path(data->dev), profile->name); btd_service_disconnect(service); }
static uint16_t get_service_id(struct btd_service *service) { return bnep_service_id(btd_service_get_profile(service)->remote_uuid); }