This is a cache of https://discuss.96boards.org/t/bluez-emulator-btvirt-not-working-on-dragonboard/4017. It is a snapshot of the page at 2024-11-01T07:43:42.809+0000.
Bluez emulator (btvirt) not working on Dragonboard - DragonBoard410c - 96Boards Forum

Bluez emulator (btvirt) not working on Dragonboard

Hello,

I have been working with the Bluetooth on the Dragonboard and all is running great with it.

I am now looking how to improving the testing of what I have done. This is when I found that BlueZ has an emulator as part of the tools (if you build it from source) that allows you to create virtual adapters on your machine which would be very helpful. However this does not seem to be working on the Dragonboard:

linaro@linaro-alip:~/bluez/bluez-5.43$ sudo ./emulator/btvirt -l2
Bluetooth emulator ver 5.43
Failed to open Virtual HCI device

I posted a question in the BlueZ mailing list but did not get any response.

The emulator seems to run OK on an x86 box that I tried it on. However it does not seem to want to run on a Dragonboard. Nothing seems to be logged to btmon or syslog so I do not know how to go about debugging this.
Has anyone got any suggestions about how to debug this?

Thanks in advance,
Barry

You need a tiny driver in the kernel to create the ‘virtual’ HCI device, I think you need to rebuild your kernel with CONFIG_BT_HCIVHCI.

I don’t mind adding this config if there are users for it.

@barryb, let us know if you get it to work, and i can add it into our default builds

Hello,

I always struggle to rebuild kernels so I have drafted in some local help to try to get this working. The person helping me has created a hci_vhci.ko file which they told me to copy to /lib/modules/4.9.56-linaro-lt-qcom/kernel/drivers/bluetooth and to modprobe hci_vhci.

A modprobe gives the following error:

linaro@linaro-alip:~$ sudo modprobe hci_vhci
modprobe: FATAL: Module hci_vhci not found in directory /lib/modules/4.9.56-linaro-lt-qcom

So I used the insmod command:

linaro@linaro-alip:~$ sudo insmod /lib/modules/4.9.56-linaro-lt-qcom/kernel/drivers/bluetooth/hci_vhci.ko 

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.264114] Internal error: Oops: 96000004 [#1] PREEMPT SMP

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.417859] Process insmod (pid: 2503, stack limit = 0xffff80003675c020)

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.419416] Stack: (0xffff80003675fcf0 to 0xffff800036760000)

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.426099] fce0:                                   ffff80003675fe10 ffff000008136108

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.431745] fd00: 0000000000000000 0000000000000003 0000aaaac11cd8d8 0000ffff7fec67b4

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.439557] fd20: 0000000040000000 0000000000000015 0000000000000123 0000000000000111

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.447370] fd40: ffff000008a22000 ffff80003675c000 00000000fffffffb ffff000009099be0

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.455183] fd60: ffff000009099820 ffff000008d198d8 ffff800000000072 ffff000000000064

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.462995] fd80: ffff00000000006e ffff000000dc7000 0000000000000000 ffff000008a32670

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.470808] fda0: ffff000000dc3250 ffff000008a32660 000000007fffffff 0000000000000003

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.478620] fdc0: 0000000000000123 ffff0000081e9f40 ffff80003675fe10 0000000000000000
Segmentation fault

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.486431] fde0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.494244] fe00: 0000000000000000 0000000000000000 0000000000000000 ffff000008082ef0

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.502057] fe20: 0000000000000000 0000aaaac11cd8d8 ffffffffffffffff 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.509870] fe40: ffff80003675feb0 0000000000002dc8 ffff00000b59d000 ffff00000b59d000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.517681] fe60: 0000000000002dc8 ffff00000b59e068 ffff00000b59df8e ffff00000b59f148

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.525494] fe80: 0000000000003000 0000000000003450 0000000000000000 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.533306] fea0: 0000000000001f50 0000001700000016 000000000000000f 000000000000000b
linaro@linaro-alip:~$ 
Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.541120] fec0: 0000000000000003 0000aaaac11cd8d8 0000000000000000 0000000000000003

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.548931] fee0: 0000000000000000 0000000000000000 0000000000000040 0000000000000040

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.556745] ff00: 0000000000000111 000000000003ffff 0000000000020000 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.564558] ff20: 6f7465756c622f73 5f6963682f68746f 0000000000000047 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.572370] ff40: 0000aaaac11dff48 0000ffff7fec6790 0000000000000000 0000aaaae1dd22c0

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.580182] ff60: 0000aaaac11cd8d8 0000000000000000 0000aaaae1dd2270 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.587994] ff80: 0000ffffd5809f28 0000ffffd5809dd8 0000000000000000 0000000000000000

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.595806] ffa0: 0000000000000000 0000ffffd5809d10 0000aaaac11c49c4 0000ffffd5809d10

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.603620] ffc0: 0000ffff7fec67b4 0000000040000000 0000000000000003 0000000000000111

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.611432] ffe0: 0000000000000000 0000000000000000 456757559d57fd13 55551655554f5545

Message from syslogd@linaro-alip at Mar  3 07:55:16 ...
 kernel:[ 1815.722280] Code: f94156a0 d1004018 eb00033f 54000140 (f9401700) 

As you can see there is an error at the start and it continues. However it does not seem to have been successful.

I have done a “strings” on the hci_vhci.ko file which reveals the following information:

linaro@linaro-alip:~$ strings /lib/modules/4.9.56-linaro-lt-qcom/hci_vhci.ko
Tbn@
alias=char-major-10-137
alias=devname:vhci
license=GPL
version=1.5
description=Bluetooth virtual HCI driver ver 1.5
author=Marcel Holtmann <marcel@holtmann.org>
parm=amp:Create AMP controller device
parmtype=amp:bool
srcversion=7CBFC2BB580A2B481E0FF32
depends=bluetooth
intree=Y
vermagic=4.9.56-linaro-lt-qcom SMP preempt mod_unload aarch64
Can't register HCI device
&data->read_wait
&data->open_mutex
vhci
hci_vhci
GCC: (ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 4.8.4
GCC: (ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) 4.8.4
.symtab
.strtab
.shstrtab

I am a bit stuck at this point. Any suggestions gratefully received.

Regards,
Barry