public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: "Michał Narajowski" <michal.narajowski@codecoup.pl>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding
Date: Thu, 8 Jun 2017 10:38:24 +0200	[thread overview]
Message-ID: <F7778D21-46FC-40A4-BA71-E4B7AC73BB9F@holtmann.org> (raw)
In-Reply-To: <20170606094120.14541-3-michal.narajowski@codecoup.pl>

Hi Michal,

> ---
> monitor/bt.h     | 12 +++++++
> monitor/packet.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 109 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor/bt.h b/monitor/bt.h
> index 660564a..5ec3e5e 100644
> --- a/monitor/bt.h
> +++ b/monitor/bt.h
> @@ -2272,6 +2272,18 @@ struct bt_hci_cmd_le_set_periodic_adv_enable {
> 	uint8_t  handle;
> } __attribute__ ((packed));
> 
> +#define BT_HCI_CMD_LE_SET_EXT_SCAN_PARAMS		0x2041
> +struct bt_hci_cmd_le_set_ext_scan_params {
> +	uint8_t  own_addr_type;
> +	uint8_t  filter_policy;
> +	uint8_t  phys;
> +} __attribute__ ((packed));
> +struct bt_hci_le_scan_phy {
> +	uint8_t  type;
> +	uint16_t  interval;
> +	uint16_t  window;

some of the indentation went wrong here.

> +} __attribute__ ((packed));
> +
> #define BT_HCI_EVT_INQUIRY_COMPLETE		0x01
> struct bt_hci_evt_inquiry_complete {
> 	uint8_t  status;
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 8ffda90..fb6aee2 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -7336,6 +7336,101 @@ static void le_set_periodic_adv_enable_cmd(const void *data, uint8_t size)
> 	print_handle(cmd->handle);
> }
> 
> +static const struct {
> +	uint8_t bit;
> +	const char *str;
> +} ext_scan_phys_table[] = {
> +	{  0, "LE 1M"		},
> +	{  2, "LE Coded"		},
> +	{ }
> +};
> +
> +static int print_ext_scan_phys(uint8_t flags)
> +{
> +	uint8_t mask = flags;
> +	int bits_set = 0;
> +	int i;
> +
> +	print_field("PHYs: 0x%2.2x", flags);
> +
> +	for (i = 0; ext_scan_phys_table[i].str; i++) {
> +		if (flags & (1 << ext_scan_phys_table[i].bit)) {
> +			print_field("  %s", ext_scan_phys_table[i].str);
> +			mask &= ~(1 << ext_scan_phys_table[i].bit);
> +			++bits_set;
> +		}
> +	}
> +
> +	if (mask)
> +		print_text(COLOR_UNKNOWN_ADV_FLAG, "  Unknown scanning PHYs"
> +							" (0x%2.2x)", mask);
> +	return bits_set;
> +}
> +
> +static void print_scan_filter_policy(uint8_t policy)
> +{
> +	const char *str;
> +
> +	switch (policy) {
> +	case 0x00:
> +		str = "Accept all advertisement";
> +		break;
> +	case 0x01:
> +		str = "Ignore not in white list";
> +		break;
> +	case 0x02:
> +		str = "Accept all advertisement, inc. directed unresolved RPA";
> +		break;
> +	case 0x03:
> +		str = "Ignore not in white list, exc. directed unresolved RPA";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Filter policy: %s (0x%2.2x)", str, policy);
> +}
> +
> +static void print_scan_type(uint8_t type)
> +{
> +	const char *str;
> +
> +	switch (type) {
> +	case 0x00:
> +		str = "Passive";
> +		break;
> +	case 0x01:
> +		str = "Active";
> +		break;
> +	default:
> +		str = "Reserved";
> +		break;
> +	}
> +
> +	print_field("Type: %s (0x%2.2x)", str, type);
> +}

Then lets please use them also for the other the legacy commands.

Regards

Marcel


  reply	other threads:[~2017-06-08  8:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  9:40 [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 01/31] monitor: Add LE Enhanced Receiver Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 1/2] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-08  8:38   ` Marcel Holtmann [this message]
2017-06-06  9:40 ` [PATCH BlueZ 02/31] monitor: Add LE Enhanced Transmitter Test decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 2/2] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 03/31] monitor: Add LE Set Advertising Set Random Address decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 04/31] monitor: Add LE Set Extended Advertising Parameters decoding Michał Narajowski
2017-06-08  8:44   ` Marcel Holtmann
2017-06-08 13:00   ` Szymon Janc
2017-06-06  9:40 ` [PATCH BlueZ 05/31] monitor: Add LE Set Extended Advertising Data decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 06/31] monitor: Add LE Set Extended Scan Response " Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 07/31] monitor: Add LE Set Extended Advertising Enable decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 08/31] monitor: Add LE Read Maximum Advertising Data Length decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 09/31] monitor: Add LE Read Number of Supported Advertising Sets decoding Michał Narajowski
2017-06-06  9:40 ` [PATCH BlueZ 10/31] monitor: Add LE Remove Advertising Set decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 11/31] monitor: Add LE Clear Advertising Sets decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 12/31] monitor: Add LE Set Periodic Advertising Parameters decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 13/31] monitor: Add LE Set Periodic Advertising Data decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 14/31] monitor: Add LE Set Periodic Advertising Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 15/31] monitor: Add LE Set Extended Scan Parameters decoding Michał Narajowski
2017-06-06  9:46   ` Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 16/31] monitor: Add LE Set Extended Scan Enable decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 17/31] monitor: Add LE Extended Create Connection decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 18/31] monitor: Add LE Periodic Advertising Create Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 19/31] monitor: Add LE Periodic Advertising Create Sync Cancel decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 20/31] monitor: Add LE Periodic Advertising Terminate Sync decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 21/31] monitor: Add LE Add Device To Periodic Advertiser List decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 22/31] monitor: Add LE Remove Device From " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 23/31] monitor: Add LE Clear " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 24/31] monitor: Add LE Read Periodic Advertiser List Size decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 25/31] monitor: Add LE Read Transmit Power decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 26/31] monitor: Add LE Read RF Path Compensation decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 27/31] monitor: Add LE Write " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 28/31] monitor: Add LE Set Privacy Mode decoding Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 29/31] monitor: Add LE Extended Advertising Report Event decoding Michał Narajowski
2017-06-06 14:10   ` Łukasz Rymanowski
2017-06-06  9:41 ` [PATCH BlueZ 30/31] monitor: Add LE Advertising Set Terminated " Michał Narajowski
2017-06-06  9:41 ` [PATCH BlueZ 31/31] monitor: Add LE Scan Request Received " Michał Narajowski
2017-06-08  8:47 ` [PATCH BlueZ 00/31] monitor: Bluetooth 5 HCI commands support Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F7778D21-46FC-40A4-BA71-E4B7AC73BB9F@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=michal.narajowski@codecoup.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox