Testing Bluetooth with QEMU


Priyanka
 

Hi


I am testing samples/bluetooth/beacon with QEMU.

The version of zephyr is recent master branch.


1)

The beacon sample test with local Bluetooth adapter on Linux PC, gives the init failed error

[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode: genroms/multiboot.bin
Starting Beacon Demo
Bluetooth init failed (err -35)

2)

So, I test the sample "beacon" with emulation support with BlueZ.

Attached wireshark capture.

Could someone verify if my setup (tools and commands) is correct or I am missing something here? 

For further bluetooth tests, has anyone tried the tools "l2ping" and "l2test" ?

When I do "make qemu" : Bluetooth is initialized and Beacon started. BD address is 00:aa:01:00:00:23 (public).


However, "hciconfig -a" gives 

[bt] [ERR] read_payload: Not enough space in buffer

[bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool 0x00405078

I have following running in different terminals.

$ sudo ./btvirt -l2
Bluetooth emulator ver 5.46

$ sudo tools/btproxy -i 0 -u
Listening on /tmp/bt-server-bredr
Opening user channel for hci0
New client connected

# zephyr/samples/bluetooth/beacon$ make qemu
[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode: genroms/multiboot.bin

Starting Beacon Demo
[bt] [INF] show_dev_info: Identity: 00:aa:01:00:00:23 (public)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0x003f
[bt] [INF] show_dev_info: LMP: version 5.0 (0x09) subver 0x0000
Bluetooth initialized
Beacon started

[bt] [ERR] read_payload: Not enough space in buffer
[bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool 0x00405078


$ hciconfig -a

hci0: Type: BR/EDR Bus: VIRTUAL

BD Address: 00:AA:01:00:00:23 ACL MTU: 192:1 SCO MTU: 0:0

UP RUNNING

RX bytes:0 acl:0 sco:0 events:203 errors:0

TX bytes:7024 acl:0 sco:0 commands:636 errors:0

Features: 0xa4 0x08 0x08 0xc0 0x58 0x1e 0x7b 0x83

Packet type: DM1 DH1 HV1

Link policy: RSWITCH SNIFF

Link mode: SLAVE ACCEPT

Name: 'xxxxxx #1'

Can't read class of device on hci0: Connection timed out (110)

$ sudo btmgmt --index 1

[hci1]# find -l
Discovery started
hci1 type 6 discovering on
hci1 dev_found: 00:AA:01:00:00:23 type LE Public rssi 127 flags 0x0000
AD flags 0x06
name Zephyr Heartrate Sensor
hci1 type 6 discovering off

Thanks
Priyanka



Luiz Augusto von Dentz
 

Hi Priyanka,

On Mon, Sep 18, 2017 at 12:24 PM, Priyanka Rawat <priyanka.rawat@...> wrote:
Hi


I am testing samples/bluetooth/beacon with QEMU.

The version of zephyr is recent master branch.


1)

The beacon sample test with local Bluetooth adapter on Linux PC, gives the
init failed error

[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode:
genroms/multiboot.bin
Starting Beacon Demo
Bluetooth init failed (err -35)

2)

So, I test the sample "beacon" with emulation support with BlueZ.

Attached wireshark capture.

Could someone verify if my setup (tools and commands) is correct or I am
missing something here?

For further bluetooth tests, has anyone tried the tools "l2ping" and
"l2test" ?

When I do "make qemu" : Bluetooth is initialized and Beacon started. BD
address is 00:aa:01:00:00:23 (public).


However, "hciconfig -a" gives

[bt] [ERR] read_payload: Not enough space in buffer

[bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool
0x00405078

I have following running in different terminals.

$ sudo ./btvirt -l2
Bluetooth emulator ver 5.46

$ sudo tools/btproxy -i 0 -u
Listening on /tmp/bt-server-bredr
Opening user channel for hci0
New client connected

# zephyr/samples/bluetooth/beacon$ make qemu
[QEMU] CPU: qemu32
qemu-system-i386: warning: Unknown firmware file in legacy mode:
genroms/multiboot.bin

Starting Beacon Demo
[bt] [INF] show_dev_info: Identity: 00:aa:01:00:00:23 (public)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000,
manufacturer 0x003f
[bt] [INF] show_dev_info: LMP: version 5.0 (0x09) subver 0x0000
Bluetooth initialized
Beacon started

[bt] [ERR] read_payload: Not enough space in buffer
[bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool
0x00405078
I don't get this error when using a real controller:

Starting Beacon Demo
[bt] [INF] show_dev_info: Identity: 00:1b:dc:07:31:88 (public)
[bt] [INF] show_dev_info: HCI: version 4.0 (0x06) revision 0x2031,
manufacturer 0x000a
[bt] [INF] show_dev_info: LMP: version 4.0 (0x06) subver 0x2031
Bluetooth initialized
Beacon started

Perhaps this has something to do with the emulator as it is now
emulating 5.0 features there maybe something not working quite right.


$ hciconfig -a

hci0: Type: BR/EDR Bus: VIRTUAL

BD Address: 00:AA:01:00:00:23 ACL MTU: 192:1 SCO MTU: 0:0

UP RUNNING

RX bytes:0 acl:0 sco:0 events:203 errors:0

TX bytes:7024 acl:0 sco:0 commands:636 errors:0

Features: 0xa4 0x08 0x08 0xc0 0x58 0x1e 0x7b 0x83

Packet type: DM1 DH1 HV1

Link policy: RSWITCH SNIFF

Link mode: SLAVE ACCEPT

Name: 'xxxxxx #1'

Can't read class of device on hci0: Connection timed out (110)

$ sudo btmgmt --index 1

[hci1]# find -l
Discovery started
hci1 type 6 discovering on
hci1 dev_found: 00:AA:01:00:00:23 type LE Public rssi 127 flags 0x0000
AD flags 0x06
name Zephyr Heartrate Sensor
hci1 type 6 discovering off

Thanks
Priyanka



_______________________________________________
Zephyr-users mailing list
Zephyr-users@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


--
Luiz Augusto von Dentz


Paul Sokolovsky
 

Hello Priyanka,

On Mon, 18 Sep 2017 09:24:55 +0000
Priyanka Rawat <priyanka.rawat@...> wrote:

[]


When I do "make qemu" : Bluetooth is initialized and Beacon started.
BD address is 00:aa:01:00:00:23 (public).
I can't say much of BT emulation using QEMU - never tried that, but
you should use "make run" instead of "make qemu". It's an oversight
that the latter still works, and at least some issues were spotted
with it: https://github.com/zephyrproject-rtos/zephyr/issues/1522



However, "hciconfig -a" gives

[bt] [ERR] read_payload: Not enough space in buffer

[bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool
0x00405078
I'd suggest to describe more explicitly where/how '"hciconfig -a"
gives' that: at the Linux console while running the command, in the
Linux syslog, in Zephyr's application console QEMU, etc. (Maybe it's
obvious, but I wouldn't jump to reproduce it with the info given, though
again, I may be biased as I never tried that).

Otherwise, if you don't receive a reply here, can you consider joining
the IRC channel and try to ping @jhe and other Bluetooth folks there?
(I'd hope they read the list, but I sometimes myself skip to check it
for few days.)

Sorry for not bringing more specific answers.

[]


Thanks
Priyanka


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Priyanka
 

Hi Paul


Yes, first I did use "make run".


In the Zephyr's application console QEMU :

-------------------------------------------------------------

Bluetooth gets initialized and Beacon started. All looks fine there.


Then, in the Host PC ( Linux console) :

-----------------------------------------------------

I do "hciconfig"  to see hci0 and hci1

With 'hciconfig" it looks all ok.


It is only when I use "hciconfig -a"  in the Host PC (Linux console) then

I get the following in the Zephyr's app console QEMU.

In the Zephyr's application console QEMU :

------------------------------------------

[bt] [ERR] read_payload: Not enough space in buffer [bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool 0x00405078

I get this error for other bluetooth samples (e.g., peripheral_hr and IPSP) as well.

Here is my set up to make it more clear to you.

Terminal 1

----------------

# zephyr/samples/bluetooth/beacon$ make run

Starting Beacon Demo
[bt] [INF] show_dev_info: Identity: 00:aa:01:00:00:23 (public)
[bt] [INF] show_dev_info: HCI: version 5.0 (0x09) revision 0x0000, manufacturer 0x003f
[bt] [INF] show_dev_info: LMP: version 5.0 (0x09) subver 0x0000
Bluetooth initialized
Beacon started


Host PC (Terminal 2)
--------------------
$ sudo tools/btproxy -u
Listening on /tmp/bt-server-bredr
Opening user channel for hci0
New client connected


Host PC (Terminal 3)

-------------------------------

$ hciconfig

hci2:    Type: BR/EDR  Bus: USB
    BD Address: 08:ED:B9:DD:DD:86  ACL MTU: 1021:8  SCO MTU: 64:1
    UP RUNNING
    RX bytes:589 acl:0 sco:0 events:36 errors:0
    TX bytes:2564 acl:0 sco:0 commands:36 errors:0

hci1:    Type: BR/EDR  Bus: VIRTUAL
    BD Address: 00:AA:01:01:00:24  ACL MTU: 192:1  SCO MTU: 0:0
    UP RUNNING
    RX bytes:0 acl:0 sco:0 events:77 errors:0
    TX bytes:1205 acl:0 sco:0 commands:77 errors:0

hci0:    Type: BR/EDR  Bus: VIRTUAL
    BD Address: 00:AA:01:00:00:23  ACL MTU: 192:1  SCO MTU: 0:0
    UP RUNNING
    RX bytes:0 acl:0 sco:0 events:77 errors:0
    TX bytes:1389 acl:0 sco:0 commands:97 errors:0



Host PC (Terminal 3)

-------------------------------


$ sudo hciconfig  -a


gives me the following
Can't read class of device on hci0: Connection timed out (110)


hci0: Type: BR/EDR Bus: VIRTUAL

BD Address: 00:AA:01:00:00:23 ACL MTU: 192:1 SCO MTU: 0:0

UP RUNNING

RX bytes:0 acl:0 sco:0 events:203 errors:0

TX bytes:7024 acl:0 sco:0 commands:636 errors:0

Features: 0xa4 0x08 0x08 0xc0 0x58 0x1e 0x7b 0x83

Packet type: DM1 DH1 HV1

Link policy: RSWITCH SNIFF

Link mode: SLAVE ACCEPT

Name: 'xxxxxx #1'

Can't read class of device on hci0: Connection timed out (110)

Whereas at the other end on Terminal 1 (Zephyr's application console QEMU), I get the following.

Terminal 1 (Zephyr's application console QEMU) :

-------------------------------------------------

[bt] [ERR] read_payload: Not enough space in buffer [bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool 0x00405078

I restarted QEMU to see if it works, but I get the same error again.

Thanks
Priyanka


From: Paul Sokolovsky <paul.sokolovsky@...>
Sent: Monday, September 18, 2017 4:41 PM
To: Priyanka Rawat
Cc: zephyr-users@...
Subject: Re: [Zephyr-users] Testing Bluetooth with QEMU
 
Hello Priyanka,

On Mon, 18 Sep 2017 09:24:55 +0000
Priyanka Rawat <priyanka.rawat@...> wrote:

[]


> When I do "make qemu" : Bluetooth is initialized and Beacon started.
> BD address is 00:aa:01:00:00:23 (public).

I can't say much of BT emulation using QEMU - never tried that, but
you should use "make run" instead of "make qemu". It's an oversight
that the latter still works, and at least some issues were spotted
with it: https://github.com/zephyrproject-rtos/zephyr/issues/1522

>
>
> However, "hciconfig -a" gives
>
> [bt] [ERR] read_payload: Not enough space in buffer
>
> [bt] [WRN] hci_cmd_done: pool id 1 pool 0x00405098 != &hci_cmd_pool
> 0x00405078

I'd suggest to describe more explicitly where/how '"hciconfig -a"
gives' that: at the Linux console while running the command, in the
Linux syslog, in Zephyr's application console QEMU, etc. (Maybe it's
obvious, but I wouldn't jump to reproduce it with the info given, though
again, I may be biased as I never tried that).



Otherwise, if you don't receive a reply here, can you consider joining
the IRC channel and try to ping @jhe and other Bluetooth folks there?
(I'd hope they read the list, but I sometimes myself skip to check it
for few days.)

Sorry for not bringing more specific answers.

[]

>
> Thanks
> Priyanka
>



--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
twitter.com
1,732 tweets • 605 photos/videos • 3,058 followers. Check out the latest Tweets from Linaro (@LinaroOrg)