xref: /freebsd/usr.sbin/bluetooth/hccontrol/node.c (revision e86cf8ada1ac24f3f3119d63d284dc75cf4b8828)
1 /*-
2  * node.c
3  *
4  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5  *
6  * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  *
30  * $Id: node.c,v 1.6 2003/07/22 21:14:02 max Exp $
31  * $FreeBSD$
32  */
33 
34 #include <sys/ioctl.h>
35 #define L2CAP_SOCKET_CHECKED
36 #include <bluetooth.h>
37 #include <errno.h>
38 #include <netgraph/ng_message.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <unistd.h>
43 #include <uuid.h>
44 #include "hccontrol.h"
45 
46 /* Send Read_Node_State command to the node */
47 static int
48 hci_read_node_state(int s, int argc, char **argv)
49 {
50 	struct ng_btsocket_hci_raw_node_state	r;
51 
52 	memset(&r, 0, sizeof(r));
53 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STATE, &r, sizeof(r)) < 0)
54 		return (ERROR);
55 
56 	fprintf(stdout, "State: %#x\n", r.state);
57 
58 	return (OK);
59 } /* hci_read_node_state */
60 
61 /* Send Intitialize command to the node */
62 static int
63 hci_node_initialize(int s, int argc, char **argv)
64 {
65 	if (ioctl(s, SIOC_HCI_RAW_NODE_INIT) < 0)
66 		return (ERROR);
67 
68 	return (OK);
69 } /* hci_node_initialize */
70 
71 /* Send Read_Debug_Level command to the node */
72 static int
73 hci_read_debug_level(int s, int argc, char **argv)
74 {
75 	struct ng_btsocket_hci_raw_node_debug	r;
76 
77 	memset(&r, 0, sizeof(r));
78 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_DEBUG, &r, sizeof(r)) < 0)
79 		return (ERROR);
80 
81 	fprintf(stdout, "Debug level: %d\n", r.debug);
82 
83 	return (OK);
84 } /* hci_read_debug_level */
85 
86 /* Send Write_Debug_Level command to the node */
87 static int
88 hci_write_debug_level(int s, int argc, char **argv)
89 {
90 	struct ng_btsocket_hci_raw_node_debug	r;
91 
92 	memset(&r, 0, sizeof(r));
93 	switch (argc) {
94 	case 1:
95 		r.debug = atoi(argv[0]);
96 		break;
97 
98 	default:
99 		return (USAGE);
100 	}
101 
102 	if (ioctl(s, SIOC_HCI_RAW_NODE_SET_DEBUG, &r, sizeof(r)) < 0)
103 		return (ERROR);
104 
105 	return (OK);
106 } /* hci_write_debug_level */
107 
108 /* Send Read_Node_Buffer_Size command to the node */
109 static int
110 hci_read_node_buffer_size(int s, int argc, char **argv)
111 {
112 	struct ng_btsocket_hci_raw_node_buffer	r;
113 
114 	memset(&r, 0, sizeof(r));
115 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BUFFER, &r, sizeof(r)) < 0)
116 		return (ERROR);
117 
118 	fprintf(stdout, "Number of free command buffers: %d\n",
119 		r.buffer.cmd_free);
120 	fprintf(stdout, "Max. ACL packet size: %d\n",
121 		r.buffer.acl_size);
122 	fprintf(stdout, "Numbef of free ACL buffers: %d\n",
123 		r.buffer.acl_free);
124 	fprintf(stdout, "Total number of ACL buffers: %d\n",
125 		r.buffer.acl_pkts);
126 	fprintf(stdout, "Max. SCO packet size: %d\n",
127 		r.buffer.sco_size);
128 	fprintf(stdout, "Numbef of free SCO buffers: %d\n",
129 		r.buffer.sco_free);
130 	fprintf(stdout, "Total number of SCO buffers: %d\n",
131 		r.buffer.sco_pkts);
132 
133 	return (OK);
134 } /* hci_read_node_buffer_size */
135 
136 /* Send Read_Node_BD_ADDR command to the node */
137 static int
138 hci_read_node_bd_addr(int s, int argc, char **argv)
139 {
140 	struct ng_btsocket_hci_raw_node_bdaddr	r;
141 
142 	memset(&r, 0, sizeof(r));
143 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_BDADDR, &r, sizeof(r)) < 0)
144 		return (ERROR);
145 
146 	fprintf(stdout, "BD_ADDR: %s\n", bt_ntoa(&r.bdaddr, NULL));
147 
148 	return (OK);
149 } /* hci_read_node_bd_addr */
150 
151 /* Send Read_Node_Features command to the node */
152 static int
153 hci_read_node_features(int s, int argc, char **argv)
154 {
155 	struct ng_btsocket_hci_raw_node_features	r;
156 	int						n;
157 	char						buffer[2048];
158 
159 	memset(&r, 0, sizeof(r));
160 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_FEATURES, &r, sizeof(r)) < 0)
161 		return (ERROR);
162 
163 	fprintf(stdout, "Features: ");
164 	for (n = 0; n < sizeof(r.features)/sizeof(r.features[0]); n++)
165 		fprintf(stdout, "%#02x ", r.features[n]);
166 	fprintf(stdout, "\n%s\n", hci_features2str(r.features,
167 		buffer, sizeof(buffer)));
168 
169 	return (OK);
170 } /* hci_read_node_features */
171 
172 /* Send Read_Node_Stat command to the node */
173 static int
174 hci_read_node_stat(int s, int argc, char **argv)
175 {
176 	struct ng_btsocket_hci_raw_node_stat	r;
177 
178 	memset(&r, 0, sizeof(r));
179 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_STAT, &r, sizeof(r)) < 0)
180 		return (ERROR);
181 
182 	fprintf(stdout, "Commands sent: %d\n", r.stat.cmd_sent);
183 	fprintf(stdout, "Events received: %d\n", r.stat.evnt_recv);
184 	fprintf(stdout, "ACL packets received: %d\n", r.stat.acl_recv);
185 	fprintf(stdout, "ACL packets sent: %d\n", r.stat.acl_sent);
186 	fprintf(stdout, "SCO packets received: %d\n", r.stat.sco_recv);
187 	fprintf(stdout, "SCO packets sent: %d\n", r.stat.sco_sent);
188 	fprintf(stdout, "Bytes received: %d\n", r.stat.bytes_recv);
189 	fprintf(stdout, "Bytes sent: %d\n", r.stat.bytes_sent);
190 
191 	return (OK);
192 } /* hci_read_node_stat */
193 
194 /* Send Reset_Node_Stat command to the node */
195 static int
196 hci_reset_node_stat(int s, int argc, char **argv)
197 {
198 	if (ioctl(s, SIOC_HCI_RAW_NODE_RESET_STAT) < 0)
199 		return (ERROR);
200 
201 	return (OK);
202 } /* hci_reset_node_stat */
203 
204 /* Send Flush_Neighbor_Cache command to the node */
205 static int
206 hci_flush_neighbor_cache(int s, int argc, char **argv)
207 {
208 	if (ioctl(s, SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE) < 0)
209 		return (ERROR);
210 
211 	return (OK);
212 } /* hci_flush_neighbor_cache */
213 
214 #define MIN(a,b) (((a)>(b)) ? (b) :(a) )
215 
216 static int  hci_dump_adv(uint8_t *data, int length)
217 {
218 	int elemlen;
219 	int type;
220 	int i;
221 
222 	while(length>0){
223 		elemlen = *data;
224 		data++;
225 		length --;
226 		if(length<=0)
227 			break;
228 		type = *data;
229 		data++;
230 		length --;
231 		elemlen--;
232 		if(length <= 0)
233 			break;
234 		switch(type){
235 		case 0x1:
236 			printf("NDflag:%x\n", *data);
237 			break;
238 		case 0x8:
239 		case 0x9:
240 			printf("LocalName:");
241 			for(i = 0; i < MIN(length,elemlen); i++){
242 				putchar(data[i]);
243 			}
244 			printf("\n");
245 			break;
246 		case 0x6:
247 		case 0x7:
248 		{
249 			uuid_t uuid;
250 			char *uuidstr;
251 			uint32_t ustatus;
252 			if (elemlen < 16)
253 				break;
254 			uuid.time_low = le32dec(data+12);
255 			uuid.time_mid = le16dec(data+10);
256 			uuid.time_hi_and_version = le16dec(data+8);
257 			uuid.clock_seq_hi_and_reserved = data[7];
258 			uuid.clock_seq_low = data[6];
259 			for(i = 0; i < _UUID_NODE_LEN; i++){
260 				uuid.node[i] = data[5 - i];
261 			}
262 			uuid_to_string(&uuid, &uuidstr, &ustatus);
263 
264 			printf("ServiceUUID: %s\n", uuidstr);
265 			break;
266 		}
267 		case 0xff:
268 			if (elemlen < 2)
269 				break;
270 			printf("Vendor:%s:",
271 			       hci_manufacturer2str(data[0]|data[1]<<8));
272 			for (i = 2; i < MIN(length,elemlen); i++) {
273 				printf("%02x ",data[i]);
274 			}
275 			printf("\n");
276 			break;
277 		default:
278 			printf("Type%d:", type);
279 			for(i=0; i < MIN(length,elemlen); i++){
280 				printf("%02x ",data[i]);
281 			}
282 			printf("\n");
283 			break;
284 		}
285 		data += elemlen;
286 		length -= elemlen;
287 	}
288 	return 0;
289 }
290 #undef MIN
291 /* Send Read_Neighbor_Cache command to the node */
292 static int
293 hci_read_neighbor_cache(int s, int argc, char **argv)
294 {
295 	struct ng_btsocket_hci_raw_node_neighbor_cache	r;
296 	int						n, error = OK;
297 	const char  *addrtype2str[] = {"B", "P", "R", "E"};
298 
299 	memset(&r, 0, sizeof(r));
300 	r.num_entries = NG_HCI_MAX_NEIGHBOR_NUM;
301 	r.entries = calloc(NG_HCI_MAX_NEIGHBOR_NUM,
302 				sizeof(ng_hci_node_neighbor_cache_entry_ep));
303 	if (r.entries == NULL) {
304 		errno = ENOMEM;
305 		return (ERROR);
306 	}
307 
308 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE, &r,
309 			sizeof(r)) < 0) {
310 		error = ERROR;
311 		goto out;
312 	}
313 
314 	fprintf(stdout,
315 "T " \
316 "BD_ADDR           " \
317 "Features                " \
318 "Clock offset " \
319 "Page scan " \
320 "Rep. scan\n");
321 
322 	for (n = 0; n < r.num_entries; n++) {
323 	        uint8_t addrtype = r.entries[n].addrtype;
324 		if(addrtype >= sizeof(addrtype2str)/sizeof(addrtype2str[0]))
325 			addrtype = sizeof(addrtype2str)/sizeof(addrtype2str[0]) - 1;
326 		fprintf(stdout,
327 "%1s %-17.17s " \
328 "%02x %02x %02x %02x %02x %02x %02x %02x " \
329 "%#12x " \
330 "%#9x " \
331 "%#9x\n",
332 			addrtype2str[addrtype],
333 			hci_bdaddr2str(&r.entries[n].bdaddr),
334 			r.entries[n].features[0], r.entries[n].features[1],
335 			r.entries[n].features[2], r.entries[n].features[3],
336 			r.entries[n].features[4], r.entries[n].features[5],
337 			r.entries[n].features[6], r.entries[n].features[7],
338 			r.entries[n].clock_offset, r.entries[n].page_scan_mode,
339 			r.entries[n].page_scan_rep_mode);
340 		hci_dump_adv(r.entries[n].extinq_data,
341 			     r.entries[n].extinq_size);
342 		fprintf(stdout,"\n");
343 	}
344 out:
345 	free(r.entries);
346 
347 	return (error);
348 } /* hci_read_neightbor_cache */
349 
350 /* Send Read_Connection_List command to the node */
351 static int
352 hci_read_connection_list(int s, int argc, char **argv)
353 {
354 	struct ng_btsocket_hci_raw_con_list	r;
355 	int					n, error = OK;
356 
357 	memset(&r, 0, sizeof(r));
358 	r.num_connections = NG_HCI_MAX_CON_NUM;
359 	r.connections = calloc(NG_HCI_MAX_CON_NUM, sizeof(ng_hci_node_con_ep));
360 	if (r.connections == NULL) {
361 		errno = ENOMEM;
362 		return (ERROR);
363 	}
364 
365 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_CON_LIST, &r, sizeof(r)) < 0) {
366 		error = ERROR;
367 		goto out;
368 	}
369 
370 	fprintf(stdout,
371 "Remote BD_ADDR    " \
372 "Handle " \
373 "Type " \
374 "Mode " \
375 "Role " \
376 "Encrypt " \
377 "Pending " \
378 "Queue " \
379 "State\n");
380 
381 	for (n = 0; n < r.num_connections; n++) {
382 		fprintf(stdout,
383 "%-17.17s " \
384 "%6d " \
385 "%4.4s " \
386 "%4d " \
387 "%4.4s " \
388 "%7.7s " \
389 "%7d " \
390 "%5d " \
391 "%s\n",
392 			hci_bdaddr2str(&r.connections[n].bdaddr),
393 			r.connections[n].con_handle,
394 			(r.connections[n].link_type == NG_HCI_LINK_ACL)?
395 				"ACL" : "SCO",
396 			r.connections[n].mode,
397 			(r.connections[n].role == NG_HCI_ROLE_MASTER)?
398 				"MAST" : "SLAV",
399 			hci_encrypt2str(r.connections[n].encryption_mode, 1),
400 			r.connections[n].pending,
401 			r.connections[n].queue_len,
402 			hci_con_state2str(r.connections[n].state));
403 	}
404 out:
405 	free(r.connections);
406 
407 	return (error);
408 } /* hci_read_connection_list */
409 
410 /* Send Read_Node_Link_Policy_Settings_Mask command to the node */
411 int
412 hci_read_node_link_policy_settings_mask(int s, int argc, char **argv)
413 {
414 	struct ng_btsocket_hci_raw_node_link_policy_mask	r;
415 
416 	memset(&r, 0, sizeof(r));
417 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK, &r, sizeof(r)) < 0)
418 		return (ERROR);
419 
420 	fprintf(stdout, "Link Policy Settings mask: %#04x\n", r.policy_mask);
421 
422 	return (OK);
423 } /* hci_read_node_link_policy_settings_mask */
424 
425 /* Send Write_Node_Link_Policy_Settings_Mask command to the node */
426 int
427 hci_write_node_link_policy_settings_mask(int s, int argc, char **argv)
428 {
429 	struct ng_btsocket_hci_raw_node_link_policy_mask	r;
430 	int							m;
431 
432 	memset(&r, 0, sizeof(r));
433 
434 	switch (argc) {
435 	case 1:
436 		if (sscanf(argv[0], "%x", &m) != 1)
437 			return (USAGE);
438 
439 		r.policy_mask = (m & 0xffff);
440 		break;
441 
442 	default:
443 		return (USAGE);
444 	}
445 
446 	if (ioctl(s, SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK, &r, sizeof(r)) < 0)
447 		return (ERROR);
448 
449 	return (OK);
450 } /* hci_write_node_link_policy_settings_mask */
451 
452 /* Send Read_Node_Packet_Mask command to the node */
453 int
454 hci_read_node_packet_mask(int s, int argc, char **argv)
455 {
456 	struct ng_btsocket_hci_raw_node_packet_mask	r;
457 
458 	memset(&r, 0, sizeof(r));
459 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_PACKET_MASK, &r, sizeof(r)) < 0)
460 		return (ERROR);
461 
462 	fprintf(stdout, "Packet mask: %#04x\n", r.packet_mask);
463 
464 	return (OK);
465 } /* hci_read_node_packet_mask */
466 
467 /* Send Write_Node_Packet_Mask command to the node */
468 int
469 hci_write_node_packet_mask(int s, int argc, char **argv)
470 {
471 	struct ng_btsocket_hci_raw_node_packet_mask	r;
472 	int						m;
473 
474 	memset(&r, 0, sizeof(r));
475 
476 	switch (argc) {
477 	case 1:
478 		if (sscanf(argv[0], "%x", &m) != 1)
479 			return (USAGE);
480 
481 		r.packet_mask = (m & 0xffff);
482 		break;
483 
484 	default:
485 		return (USAGE);
486 	}
487 
488 	if (ioctl(s, SIOC_HCI_RAW_NODE_SET_PACKET_MASK, &r, sizeof(r)) < 0)
489 		return (ERROR);
490 
491 	return (OK);
492 } /* hci_write_node_packet_mask */
493 
494 /* Send Read_Node_Role_Switch command to the node */
495 int
496 hci_read_node_role_switch(int s, int argc, char **argv)
497 {
498 	struct ng_btsocket_hci_raw_node_role_switch	r;
499 
500 	memset(&r, 0, sizeof(r));
501 	if (ioctl(s, SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH, &r, sizeof(r)) < 0)
502 		return (ERROR);
503 
504 	fprintf(stdout, "Role switch: %d\n", r.role_switch);
505 
506 	return (OK);
507 } /* hci_read_node_role_switch */
508 
509 /* Send Write_Node_Role_Switch command to the node */
510 int
511 hci_write_node_role_switch(int s, int argc, char **argv)
512 {
513 	struct ng_btsocket_hci_raw_node_role_switch	r;
514 	int						m;
515 
516 	memset(&r, 0, sizeof(r));
517 
518 	switch (argc) {
519 	case 1:
520 		if (sscanf(argv[0], "%d", &m) != 1)
521 			return (USAGE);
522 
523 		r.role_switch = m? 1 : 0;
524 		break;
525 
526 	default:
527 		return (USAGE);
528 	}
529 
530 	if (ioctl(s, SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH, &r, sizeof(r)) < 0)
531 		return (ERROR);
532 
533 	return (OK);
534 } /* hci_write_node_role_switch */
535 
536 /* Send Read_Node_List command to the node */
537 int
538 hci_read_node_list(int s, int argc, char **argv)
539 {
540 	struct ng_btsocket_hci_raw_node_list_names	r;
541 	int						i;
542 
543 	r.num_names = MAX_NODE_NUM;
544 	r.names = (struct nodeinfo*)calloc(MAX_NODE_NUM, sizeof(struct nodeinfo));
545 	if (r.names == NULL)
546 		return (ERROR);
547 
548 	if (ioctl(s, SIOC_HCI_RAW_NODE_LIST_NAMES, &r, sizeof(r)) < 0) {
549 		free(r.names);
550 		return (ERROR);
551 	}
552 
553 	fprintf(stdout, "Name            ID       Num hooks\n");
554 	for (i = 0; i < r.num_names; ++i)
555 		fprintf(stdout, "%-15s %08x %9d\n",
556 		    r.names[i].name, r.names[i].id, r.names[i].hooks);
557 
558 	free(r.names);
559 
560 	return (OK);
561 } /* hci_read_node_list */
562 
563 struct hci_command	node_commands[] = {
564 {
565 "read_node_state",
566 "Get the HCI node state",
567 &hci_read_node_state
568 },
569 {
570 "initialize",
571 "Initialize the HCI node",
572 &hci_node_initialize
573 },
574 {
575 "read_debug_level",
576 "Read the HCI node debug level",
577 &hci_read_debug_level
578 },
579 {
580 "write_debug_level <level>",
581 "Write the HCI node debug level",
582 &hci_write_debug_level
583 },
584 {
585 "read_node_buffer_size",
586 "Read the HCI node buffer information. This will return current state of the\n"\
587 "HCI buffer for the HCI node",
588 &hci_read_node_buffer_size
589 },
590 {
591 "read_node_bd_addr",
592 "Read the HCI node BD_ADDR. Returns device BD_ADDR as cached by the HCI node",
593 &hci_read_node_bd_addr
594 },
595 {
596 "read_node_features",
597 "Read the HCI node features. This will return list of supported features as\n" \
598 "cached by the HCI node",
599 &hci_read_node_features
600 },
601 {
602 "read_node_stat",
603 "Read packets and bytes counters for the HCI node",
604 &hci_read_node_stat
605 },
606 {
607 "reset_node_stat",
608 "Reset packets and bytes counters for the HCI node",
609 &hci_reset_node_stat
610 },
611 {
612 "flush_neighbor_cache",
613 "Flush content of the HCI node neighbor cache",
614 &hci_flush_neighbor_cache
615 },
616 {
617 "read_neighbor_cache",
618 "Read content of the HCI node neighbor cache",
619 &hci_read_neighbor_cache
620 },
621 {
622 "read_connection_list",
623 "Read the baseband connection descriptors list for the HCI node",
624 &hci_read_connection_list
625 },
626 {
627 "read_node_link_policy_settings_mask",
628 "Read the value of the Link Policy Settinngs mask for the HCI node",
629 &hci_read_node_link_policy_settings_mask
630 },
631 {
632 "write_node_link_policy_settings_mask <policy_mask>",
633 "Write the value of the Link Policy Settings mask for the HCI node. By default\n" \
634 "all supported Link Policy modes (as reported by the local device features) are\n"\
635 "enabled. The particular Link Policy mode is enabled if local device supports\n"\
636 "it and correspinding bit in the mask was set\n\n" \
637 "\t<policy_mask> - xxxx; Link Policy mask\n" \
638 "\t\t0x0000 - Disable All LM Modes\n" \
639 "\t\t0x0001 - Enable Master Slave Switch\n" \
640 "\t\t0x0002 - Enable Hold Mode\n" \
641 "\t\t0x0004 - Enable Sniff Mode\n" \
642 "\t\t0x0008 - Enable Park Mode\n",
643 &hci_write_node_link_policy_settings_mask
644 },
645 {
646 "read_node_packet_mask",
647 "Read the value of the Packet mask for the HCI node",
648 &hci_read_node_packet_mask
649 },
650 {
651 "write_node_packet_mask <packet_mask>",
652 "Write the value of the Packet mask for the HCI node. By default all supported\n" \
653 "packet types (as reported by the local device features) are enabled. The\n" \
654 "particular packet type is enabled if local device supports it and corresponding\n" \
655 "bit in the mask was set\n\n" \
656 "\t<packet_mask> - xxxx; packet type mask\n" \
657 "" \
658 "\t\tACL packets\n" \
659 "\t\t-----------\n" \
660 "\t\t0x0008 DM1\n" \
661 "\t\t0x0010 DH1\n" \
662 "\t\t0x0400 DM3\n" \
663 "\t\t0x0800 DH3\n" \
664 "\t\t0x4000 DM5\n" \
665 "\t\t0x8000 DH5\n" \
666 "\n" \
667 "\t\tSCO packets\n" \
668 "\t\t-----------\n" \
669 "\t\t0x0020 HV1\n" \
670 "\t\t0x0040 HV2\n" \
671 "\t\t0x0080 HV3\n",
672 &hci_write_node_packet_mask
673 },
674 {
675 "read_node_role_switch",
676 "Read the value of the Role Switch parameter for the HCI node",
677 &hci_read_node_role_switch
678 },
679 {
680 "write_node_role_switch {0|1}",
681 "Write the value of the Role Switch parameter for the HCI node. By default,\n" \
682 "if Role Switch is supported, local device will try to perform Role Switch\n" \
683 "and become Master on incoming connection. Some devices do not support Role\n" \
684 "Switch and thus incoming connections from such devices will fail. Setting\n" \
685 "this parameter to zero will prevent Role Switch and thus accepting device\n" \
686 "will remain Slave",
687 &hci_write_node_role_switch
688 },
689 {
690 "read_node_list",
691 "Get a list of HCI nodes, their Netgraph IDs and connected hooks.",
692 &hci_read_node_list
693 },
694 {
695 NULL,
696 }};
697 
698