Skip to contentSkip to conversation

hw/bt: drop bluetooth keyboard emulation

PATCH In review Gerd Hoffmann 2 participants 2 messages Nov 13, 2018 – Nov 14, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/bt: drop bluetooth keyboard emulation

Broken (segfaults on first keypress, probably since 2.1) and apparently unused.

Reproducer:
qemu -usb -device usb-bt-dongle -bt hci,vlan=0 -bt device:keyboard

Stacktrace:
#0 0x00005606841f7363 in bt_hid_send_data (ch=0x0, type=1, data=0x560686986400 "", len=8)

      at /home/kraxel/projects/qemu/hw/bt/hid.c:178
  #1  0x00005606841f7afa in bt_hid_datain (hs=0x560686985eb8)
      at /home/kraxel/projects/qemu/hw/bt/hid.c:387
  #2  0x00005606842643d8 in hid_keyboard_event (dev=0x560686985eb8, src=0x5606869b9c10, evt=0x5606868772a0)
      at /home/kraxel/projects/qemu/hw/input/hid.c:245
  #3  0x00005606843eab39 in qemu_input_event_send_impl (src=0x5606869b9c10, evt=0x5606868772a0)
      at /home/kraxel/projects/qemu/ui/input.c:346
  #4  0x00005606843caadd in replay_input_event (src=0x5606869b9c10, evt=0x5606868772a0)
      at /home/kraxel/projects/qemu/replay/replay-input.c:128
  #5  0x00005606843eabf4 in qemu_input_event_send (src=0x5606869b9c10, evt=0x5606868772a0)
      at /home/kraxel/projects/qemu/ui/input.c:375
  #6  0x00005606843ead43 in qemu_input_event_send_key (src=0x5606869b9c10, key=0x560686819e50, down=true) at /home/kraxel/projects/qemu/ui/input.c:419
  #7  0x00005606843eae23 in qemu_input_event_send_key_qcode (src=0x5606869b9c10, q=Q_KEY_CODE_RET, down=true)
      at /home/kraxel/projects/qemu/ui/input.c:441
  [ ... snip ... ]
---
 include/hw/bt.h     |   3 -
 hw/bt/hid.c         | 554 ----------------------------------------------------
 vl.c                |  34 +---
 hw/bt/Makefile.objs |   3 +-
 qemu-doc.texi       |   6 +-
 qemu-options.hx     |   9 -
 6 files changed, 3 insertions(+), 606 deletions(-)
 delete mode 100644 hw/bt/hid.c
include/hw/bt.h +0 -3
index b5e11d4d43..73fb1911f6 100644
@@ -173,9 +173,6 @@ enum bt_l2cap_psm_predef {
 /* bt-sdp.c */
 void bt_l2cap_sdp_init(struct bt_l2cap_device_s *dev);
 
-/* bt-hid.c */
-struct bt_device_s *bt_keyboard_init(struct bt_scatternet_s *net);
-
 /* Link Management Protocol layer defines */
 
 #define LLID_ACLU_CONT		0x1
hw/bt/hid.c deleted +0 -554

554 lines not on this page · raw message

vl.c +1 -33
index 55bab005b6..2a12fc7f3e 100644
@@ -988,37 +988,6 @@ static void bt_vhci_add(int vlan_id)
     bt_vhci_init(bt_new_hci(vlan));
 }
 
-static struct bt_device_s *bt_device_add(const char *opt)
-{
-    struct bt_scatternet_s *vlan;
-    int vlan_id = 0;
-    char *endp = strstr(opt, ",vlan=");
-    int len = (endp ? endp - opt : strlen(opt)) + 1;
-    char devname[10];
-
-    pstrcpy(devname, MIN(sizeof(devname), len), opt);
-
-    if (endp) {
-        vlan_id = strtol(endp + 6, &endp, 0);
-        if (*endp) {
-            error_report("unrecognised bluetooth vlan Id");
-            return 0;
-        }
-    }
-
-    vlan = qemu_find_bt_vlan(vlan_id);
-
-    if (!vlan->slave)
-        warn_report("adding a slave device to an empty scatternet %i",
-                    vlan_id);
-
-    if (!strcmp(devname, "keyboard"))
-        return bt_keyboard_init(vlan);
-
-    error_report("unsupported bluetooth device '%s'", devname);
-    return 0;
-}
-
 static int bt_parse(const char *opt)
 {
     const char *endp, *p;
@@ -1051,8 +1020,7 @@ static int bt_parse(const char *opt)
             bt_vhci_add(vlan);
             return 0;
         }
-    } else if (strstart(opt, "device:", &endp))
-        return !bt_device_add(endp);
+    }
 
     error_report("bad bluetooth parameter '%s'", opt);
     return 1;
hw/bt/Makefile.objs +1 -2
index 867a7d2e8a..a33983b522 100644
@@ -1,3 +1,2 @@
-common-obj-y += core.o l2cap.o sdp.o hci.o hid.o
+common-obj-y += core.o l2cap.o sdp.o hci.o
 common-obj-y += hci-csr.o
