From patchwork Wed Nov 20 09:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11253385 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE5B21593 for ; Wed, 20 Nov 2019 09:13:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8392721850 for ; Wed, 20 Nov 2019 09:13:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jOIgVMYN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8392721850 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:55066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXM2w-0003az-Ka for patchwork-qemu-devel@patchwork.kernel.org; Wed, 20 Nov 2019 04:13:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40238) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iXM0f-0000PQ-4r for qemu-devel@nongnu.org; Wed, 20 Nov 2019 04:10:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iXM0c-0003gl-Cw for qemu-devel@nongnu.org; Wed, 20 Nov 2019 04:10:48 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39175 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iXM0c-0003gF-7o for qemu-devel@nongnu.org; Wed, 20 Nov 2019 04:10:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574241045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jx6W6KbdS+Sf1/npLnl4DNxMvQ4NqoCiN0H3GPqK6b0=; b=jOIgVMYNH2yGgxqXMJGMlDsil1AZEq2b3Zczrnrbe8PX4XnxTUW38qCK8u13Fk0lqWmuT8 MidT41ynjpmvxqldFZ/hVaG648A0bfl8c+/K4mCQqGFRtyQqo8Lh/6YkrBUQHOK7wgBGht chE2WSJKUPIQznrN4kDN9prQuVC9qf8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-VqG_IjzxOsyT0UHv2-X2rQ-1; Wed, 20 Nov 2019 04:10:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 589B0107ACE3; Wed, 20 Nov 2019 09:10:41 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-131.ams2.redhat.com [10.36.116.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD0A760BAB; Wed, 20 Nov 2019 09:10:36 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell , Gerd Hoffmann Subject: [PATCH for-5.0 2/4] hw/usb: Remove the USB bluetooth dongle device Date: Wed, 20 Nov 2019 10:10:12 +0100 Message-Id: <20191120091014.16883-3-thuth@redhat.com> In-Reply-To: <20191120091014.16883-1-thuth@redhat.com> References: <20191120091014.16883-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: VqG_IjzxOsyT0UHv2-X2rQ-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: libvir-list@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We are going to remove the bluetooth backend, so the USB bluetooth dongle can not work anymore. It's a completely optional device, no board depends on it, so let's simply remove it now. Signed-off-by: Thomas Huth Reviewed-by: Ján Tomko --- hw/usb/Kconfig | 5 - hw/usb/Makefile.objs | 1 - hw/usb/dev-bluetooth.c | 581 ----------------------------------------- qemu-doc.texi | 15 -- 4 files changed, 602 deletions(-) delete mode 100644 hw/usb/dev-bluetooth.c diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig index 555e09377b..5e70ed5f7b 100644 --- a/hw/usb/Kconfig +++ b/hw/usb/Kconfig @@ -82,11 +82,6 @@ config USB_NETWORK default y depends on USB -config USB_BLUETOOTH - bool - default y - depends on USB - config USB_SMARTCARD bool default y diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 303ac084a0..0ab20f9d73 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -25,7 +25,6 @@ common-obj-$(CONFIG_USB_STORAGE_UAS) += dev-uas.o common-obj-$(CONFIG_USB_AUDIO) += dev-audio.o common-obj-$(CONFIG_USB_SERIAL) += dev-serial.o common-obj-$(CONFIG_USB_NETWORK) += dev-network.o -common-obj-$(CONFIG_USB_BLUETOOTH) += dev-bluetooth.o ifeq ($(CONFIG_USB_SMARTCARD),y) common-obj-y += dev-smartcard-reader.o diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c deleted file mode 100644 index f6944fa74f..0000000000 --- a/hw/usb/dev-bluetooth.c +++ /dev/null @@ -1,581 +0,0 @@ -/* - * QEMU Bluetooth HCI USB Transport Layer v1.0 - * - * Copyright (C) 2007 OpenMoko, Inc. - * Copyright (C) 2008 Andrzej Zaborowski - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 or - * (at your option) version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, see . - */ - -#include "qemu/osdep.h" -#include "qemu/error-report.h" -#include "qemu/module.h" -#include "hw/usb.h" -#include "migration/vmstate.h" -#include "desc.h" -#include "sysemu/bt.h" -#include "hw/bt.h" - -struct USBBtState { - USBDevice dev; - struct HCIInfo *hci; - USBEndpoint *intr; - - int config; - -#define CFIFO_LEN_MASK 255 -#define DFIFO_LEN_MASK 4095 - struct usb_hci_in_fifo_s { - uint8_t data[(DFIFO_LEN_MASK + 1) * 2]; - struct { - uint8_t *data; - int len; - } fifo[CFIFO_LEN_MASK + 1]; - int dstart, dlen, dsize, start, len; - } evt, acl, sco; - - struct usb_hci_out_fifo_s { - uint8_t data[4096]; - int len; - } outcmd, outacl, outsco; -}; - -#define TYPE_USB_BT "usb-bt-dongle" -#define USB_BT(obj) OBJECT_CHECK(struct USBBtState, (obj), TYPE_USB_BT) - -#define USB_EVT_EP 1 -#define USB_ACL_EP 2 -#define USB_SCO_EP 3 - -enum { - STR_MANUFACTURER = 1, - STR_SERIALNUMBER, -}; - -static const USBDescStrings desc_strings = { - [STR_MANUFACTURER] = "QEMU", - [STR_SERIALNUMBER] = "1", -}; - -static const USBDescIface desc_iface_bluetooth[] = { - { - .bInterfaceNumber = 0, - .bNumEndpoints = 3, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_IN | USB_EVT_EP, - .bmAttributes = USB_ENDPOINT_XFER_INT, - .wMaxPacketSize = 0x10, - .bInterval = 0x02, - }, - { - .bEndpointAddress = USB_DIR_OUT | USB_ACL_EP, - .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = 0x40, - .bInterval = 0x0a, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_ACL_EP, - .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = 0x40, - .bInterval = 0x0a, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 0, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0, - .bInterval = 0x01, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 1, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x09, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x09, - .bInterval = 0x01, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 2, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x11, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x11, - .bInterval = 0x01, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 3, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x19, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x19, - .bInterval = 0x01, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 4, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x21, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x21, - .bInterval = 0x01, - }, - }, - },{ - .bInterfaceNumber = 1, - .bAlternateSetting = 5, - .bNumEndpoints = 2, - .bInterfaceClass = 0xe0, /* Wireless */ - .bInterfaceSubClass = 0x01, /* Radio Frequency */ - .bInterfaceProtocol = 0x01, /* Bluetooth */ - .eps = (USBDescEndpoint[]) { - { - .bEndpointAddress = USB_DIR_OUT | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x31, - .bInterval = 0x01, - }, - { - .bEndpointAddress = USB_DIR_IN | USB_SCO_EP, - .bmAttributes = USB_ENDPOINT_XFER_ISOC, - .wMaxPacketSize = 0x31, - .bInterval = 0x01, - }, - }, - } -}; - -static const USBDescDevice desc_device_bluetooth = { - .bcdUSB = 0x0110, - .bDeviceClass = 0xe0, /* Wireless */ - .bDeviceSubClass = 0x01, /* Radio Frequency */ - .bDeviceProtocol = 0x01, /* Bluetooth */ - .bMaxPacketSize0 = 64, - .bNumConfigurations = 1, - .confs = (USBDescConfig[]) { - { - .bNumInterfaces = 2, - .bConfigurationValue = 1, - .bmAttributes = USB_CFG_ATT_ONE | USB_CFG_ATT_SELFPOWER, - .bMaxPower = 0, - .nif = ARRAY_SIZE(desc_iface_bluetooth), - .ifs = desc_iface_bluetooth, - }, - }, -}; - -static const USBDesc desc_bluetooth = { - .id = { - .idVendor = 0x0a12, - .idProduct = 0x0001, - .bcdDevice = 0x1958, - .iManufacturer = STR_MANUFACTURER, - .iProduct = 0, - .iSerialNumber = STR_SERIALNUMBER, - }, - .full = &desc_device_bluetooth, - .str = desc_strings, -}; - -static void usb_bt_fifo_reset(struct usb_hci_in_fifo_s *fifo) -{ - fifo->dstart = 0; - fifo->dlen = 0; - fifo->dsize = DFIFO_LEN_MASK + 1; - fifo->start = 0; - fifo->len = 0; -} - -static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo, - const uint8_t *data, int len) -{ - int off = fifo->dstart + fifo->dlen; - uint8_t *buf; - - fifo->dlen += len; - if (off <= DFIFO_LEN_MASK) { - if (off + len > DFIFO_LEN_MASK + 1 && - (fifo->dsize = off + len) > (DFIFO_LEN_MASK + 1) * 2) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); - exit(-1); - } - buf = fifo->data + off; - } else { - if (fifo->dlen > fifo->dsize) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); - exit(-1); - } - buf = fifo->data + off - fifo->dsize; - } - - off = (fifo->start + fifo->len ++) & CFIFO_LEN_MASK; - fifo->fifo[off].data = memcpy(buf, data, len); - fifo->fifo[off].len = len; -} - -static inline void usb_bt_fifo_dequeue(struct usb_hci_in_fifo_s *fifo, - USBPacket *p) -{ - int len; - - assert(fifo->len != 0); - - len = MIN(p->iov.size, fifo->fifo[fifo->start].len); - usb_packet_copy(p, fifo->fifo[fifo->start].data, len); - if (len == p->iov.size) { - fifo->fifo[fifo->start].len -= len; - fifo->fifo[fifo->start].data += len; - } else { - fifo->start ++; - fifo->start &= CFIFO_LEN_MASK; - fifo->len --; - } - - fifo->dstart += len; - fifo->dlen -= len; - if (fifo->dstart >= fifo->dsize) { - fifo->dstart = 0; - fifo->dsize = DFIFO_LEN_MASK + 1; - } -} - -static inline void usb_bt_fifo_out_enqueue(struct USBBtState *s, - struct usb_hci_out_fifo_s *fifo, - void (*send)(struct HCIInfo *, const uint8_t *, int), - int (*complete)(const uint8_t *, int), - USBPacket *p) -{ - usb_packet_copy(p, fifo->data + fifo->len, p->iov.size); - fifo->len += p->iov.size; - if (complete(fifo->data, fifo->len)) { - send(s->hci, fifo->data, fifo->len); - fifo->len = 0; - } - - /* TODO: do we need to loop? */ -} - -static int usb_bt_hci_cmd_complete(const uint8_t *data, int len) -{ - len -= HCI_COMMAND_HDR_SIZE; - return len >= 0 && - len >= ((struct hci_command_hdr *) data)->plen; -} - -static int usb_bt_hci_acl_complete(const uint8_t *data, int len) -{ - len -= HCI_ACL_HDR_SIZE; - return len >= 0 && - len >= le16_to_cpu(((struct hci_acl_hdr *) data)->dlen); -} - -static int usb_bt_hci_sco_complete(const uint8_t *data, int len) -{ - len -= HCI_SCO_HDR_SIZE; - return len >= 0 && - len >= ((struct hci_sco_hdr *) data)->dlen; -} - -static void usb_bt_handle_reset(USBDevice *dev) -{ - struct USBBtState *s = (struct USBBtState *) dev->opaque; - - usb_bt_fifo_reset(&s->evt); - usb_bt_fifo_reset(&s->acl); - usb_bt_fifo_reset(&s->sco); - s->outcmd.len = 0; - s->outacl.len = 0; - s->outsco.len = 0; -} - -static void usb_bt_handle_control(USBDevice *dev, USBPacket *p, - int request, int value, int index, int length, uint8_t *data) -{ - struct USBBtState *s = (struct USBBtState *) dev->opaque; - int ret; - - ret = usb_desc_handle_control(dev, p, request, value, index, length, data); - if (ret >= 0) { - switch (request) { - case DeviceRequest | USB_REQ_GET_CONFIGURATION: - s->config = 0; - break; - case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: - s->config = 1; - usb_bt_fifo_reset(&s->evt); - usb_bt_fifo_reset(&s->acl); - usb_bt_fifo_reset(&s->sco); - break; - } - return; - } - - switch (request) { - case InterfaceRequest | USB_REQ_GET_STATUS: - case EndpointRequest | USB_REQ_GET_STATUS: - data[0] = 0x00; - data[1] = 0x00; - p->actual_length = 2; - break; - case InterfaceOutRequest | USB_REQ_CLEAR_FEATURE: - case EndpointOutRequest | USB_REQ_CLEAR_FEATURE: - goto fail; - case InterfaceOutRequest | USB_REQ_SET_FEATURE: - case EndpointOutRequest | USB_REQ_SET_FEATURE: - goto fail; - break; - case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_DEVICE) << 8): - if (s->config) - usb_bt_fifo_out_enqueue(s, &s->outcmd, s->hci->cmd_send, - usb_bt_hci_cmd_complete, p); - break; - default: - fail: - p->status = USB_RET_STALL; - break; - } -} - -static void usb_bt_handle_data(USBDevice *dev, USBPacket *p) -{ - struct USBBtState *s = (struct USBBtState *) dev->opaque; - - if (!s->config) - goto fail; - - switch (p->pid) { - case USB_TOKEN_IN: - switch (p->ep->nr) { - case USB_EVT_EP: - if (s->evt.len == 0) { - p->status = USB_RET_NAK; - break; - } - usb_bt_fifo_dequeue(&s->evt, p); - break; - - case USB_ACL_EP: - if (s->evt.len == 0) { - p->status = USB_RET_STALL; - break; - } - usb_bt_fifo_dequeue(&s->acl, p); - break; - - case USB_SCO_EP: - if (s->evt.len == 0) { - p->status = USB_RET_STALL; - break; - } - usb_bt_fifo_dequeue(&s->sco, p); - break; - - default: - goto fail; - } - break; - - case USB_TOKEN_OUT: - switch (p->ep->nr) { - case USB_ACL_EP: - usb_bt_fifo_out_enqueue(s, &s->outacl, s->hci->acl_send, - usb_bt_hci_acl_complete, p); - break; - - case USB_SCO_EP: - usb_bt_fifo_out_enqueue(s, &s->outsco, s->hci->sco_send, - usb_bt_hci_sco_complete, p); - break; - - default: - goto fail; - } - break; - - default: - fail: - p->status = USB_RET_STALL; - break; - } -} - -static void usb_bt_out_hci_packet_event(void *opaque, - const uint8_t *data, int len) -{ - struct USBBtState *s = (struct USBBtState *) opaque; - - if (s->evt.len == 0) { - usb_wakeup(s->intr, 0); - } - usb_bt_fifo_enqueue(&s->evt, data, len); -} - -static void usb_bt_out_hci_packet_acl(void *opaque, - const uint8_t *data, int len) -{ - struct USBBtState *s = (struct USBBtState *) opaque; - - usb_bt_fifo_enqueue(&s->acl, data, len); -} - -static void usb_bt_unrealize(USBDevice *dev, Error **errp) -{ - struct USBBtState *s = (struct USBBtState *) dev->opaque; - - s->hci->opaque = NULL; - s->hci->evt_recv = NULL; - s->hci->acl_recv = NULL; -} - -static void usb_bt_realize(USBDevice *dev, Error **errp) -{ - struct USBBtState *s = USB_BT(dev); - - usb_desc_create_serial(dev); - usb_desc_init(dev); - s->dev.opaque = s; - if (!s->hci) { - s->hci = bt_new_hci(qemu_find_bt_vlan(0)); - } - s->hci->opaque = s; - s->hci->evt_recv = usb_bt_out_hci_packet_event; - s->hci->acl_recv = usb_bt_out_hci_packet_acl; - usb_bt_handle_reset(&s->dev); - s->intr = usb_ep_get(dev, USB_TOKEN_IN, USB_EVT_EP); -} - -static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline) -{ - USBDevice *dev; - struct USBBtState *s; - HCIInfo *hci; - const char *name = TYPE_USB_BT; - - if (*cmdline) { - hci = hci_init(cmdline); - } else { - hci = bt_new_hci(qemu_find_bt_vlan(0)); - } - if (!hci) - return NULL; - - dev = usb_create(bus, name); - s = USB_BT(dev); - s->hci = hci; - return dev; -} - -static const VMStateDescription vmstate_usb_bt = { - .name = "usb-bt", - .unmigratable = 1, -}; - -static void usb_bt_class_initfn(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - USBDeviceClass *uc = USB_DEVICE_CLASS(klass); - - uc->realize = usb_bt_realize; - uc->product_desc = "QEMU BT dongle"; - uc->usb_desc = &desc_bluetooth; - uc->handle_reset = usb_bt_handle_reset; - uc->handle_control = usb_bt_handle_control; - uc->handle_data = usb_bt_handle_data; - uc->unrealize = usb_bt_unrealize; - dc->vmsd = &vmstate_usb_bt; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); -} - -static const TypeInfo bt_info = { - .name = TYPE_USB_BT, - .parent = TYPE_USB_DEVICE, - .instance_size = sizeof(struct USBBtState), - .class_init = usb_bt_class_initfn, -}; - -static void usb_bt_register_types(void) -{ - type_register_static(&bt_info); - usb_legacy_register(TYPE_USB_BT, "bt", usb_bt_init); -} - -type_init(usb_bt_register_types) diff --git a/qemu-doc.texi b/qemu-doc.texi index ed3df01dac..eea91a2d1e 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -983,21 +983,6 @@ For instance, user-mode networking can be used with Smartcard reader device @item usb-audio USB audio device -@item usb-bt-dongle -Bluetooth dongle for the transport layer of HCI. It is connected to HCI -scatternet 0 by default (corresponds to @code{-bt hci,vlan=0}). -Note that the syntax for the @code{-device usb-bt-dongle} option is not as -useful yet as it was with the legacy @code{-usbdevice} option. So to -configure an USB bluetooth device, you might need to use -"@code{-usbdevice bt}[:@var{hci-type}]" instead. This configures a -bluetooth dongle whose type is specified in the same format as with -the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If -no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}. -This USB device implements the USB Transport Layer of HCI. Example -usage: -@example -@command{@value{qemu_system}} [...@var{OPTIONS}...] @option{-usbdevice} bt:hci,vlan=3 @option{-bt} device:keyboard,vlan=3 -@end example @end table @node host_usb_devices