/* Allocate buffer for HCI command, fill in parameters and send the command...  */
static int send_hci_command(uint16_t opcode, uint8_t param_len, uint16_t response)
/* Allocate buffer for HCI command, fill in parameters and send the command...  */
static int send_hci_command(uint16_t opcode, uint8_t param_len, uint16_t response)
{
	struct net_buf *buf;
	void *cp;
	int err = 0;
	waiting_response = response;
	buf = hci_cmd_create(waiting_opcode = opcode, param_len);
	if (buf) {
		if (param_len) {
			cp = net_buf_add(buf, param_len);
			edtt_read((uint8_t *)cp, param_len, EDTTT_BLOCK);
		}
		err = bt_send(buf);
		if (err) {
			LOG_ERR("Failed to send HCI command %d (err %d)",
				opcode, err);
			error_response(err);
		}
	} else {
		LOG_ERR("Failed to create buffer for HCI command 0x%04x",
			opcode);
		error_response(-1);
	}
	return err;
}