Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2020 08:57:21 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r361164 - in stable/12: sys/netgraph/bluetooth/hci sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol
Message-ID:  <202005180857.04I8vLFT044242@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon May 18 08:57:21 2020
New Revision: 361164
URL: https://svnweb.freebsd.org/changeset/base/361164

Log:
  MFC r360116:
  Substitute le_read_supported_status with le_read_supported_states.
  Refer to bluetooth core v5.2 specifications Vol4. Part E. 7.8.27.
  
  PR:		245763
  Submitted by:	Marc Veldman <marc@bumblingdork.com>
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
  stable/12/sys/netgraph/bluetooth/include/ng_hci.h
  stable/12/usr.sbin/bluetooth/hccontrol/le.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netgraph/bluetooth/hci/ng_hci_cmds.c
==============================================================================
--- stable/12/sys/netgraph/bluetooth/hci/ng_hci_cmds.c	Mon May 18 08:56:22 2020	(r361163)
+++ stable/12/sys/netgraph/bluetooth/hci/ng_hci_cmds.c	Mon May 18 08:57:21 2020	(r361164)
@@ -842,7 +842,7 @@ process_le_params(ng_hci_unit_p unit, u_int16_t ocf,
 	case NG_HCI_OCF_LE_RAND:
 	case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY:
 	case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY:
-	case NG_HCI_OCF_LE_READ_SUPPORTED_STATUS:
+	case NG_HCI_OCF_LE_READ_SUPPORTED_STATES:
 	case NG_HCI_OCF_LE_RECEIVER_TEST:
 	case NG_HCI_OCF_LE_TRANSMITTER_TEST:
 	case NG_HCI_OCF_LE_TEST_END:
@@ -913,7 +913,7 @@ process_le_status(ng_hci_unit_p unit,ng_hci_command_st
 	case NG_HCI_OCF_LE_RAND:
 	case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_REPLY:
 	case NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY:
-	case NG_HCI_OCF_LE_READ_SUPPORTED_STATUS:
+	case NG_HCI_OCF_LE_READ_SUPPORTED_STATES:
 	case NG_HCI_OCF_LE_RECEIVER_TEST:
 	case NG_HCI_OCF_LE_TRANSMITTER_TEST:
 	case NG_HCI_OCF_LE_TEST_END:

Modified: stable/12/sys/netgraph/bluetooth/include/ng_hci.h
==============================================================================
--- stable/12/sys/netgraph/bluetooth/include/ng_hci.h	Mon May 18 08:56:22 2020	(r361163)
+++ stable/12/sys/netgraph/bluetooth/include/ng_hci.h	Mon May 18 08:57:21 2020	(r361164)
@@ -1673,12 +1673,12 @@ typedef struct {
 }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp;
 
 
-#define NG_HCI_OCF_LE_READ_SUPPORTED_STATUS		0x001c
+#define NG_HCI_OCF_LE_READ_SUPPORTED_STATES		0x001c
 /*No command parameter*/
 typedef struct {
 	u_int8_t status;
-	u_int64_t le_status;
-}__attribute__ ((packed)) ng_hci_le_read_supported_status_rp;
+	u_int64_t le_states;
+}__attribute__ ((packed)) ng_hci_le_read_supported_states_rp;
 
 #define NG_HCI_OCF_LE_RECEIVER_TEST			0x001d
 typedef struct{

Modified: stable/12/usr.sbin/bluetooth/hccontrol/le.c
==============================================================================
--- stable/12/usr.sbin/bluetooth/hccontrol/le.c	Mon May 18 08:56:22 2020	(r361163)
+++ stable/12/usr.sbin/bluetooth/hccontrol/le.c	Mon May 18 08:57:21 2020	(r361164)
@@ -52,7 +52,7 @@ static int le_set_scan_param(int s, int argc, char *ar
 static int le_set_scan_enable(int s, int argc, char *argv[]);
 static int parse_param(int argc, char *argv[], char *buf, int *len);
 static int le_set_scan_response(int s, int argc, char *argv[]);
-static int le_read_supported_status(int s, int argc, char *argv[]);
+static int le_read_supported_states(int s, int argc, char *argv[]);
 static int le_read_local_supported_features(int s, int argc ,char *argv[]);
 static int set_le_event_mask(int s, uint64_t mask);
 static int set_event_mask(int s, uint64_t mask);
@@ -259,20 +259,26 @@ le_read_local_supported_features(int s, int argc ,char
 }
 
 static int
-le_read_supported_status(int s, int argc, char *argv[])
+le_read_supported_states(int s, int argc, char *argv[])
 {
-	ng_hci_le_read_supported_status_rp rp;
-	int e;
+	ng_hci_le_read_supported_states_rp rp;
 	int n = sizeof(rp);
 
-	e = hci_simple_request(s, NG_HCI_OPCODE(
+	if (hci_simple_request(s, NG_HCI_OPCODE(
 					NG_HCI_OGF_LE,
-					NG_HCI_OCF_LE_READ_SUPPORTED_STATUS),
-			       		(void *)&rp, &n);
+					NG_HCI_OCF_LE_READ_SUPPORTED_STATES),
+			       		(void *)&rp, &n) == ERROR)
+		return (ERROR);
 
-	printf("LE_STATUS: %d %d %jx\n", e, rp.status, (uintmax_t)rp.le_status);
+	if (rp.status != 0x00) {
+		fprintf(stdout, "Status: %s [%#02x]\n", 
+			hci_status2str(rp.status), rp.status);
+		return (FAILED);
+	}
 
-	return 0;
+	fprintf(stdout, "LE States: %jx\n", rp.le_states);
+	
+	return (OK); 
 }
 
 static int
@@ -347,11 +353,11 @@ struct hci_command le_commands[] = {
 	  &le_read_local_supported_features,
   },
   {
-	  "le_read_supported_status",
-	  "le_read_supported_status\n"
+	  "le_read_supported_states",
+	  "le_read_supported_states\n"
 	  "read supported status"	  
 	  ,
-	  &le_read_supported_status,
+	  &le_read_supported_states,
   },
   {
 	  "le_set_scan_response",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005180857.04I8vLFT044242>