-
qemu-doc.texi +1 -5
index f7ad1dfe4b..b41ab95284 100644
@@ -983,11 +983,7 @@ configure an USB bluetooth device, you might need to use
 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{qemu-system-i386} [...@var{OPTIONS}...] @option{-usbdevice} bt:hci,vlan=3 @option{-bt} device:keyboard,vlan=3
-@end example
+This USB device implements the USB Transport Layer of HCI.
 @end table
 
 @node host_usb_devices
qemu-options.hx +0 -9
index 38c7a978c1..48885cdca8 100644
@@ -2804,15 +2804,6 @@ be used as following:
 qemu-system-i386 [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5
 @end example
 
-@item -bt device:@var{dev}[,vlan=@var{n}]
-Emulate a bluetooth device @var{dev} and place it in network @var{n}
-(default @code{0}).  QEMU can only emulate one type of bluetooth devices
-currently:
-
-@table @option
-@item keyboard
-Virtual wireless keyboard implementing the HIDP bluetooth profile.
-@end table
 ETEXI
 
 STEXI
Signature · 1 line
2.9.3
Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 23 lines · Gerd Hoffmann

Broken (segfaults on first keypress, probably since 2.1) and apparently unused.

Reproducer:
qemu -usb -device usb-bt-dongle -bt hci,vlan=0 -bt device:keyboard

Stacktrace:

   #0  0x00005606841f7363 in bt_hid_send_data (ch=0x0, type=1, data=0x560686986400 "", len=8)
       at /home/kraxel/projects/qemu/hw/bt/hid.c:178
   #1  0x00005606841f7afa in bt_hid_datain (hs=0x560686985eb8)
       at /home/kraxel/projects/qemu/hw/bt/hid.c:387
   #2  0x00005606842643d8 in hid_keyboard_event (dev=0x560686985eb8, src=0x5606869b9c10, evt=0x5606868772a0)
       at /home/kraxel/projects/qemu/hw/input/hid.c:245
   #3  0x00005606843eab39 in qemu_input_event_send_impl (src=0x5606869b9c10, evt=0x5606868772a0)
       at /home/kraxel/projects/qemu/ui/input.c:346
   #4  0x00005606843caadd in replay_input_event (src=0x5606869b9c10, evt=0x5606868772a0)
       at /home/kraxel/projects/qemu/replay/replay-input.c:128
   #5  0x00005606843eabf4 in qemu_input_event_send (src=0x5606869b9c10, evt=0x5606868772a0)
       at /home/kraxel/projects/qemu/ui/input.c:375
   #6  0x00005606843ead43 in qemu_input_event_send_key (src=0x5606869b9c10, key=0x560686819e50, down=true) at /home/kraxel/projects/qemu/ui/input.c:419
   #7  0x00005606843eae23 in qemu_input_event_send_key_qcode (src=0x5606869b9c10, q=Q_KEY_CODE_RET, down=true)
       at /home/kraxel/projects/qemu/ui/input.c:441
   [ ... snip ... ]
Quoted 1 line

One question below, otherwise

Quoted 10 lines
---
  include/hw/bt.h     |   3 -
  hw/bt/hid.c         | 554 ----------------------------------------------------
  vl.c                |  34 +---
  hw/bt/Makefile.objs |   3 +-
  qemu-doc.texi       |   6 +-
  qemu-options.hx     |   9 -
  6 files changed, 3 insertions(+), 606 deletions(-)

delete mode 100644 hw/bt/hid.c

[ snip]

qemu-options.hx

Quoted 4 lines
qemu-options.hx +0 -0
index 38c7a978c1..48885cdca8 100644

Is this extra removal needed too?

@@ -2757,9 +2757,7 @@ DEF("bt", HAS_ARG, QEMU_OPTION_bt, \
     "-bt hci[,vlan=n]\n" \
     "                emulate a standard HCI in virtual scatternet 'n'\n" \
     "-bt vhci[,vlan=n]\n" \
-    "                add host computer to virtual scatternet 'n' using VHCI\n" \
-    "-bt device:dev[,vlan=n]\n" \
-    "                emulate a bluetooth device 'dev' in scatternet 'n'\n",
+    "                add host computer to virtual scatternet 'n' using VHCI\n", \

QEMU_ARCH_ALL)
STEXI
@item -bt hci[...]

Quoted 17 lines
qemu-options.hx +0 -9
@@ -2804,15 +2804,6 @@ be used as following:
  qemu-system-i386 [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5
  @end example
 
-@item -bt device:@var{dev}[,vlan=@var{n}]
-Emulate a bluetooth device @var{dev} and place it in network @var{n}
-(default @code{0}).  QEMU can only emulate one type of bluetooth devices
-currently:
-
-@table @option
-@item keyboard
-Virtual wireless keyboard implementing the HIDP bluetooth profile.
-@end table
  ETEXI
 
  STEXI