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:%04x:", data[0]|data[1]<<8); 271 for (i = 2; i < MIN(length,elemlen); i++) { 272 printf("%02x ",data[i]); 273 } 274 printf("\n"); 275 break; 276 default: 277 printf("Type%d:", type); 278 for(i=0; i < MIN(length,elemlen); i++){ 279 printf("%02x ",data[i]); 280 } 281 printf("\n"); 282 break; 283 } 284 data += elemlen; 285 length -= elemlen; 286 } 287 return 0; 288 } 289 #undef MIN 290 /* Send Read_Neighbor_Cache command to the node */ 291 static int 292 hci_read_neighbor_cache(int s, int argc, char **argv) 293 { 294 struct ng_btsocket_hci_raw_node_neighbor_cache r; 295 int n, error = OK; 296 const char *addrtype2str[] = {"B", "P", "R", "E"}; 297 298 memset(&r, 0, sizeof(r)); 299 r.num_entries = NG_HCI_MAX_NEIGHBOR_NUM; 300 r.entries = calloc(NG_HCI_MAX_NEIGHBOR_NUM, 301 sizeof(ng_hci_node_neighbor_cache_entry_ep)); 302 if (r.entries == NULL) { 303 errno = ENOMEM; 304 return (ERROR); 305 } 306 307 if (ioctl(s, SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE, &r, 308 sizeof(r)) < 0) { 309 error = ERROR; 310 goto out; 311 } 312 313 fprintf(stdout, 314 "T " \ 315 "BD_ADDR " \ 316 "Features " \ 317 "Clock offset " \ 318 "Page scan " \ 319 "Rep. scan\n"); 320 321 for (n = 0; n < r.num_entries; n++) { 322 uint8_t addrtype = r.entries[n].addrtype; 323 if(addrtype >= sizeof(addrtype2str)/sizeof(addrtype2str[0])) 324 addrtype = sizeof(addrtype2str)/sizeof(addrtype2str[0]) - 1; 325 fprintf(stdout, 326 "%1s %-17.17s " \ 327 "%02x %02x %02x %02x %02x %02x %02x %02x " \ 328 "%#12x " \ 329 "%#9x " \ 330 "%#9x\n", 331 addrtype2str[addrtype], 332 hci_bdaddr2str(&r.entries[n].bdaddr), 333 r.entries[n].features[0], r.entries[n].features[1], 334 r.entries[n].features[2], r.entries[n].features[3], 335 r.entries[n].features[4], r.entries[n].features[5], 336 r.entries[n].features[6], r.entries[n].features[7], 337 r.entries[n].clock_offset, r.entries[n].page_scan_mode, 338 r.entries[n].page_scan_rep_mode); 339 hci_dump_adv(r.entries[n].extinq_data, 340 r.entries[n].extinq_size); 341 fprintf(stdout,"\n"); 342 } 343 out: 344 free(r.entries); 345 346 return (error); 347 } /* hci_read_neightbor_cache */ 348 349 /* Send Read_Connection_List command to the node */ 350 static int 351 hci_read_connection_list(int s, int argc, char **argv) 352 { 353 struct ng_btsocket_hci_raw_con_list r; 354 int n, error = OK; 355 356 memset(&r, 0, sizeof(r)); 357 r.num_connections = NG_HCI_MAX_CON_NUM; 358 r.connections = calloc(NG_HCI_MAX_CON_NUM, sizeof(ng_hci_node_con_ep)); 359 if (r.connections == NULL) { 360 errno = ENOMEM; 361 return (ERROR); 362 } 363 364 if (ioctl(s, SIOC_HCI_RAW_NODE_GET_CON_LIST, &r, sizeof(r)) < 0) { 365 error = ERROR; 366 goto out; 367 } 368 369 fprintf(stdout, 370 "Remote BD_ADDR " \ 371 "Handle " \ 372 "Type " \ 373 "Mode " \ 374 "Role " \ 375 "Encrypt " \ 376 "Pending " \ 377 "Queue " \ 378 "State\n"); 379 380 for (n = 0; n < r.num_connections; n++) { 381 fprintf(stdout, 382 "%-17.17s " \ 383 "%6d " \ 384 "%4.4s " \ 385 "%4d " \ 386 "%4.4s " \ 387 "%7.7s " \ 388 "%7d " \ 389 "%5d " \ 390 "%s\n", 391 hci_bdaddr2str(&r.connections[n].bdaddr), 392 r.connections[n].con_handle, 393 (r.connections[n].link_type == NG_HCI_LINK_ACL)? 394 "ACL" : "SCO", 395 r.connections[n].mode, 396 (r.connections[n].role == NG_HCI_ROLE_MASTER)? 397 "MAST" : "SLAV", 398 hci_encrypt2str(r.connections[n].encryption_mode, 1), 399 r.connections[n].pending, 400 r.connections[n].queue_len, 401 hci_con_state2str(r.connections[n].state)); 402 } 403 out: 404 free(r.connections); 405 406 return (error); 407 } /* hci_read_connection_list */ 408 409 /* Send Read_Node_Link_Policy_Settings_Mask command to the node */ 410 int 411 hci_read_node_link_policy_settings_mask(int s, int argc, char **argv) 412 { 413 struct ng_btsocket_hci_raw_node_link_policy_mask r; 414 415 memset(&r, 0, sizeof(r)); 416 if (ioctl(s, SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK, &r, sizeof(r)) < 0) 417 return (ERROR); 418 419 fprintf(stdout, "Link Policy Settings mask: %#04x\n", r.policy_mask); 420 421 return (OK); 422 } /* hci_read_node_link_policy_settings_mask */ 423 424 /* Send Write_Node_Link_Policy_Settings_Mask command to the node */ 425 int 426 hci_write_node_link_policy_settings_mask(int s, int argc, char **argv) 427 { 428 struct ng_btsocket_hci_raw_node_link_policy_mask r; 429 int m; 430 431 memset(&r, 0, sizeof(r)); 432 433 switch (argc) { 434 case 1: 435 if (sscanf(argv[0], "%x", &m) != 1) 436 return (USAGE); 437 438 r.policy_mask = (m & 0xffff); 439 break; 440 441 default: 442 return (USAGE); 443 } 444 445 if (ioctl(s, SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK, &r, sizeof(r)) < 0) 446 return (ERROR); 447 448 return (OK); 449 } /* hci_write_node_link_policy_settings_mask */ 450 451 /* Send Read_Node_Packet_Mask command to the node */ 452 int 453 hci_read_node_packet_mask(int s, int argc, char **argv) 454 { 455 struct ng_btsocket_hci_raw_node_packet_mask r; 456 457 memset(&r, 0, sizeof(r)); 458 if (ioctl(s, SIOC_HCI_RAW_NODE_GET_PACKET_MASK, &r, sizeof(r)) < 0) 459 return (ERROR); 460 461 fprintf(stdout, "Packet mask: %#04x\n", r.packet_mask); 462 463 return (OK); 464 } /* hci_read_node_packet_mask */ 465 466 /* Send Write_Node_Packet_Mask command to the node */ 467 int 468 hci_write_node_packet_mask(int s, int argc, char **argv) 469 { 470 struct ng_btsocket_hci_raw_node_packet_mask r; 471 int m; 472 473 memset(&r, 0, sizeof(r)); 474 475 switch (argc) { 476 case 1: 477 if (sscanf(argv[0], "%x", &m) != 1) 478 return (USAGE); 479 480 r.packet_mask = (m & 0xffff); 481 break; 482 483 default: 484 return (USAGE); 485 } 486 487 if (ioctl(s, SIOC_HCI_RAW_NODE_SET_PACKET_MASK, &r, sizeof(r)) < 0) 488 return (ERROR); 489 490 return (OK); 491 } /* hci_write_node_packet_mask */ 492 493 /* Send Read_Node_Role_Switch command to the node */ 494 int 495 hci_read_node_role_switch(int s, int argc, char **argv) 496 { 497 struct ng_btsocket_hci_raw_node_role_switch r; 498 499 memset(&r, 0, sizeof(r)); 500 if (ioctl(s, SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH, &r, sizeof(r)) < 0) 501 return (ERROR); 502 503 fprintf(stdout, "Role switch: %d\n", r.role_switch); 504 505 return (OK); 506 } /* hci_read_node_role_switch */ 507 508 /* Send Write_Node_Role_Switch command to the node */ 509 int 510 hci_write_node_role_switch(int s, int argc, char **argv) 511 { 512 struct ng_btsocket_hci_raw_node_role_switch r; 513 int m; 514 515 memset(&r, 0, sizeof(r)); 516 517 switch (argc) { 518 case 1: 519 if (sscanf(argv[0], "%d", &m) != 1) 520 return (USAGE); 521 522 r.role_switch = m? 1 : 0; 523 break; 524 525 default: 526 return (USAGE); 527 } 528 529 if (ioctl(s, SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH, &r, sizeof(r)) < 0) 530 return (ERROR); 531 532 return (OK); 533 } /* hci_write_node_role_switch */ 534 535 /* Send Read_Node_List command to the node */ 536 int 537 hci_read_node_list(int s, int argc, char **argv) 538 { 539 struct ng_btsocket_hci_raw_node_list_names r; 540 int i; 541 542 r.num_names = MAX_NODE_NUM; 543 r.names = (struct nodeinfo*)calloc(MAX_NODE_NUM, sizeof(struct nodeinfo)); 544 if (r.names == NULL) 545 return (ERROR); 546 547 if (ioctl(s, SIOC_HCI_RAW_NODE_LIST_NAMES, &r, sizeof(r)) < 0) { 548 free(r.names); 549 return (ERROR); 550 } 551 552 fprintf(stdout, "Name ID Num hooks\n"); 553 for (i = 0; i < r.num_names; ++i) 554 fprintf(stdout, "%-15s %08x %9d\n", 555 r.names[i].name, r.names[i].id, r.names[i].hooks); 556 557 free(r.names); 558 559 return (OK); 560 } /* hci_read_node_list */ 561 562 struct hci_command node_commands[] = { 563 { 564 "read_node_state", 565 "Get the HCI node state", 566 &hci_read_node_state 567 }, 568 { 569 "initialize", 570 "Initialize the HCI node", 571 &hci_node_initialize 572 }, 573 { 574 "read_debug_level", 575 "Read the HCI node debug level", 576 &hci_read_debug_level 577 }, 578 { 579 "write_debug_level <level>", 580 "Write the HCI node debug level", 581 &hci_write_debug_level 582 }, 583 { 584 "read_node_buffer_size", 585 "Read the HCI node buffer information. This will return current state of the\n"\ 586 "HCI buffer for the HCI node", 587 &hci_read_node_buffer_size 588 }, 589 { 590 "read_node_bd_addr", 591 "Read the HCI node BD_ADDR. Returns device BD_ADDR as cached by the HCI node", 592 &hci_read_node_bd_addr 593 }, 594 { 595 "read_node_features", 596 "Read the HCI node features. This will return list of supported features as\n" \ 597 "cached by the HCI node", 598 &hci_read_node_features 599 }, 600 { 601 "read_node_stat", 602 "Read packets and bytes counters for the HCI node", 603 &hci_read_node_stat 604 }, 605 { 606 "reset_node_stat", 607 "Reset packets and bytes counters for the HCI node", 608 &hci_reset_node_stat 609 }, 610 { 611 "flush_neighbor_cache", 612 "Flush content of the HCI node neighbor cache", 613 &hci_flush_neighbor_cache 614 }, 615 { 616 "read_neighbor_cache", 617 "Read content of the HCI node neighbor cache", 618 &hci_read_neighbor_cache 619 }, 620 { 621 "read_connection_list", 622 "Read the baseband connection descriptors list for the HCI node", 623 &hci_read_connection_list 624 }, 625 { 626 "read_node_link_policy_settings_mask", 627 "Read the value of the Link Policy Settinngs mask for the HCI node", 628 &hci_read_node_link_policy_settings_mask 629 }, 630 { 631 "write_node_link_policy_settings_mask <policy_mask>", 632 "Write the value of the Link Policy Settings mask for the HCI node. By default\n" \ 633 "all supported Link Policy modes (as reported by the local device features) are\n"\ 634 "enabled. The particular Link Policy mode is enabled if local device supports\n"\ 635 "it and correspinding bit in the mask was set\n\n" \ 636 "\t<policy_mask> - xxxx; Link Policy mask\n" \ 637 "\t\t0x0000 - Disable All LM Modes\n" \ 638 "\t\t0x0001 - Enable Master Slave Switch\n" \ 639 "\t\t0x0002 - Enable Hold Mode\n" \ 640 "\t\t0x0004 - Enable Sniff Mode\n" \ 641 "\t\t0x0008 - Enable Park Mode\n", 642 &hci_write_node_link_policy_settings_mask 643 }, 644 { 645 "read_node_packet_mask", 646 "Read the value of the Packet mask for the HCI node", 647 &hci_read_node_packet_mask 648 }, 649 { 650 "write_node_packet_mask <packet_mask>", 651 "Write the value of the Packet mask for the HCI node. By default all supported\n" \ 652 "packet types (as reported by the local device features) are enabled. The\n" \ 653 "particular packet type is enabled if local device supports it and corresponding\n" \ 654 "bit in the mask was set\n\n" \ 655 "\t<packet_mask> - xxxx; packet type mask\n" \ 656 "" \ 657 "\t\tACL packets\n" \ 658 "\t\t-----------\n" \ 659 "\t\t0x0008 DM1\n" \ 660 "\t\t0x0010 DH1\n" \ 661 "\t\t0x0400 DM3\n" \ 662 "\t\t0x0800 DH3\n" \ 663 "\t\t0x4000 DM5\n" \ 664 "\t\t0x8000 DH5\n" \ 665 "\n" \ 666 "\t\tSCO packets\n" \ 667 "\t\t-----------\n" \ 668 "\t\t0x0020 HV1\n" \ 669 "\t\t0x0040 HV2\n" \ 670 "\t\t0x0080 HV3\n", 671 &hci_write_node_packet_mask 672 }, 673 { 674 "read_node_role_switch", 675 "Read the value of the Role Switch parameter for the HCI node", 676 &hci_read_node_role_switch 677 }, 678 { 679 "write_node_role_switch {0|1}", 680 "Write the value of the Role Switch parameter for the HCI node. By default,\n" \ 681 "if Role Switch is supported, local device will try to perform Role Switch\n" \ 682 "and become Master on incoming connection. Some devices do not support Role\n" \ 683 "Switch and thus incoming connections from such devices will fail. Setting\n" \ 684 "this parameter to zero will prevent Role Switch and thus accepting device\n" \ 685 "will remain Slave", 686 &hci_write_node_role_switch 687 }, 688 { 689 "read_node_list", 690 "Get a list of HCI nodes, their Netgraph IDs and connected hooks.", 691 &hci_read_node_list 692 }, 693 { 694 NULL, 695 }}; 696 697