btmgmt: Add command "add" into "monitor" btmgmt submenu
authorMichael Sun <michaelfsun@google.com>
Fri, 19 Jun 2020 22:56:23 +0000 (15:56 -0700)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 12 Apr 2021 09:00:49 +0000 (14:30 +0530)
commite4689d9f3df1409d165d00f638c680fe0d0a2943
tree879efd4a118eeda7543193703b72f496b391885e
parentce41d7d838433aed9661012413bf02972f864b14
btmgmt: Add command "add" into "monitor" btmgmt submenu

This patch introduces a new command ‘add’ within "monitor" submenu to
allow users to add advertisement monitor filters and get back monitor
handlers. An event handler is also added to handle kernel issued
MGMT_EV_ADV_MONITOR_ADDED events. The command will work with the new
MGMT opcode MGMT_OP_ADD_ADV_MONITOR. This patch only adds support for
adding pattern based filters.

Tested on Atlas Chromebook with a sample stdout below:
[mgmt]# add -p 0:1:c504 1:a:9a55beef
Advertisement monitor with handle:0x0005 added
[mgmt]# add -p 0:1:xxxx
Failed to parse monitor patterns.
Usage: add <-p|-h> [options...]
Monitor Types:
        -p <ad_type:offset:pattern>...  Pattern Monitor
e.g.:
        add -p 0:1:c504 1:a:9a55beef

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/btmgmt.c