emulator: Add support for vendor commands
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 4 Jan 2022 22:43:15 +0000 (14:43 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:53 +0000 (14:55 +0530)
commit2f46bd41d4ae4491be3fe7bd15fffcceedc07833
tree570ff60a3c01d58e17a1e14e1609a8df429662d1
parentab275622b15c0d7e5b2623d585dc6d298ad60c03
emulator: Add support for vendor commands

This adds support for vendor commands reserving a single opcode (0xfc10)
so it can be extended using subcommands, similar to how MSFT works.

The first subcommand (0x00) enables the emulator to generate arbitrary
events using the commands parameters:

> tools/hcitool cmd 3f 10 00 22 24 d0 d0 d0 d0 d0 d0 ff ff
< HCI Command: Vendor (0x3f|0x0010) plen 11
        00 22 24 d0 d0 d0 d0 d0 d0 ff ff
."$........
Bluetooth: hci0: Malformed HCI Event: 0x22
> HCI Event: Inquiry Result with R.. (0x22) plen 9
        Num responses: 36
        Page scan repetition mode: Reserved (0xff)
        Page period mode: Reserved (0xff)
        Class: 0xffffd0
          Major class: Uncategorized, specific device code not specified
          Minor class: 0x34
          Limited Discoverable Mode
          invalid service class
        Clock offset: 0x6368
        RSSI: 105 dBm (0x69)
> HCI Event: Command Complete (0x0e) plen 4
      Vendor (0x3f|0x0010) ncmd 1
        Status: Success (0x00)

Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
Makefile.tools
emulator/btdev.c
emulator/btdev.h
emulator/main.c
emulator/vhci.c
emulator/vhci.h
monitor/emulator.h [new file with mode: 0644]