void adapter_set_device_wakeable(struct btd_adapter *adapter,
				 struct btd_device *device, bool wakeable)
{
	struct mgmt_cp_set_device_flags cp;
	const bdaddr_t *bdaddr;
	uint8_t bdaddr_type;

	if (!btd_has_kernel_features(KERNEL_CONN_CONTROL))
		return;

	bdaddr = device_get_address(device);
	bdaddr_type = btd_device_get_bdaddr_type(device);

	memset(&cp, 0, sizeof(cp));
	bacpy(&cp.addr.bdaddr, bdaddr);
	cp.addr.type = bdaddr_type;
	cp.current_flags = btd_device_get_current_flags(device);
	if (wakeable)
		cp.current_flags |= DEVICE_FLAG_REMOTE_WAKEUP;
	else
		cp.current_flags &= ~DEVICE_FLAG_REMOTE_WAKEUP;

	mgmt_send(adapter->mgmt, MGMT_OP_SET_DEVICE_FLAGS, adapter->dev_id,
		  sizeof(cp), &cp, set_device_wakeable_complete, adapter, NULL);
}
void adapter_set_device_wakeable(struct btd_adapter *adapter,
				 struct btd_device *device, bool wakeable)
{
	struct mgmt_cp_set_device_flags cp;
	const bdaddr_t *bdaddr;
	uint8_t bdaddr_type;

	if (!btd_has_kernel_features(KERNEL_CONN_CONTROL))
		return;

	bdaddr = device_get_address(device);
	bdaddr_type = btd_device_get_bdaddr_type(device);

	memset(&cp, 0, sizeof(cp));
	bacpy(&cp.addr.bdaddr, bdaddr);
	cp.addr.type = bdaddr_type;
	cp.current_flags = btd_device_get_current_flags(device);
	if (wakeable)
		cp.current_flags |= DEVICE_FLAG_REMOTE_WAKEUP;
	else
		cp.current_flags &= ~DEVICE_FLAG_REMOTE_WAKEUP;

	mgmt_send(adapter->mgmt, MGMT_OP_SET_DEVICE_FLAGS, adapter->dev_id,
		  sizeof(cp), &cp, set_device_wakeable_complete, adapter, NULL);
}