4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * $Id: link_control.c,v 1.4 2003/08/18 19:19:54 max Exp $
32 #define L2CAP_SOCKET_CHECKED
33 #include <bluetooth.h>
37 #include "hccontrol.h"
39 static void hci_inquiry_response (int n, uint8_t **b);
41 /* Send Inquiry command to the unit */
43 hci_inquiry(int s, int argc, char **argv)
48 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
54 cp.inquiry_length = 5;
57 /* parse command parameters */
60 /* number of responses, range 0x00 - 0xff */
61 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0 || n0 > 0xff)
64 cp.num_responses = (n0 & 0xff);
67 /* inquiry length (N * 1.28) sec, range 0x01 - 0x30 */
68 if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x1 || n0 > 0x30)
71 cp.inquiry_length = (n0 & 0xff);
75 if (sscanf(argv[0], "%x:%x:%x", &n2, &n1, &n0) != 3)
78 cp.lap[0] = (n0 & 0xff);
79 cp.lap[1] = (n1 & 0xff);
80 cp.lap[2] = (n2 & 0xff);
90 /* send request and expect status back */
92 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
93 NG_HCI_OCF_INQUIRY), (char const *) &cp, sizeof(cp),
101 timeout = cp.inquiry_length * 1.28 + 1;
104 /* wait for inquiry events */
106 if (hci_recv(s, b, &n0) == ERROR) {
111 if (n0 < sizeof(*e)) {
118 case NG_HCI_EVENT_INQUIRY_RESULT: {
119 ng_hci_inquiry_result_ep *ir =
120 (ng_hci_inquiry_result_ep *)(e + 1);
121 uint8_t *r = (uint8_t *)(ir + 1);
123 fprintf(stdout, "Inquiry result, num_responses=%d\n",
126 for (n0 = 0; n0 < ir->num_responses; n0++)
127 hci_inquiry_response(n0, &r);
132 case NG_HCI_EVENT_INQUIRY_COMPL:
133 fprintf(stdout, "Inquiry complete. Status: %s [%#02x]\n",
134 hci_status2str(*(b + sizeof(*e))), *(b + sizeof(*e)));
146 /* Print Inquiry_Result event */
148 hci_inquiry_response(int n, uint8_t **b)
150 ng_hci_inquiry_response *ir = (ng_hci_inquiry_response *)(*b);
152 fprintf(stdout, "Inquiry result #%d\n", n);
153 fprintf(stdout, "\tBD_ADDR: %s\n", hci_bdaddr2str(&ir->bdaddr));
154 fprintf(stdout, "\tPage Scan Rep. Mode: %#02x\n",
155 ir->page_scan_rep_mode);
156 fprintf(stdout, "\tPage Scan Period Mode: %#02x\n",
157 ir->page_scan_period_mode);
158 fprintf(stdout, "\tPage Scan Mode: %#02x\n",
160 fprintf(stdout, "\tClass: %02x:%02x:%02x\n",
161 ir->uclass[2], ir->uclass[1], ir->uclass[0]);
162 fprintf(stdout, "\tClock offset: %#04x\n",
163 le16toh(ir->clock_offset));
166 } /* hci_inquiry_response */
168 /* Send Create_Connection command to the unit */
170 hci_create_connection(int s, int argc, char **argv)
174 ng_hci_create_con_cp cp;
175 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
178 memset(&cp, 0, sizeof(cp));
179 cp.pkt_type = htole16( NG_HCI_PKT_DM1 | NG_HCI_PKT_DH1 |
180 NG_HCI_PKT_DM3 | NG_HCI_PKT_DH3 |
182 cp.page_scan_rep_mode = NG_HCI_SCAN_REP_MODE0;
183 cp.page_scan_mode = NG_HCI_MANDATORY_PAGE_SCAN_MODE;
185 cp.accept_role_switch = 1;
187 /* parse command parameters */
190 /* accept role switch */
191 if (sscanf(argv[5], "%d", &n0) != 1)
194 cp.accept_role_switch = n0 ? 1 : 0;
198 if (sscanf(argv[4], "%d", &n0) != 1)
201 cp.clock_offset = (n0 & 0xffff);
202 cp.clock_offset = htole16(cp.clock_offset);
206 if (sscanf(argv[3], "%d", &n0) != 1 || n0 < 0 || n0 > 3)
209 cp.page_scan_mode = (n0 & 0xff);
212 /* page scan rep mode */
213 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0 || n0 > 2)
216 cp.page_scan_rep_mode = (n0 & 0xff);
220 if (sscanf(argv[1], "%x", &n0) != 1)
223 n0 &= ( NG_HCI_PKT_DM1 | NG_HCI_PKT_DH1 |
224 NG_HCI_PKT_DM3 | NG_HCI_PKT_DH3 |
229 cp.pkt_type = (n0 & 0xffff);
230 cp.pkt_type = htole16(cp.pkt_type);
234 if (!bt_aton(argv[0], &cp.bdaddr)) {
235 struct hostent *he = NULL;
237 if ((he = bt_gethostbyname(argv[0])) == NULL)
240 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
248 /* send request and expect status response */
250 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
251 NG_HCI_OCF_CREATE_CON),
252 (char const *) &cp, sizeof(cp), b, &n0) == ERROR)
261 if (hci_recv(s, b, &n0) == ERROR)
263 if (n0 < sizeof(*e)) {
268 if (e->event == NG_HCI_EVENT_CON_COMPL) {
269 ng_hci_con_compl_ep *ep = (ng_hci_con_compl_ep *)(e + 1);
271 if (ep->status != 0x00) {
272 fprintf(stdout, "Status: %s [%#02x]\n",
273 hci_status2str(ep->status), ep->status);
277 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
278 fprintf(stdout, "Connection handle: %d\n",
279 le16toh(ep->con_handle));
280 fprintf(stdout, "Encryption mode: %s [%d]\n",
281 hci_encrypt2str(ep->encryption_mode, 0),
282 ep->encryption_mode);
287 } /* hci_create_connection */
289 /* Send Disconnect command to the unit */
291 hci_disconnect(int s, int argc, char **argv)
296 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
299 memset(&cp, 0, sizeof(cp));
302 /* parse command parameters */
306 if (sscanf(argv[1], "%d", &n) != 1 || n <= 0x00 || n > 0xff)
309 cp.reason = (uint8_t) (n & 0xff);
312 /* connection handle */
313 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
316 cp.con_handle = (uint16_t) (n & 0x0fff);
317 cp.con_handle = htole16(cp.con_handle);
324 /* send request and expect status response */
326 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
328 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
337 if (hci_recv(s, b, &n) == ERROR)
339 if (n < sizeof(*e)) {
344 if (e->event == NG_HCI_EVENT_DISCON_COMPL) {
345 ng_hci_discon_compl_ep *ep = (ng_hci_discon_compl_ep *)(e + 1);
347 if (ep->status != 0x00) {
348 fprintf(stdout, "Status: %s [%#02x]\n",
349 hci_status2str(ep->status), ep->status);
353 fprintf(stdout, "Connection handle: %d\n",
354 le16toh(ep->con_handle));
355 fprintf(stdout, "Reason: %s [%#02x]\n",
356 hci_status2str(ep->reason), ep->reason);
361 } /* hci_disconnect */
363 /* Send Add_SCO_Connection command to the unit */
365 hci_add_sco_connection(int s, int argc, char **argv)
369 ng_hci_add_sco_con_cp cp;
370 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
373 memset(&cp, 0, sizeof(cp));
374 cp.pkt_type = htole16(NG_HCI_PKT_HV1 | NG_HCI_PKT_HV2 | NG_HCI_PKT_HV3);
376 /* parse command parameters */
380 if (sscanf(argv[1], "%x", &n) != 1)
383 n &= (NG_HCI_PKT_HV1 | NG_HCI_PKT_HV2 | NG_HCI_PKT_HV3);
387 cp.pkt_type = (uint16_t) (n & 0x0fff);
388 cp.pkt_type = htole16(cp.pkt_type);
391 /* acl connection handle */
392 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
395 cp.con_handle = (uint16_t) (n & 0x0fff);
396 cp.con_handle = htole16(cp.con_handle);
403 /* send request and expect status response */
405 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
406 NG_HCI_OCF_ADD_SCO_CON),
407 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
416 if (hci_recv(s, b, &n) == ERROR)
418 if (n < sizeof(*e)) {
423 if (e->event == NG_HCI_EVENT_CON_COMPL) {
424 ng_hci_con_compl_ep *ep = (ng_hci_con_compl_ep *)(e + 1);
426 if (ep->status != 0x00) {
427 fprintf(stdout, "Status: %s [%#02x]\n",
428 hci_status2str(ep->status), ep->status);
432 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
433 fprintf(stdout, "Connection handle: %d\n",
434 le16toh(ep->con_handle));
435 fprintf(stdout, "Encryption mode: %s [%d]\n",
436 hci_encrypt2str(ep->encryption_mode, 0),
437 ep->encryption_mode);
442 } /* Add_SCO_Connection */
444 /* Send Change_Connection_Packet_Type command to the unit */
446 hci_change_connection_packet_type(int s, int argc, char **argv)
450 ng_hci_change_con_pkt_type_cp cp;
451 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
455 /* connection handle */
456 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
459 cp.con_handle = (uint16_t) (n & 0x0fff);
460 cp.con_handle = htole16(cp.con_handle);
463 if (sscanf(argv[1], "%x", &n) != 1)
466 cp.pkt_type = (uint16_t) (n & 0xffff);
467 cp.pkt_type = htole16(cp.pkt_type);
474 /* send request and expect status response */
476 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
477 NG_HCI_OCF_CHANGE_CON_PKT_TYPE),
478 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
487 if (hci_recv(s, b, &n) == ERROR)
489 if (n < sizeof(*e)) {
494 if (e->event == NG_HCI_EVENT_CON_PKT_TYPE_CHANGED) {
495 ng_hci_con_pkt_type_changed_ep *ep =
496 (ng_hci_con_pkt_type_changed_ep *)(e + 1);
498 if (ep->status != 0x00) {
499 fprintf(stdout, "Status: %s [%#02x]\n",
500 hci_status2str(ep->status), ep->status);
504 fprintf(stdout, "Connection handle: %d\n",
505 le16toh(ep->con_handle));
506 fprintf(stdout, "Packet type: %#04x\n",
507 le16toh(ep->pkt_type));
512 } /* hci_change_connection_packet_type */
514 /* Send Remote_Name_Request command to the unit */
516 hci_remote_name_request(int s, int argc, char **argv)
520 ng_hci_remote_name_req_cp cp;
521 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
523 memset(&cp, 0, sizeof(cp));
524 cp.page_scan_rep_mode = NG_HCI_SCAN_REP_MODE0;
525 cp.page_scan_mode = NG_HCI_MANDATORY_PAGE_SCAN_MODE;
527 /* parse command parameters */
531 if (sscanf(argv[3], "%x", &n0) != 1)
534 cp.clock_offset = (n0 & 0xffff);
535 cp.clock_offset = htole16(cp.clock_offset);
539 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x03)
542 cp.page_scan_mode = (n0 & 0xff);
545 /* page_scan_rep_mode */
546 if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x02)
549 cp.page_scan_rep_mode = (n0 & 0xff);
553 if (!bt_aton(argv[0], &cp.bdaddr)) {
554 struct hostent *he = NULL;
556 if ((he = bt_gethostbyname(argv[0])) == NULL)
559 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
567 /* send request and expect status response */
569 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
570 NG_HCI_OCF_REMOTE_NAME_REQ),
571 (char const *) &cp, sizeof(cp), b, &n0) == ERROR)
580 if (hci_recv(s, b, &n0) == ERROR)
582 if (n0 < sizeof(*e)) {
587 if (e->event == NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL) {
588 ng_hci_remote_name_req_compl_ep *ep =
589 (ng_hci_remote_name_req_compl_ep *)(e + 1);
591 if (ep->status != 0x00) {
592 fprintf(stdout, "Status: %s [%#02x]\n",
593 hci_status2str(ep->status), ep->status);
597 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
598 fprintf(stdout, "Name: %s\n", ep->name);
603 } /* hci_remote_name_request */
605 /* Send Read_Remote_Supported_Features command to the unit */
607 hci_read_remote_supported_features(int s, int argc, char **argv)
611 ng_hci_read_remote_features_cp cp;
612 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
615 /* parse command parameters */
618 /* connecton handle */
619 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
622 cp.con_handle = (n & 0x0fff);
623 cp.con_handle = htole16(cp.con_handle);
630 /* send request and expect status response */
632 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
633 NG_HCI_OCF_READ_REMOTE_FEATURES),
634 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
643 if (hci_recv(s, b, &n) == ERROR)
646 if (n < sizeof(*e)) {
651 if (e->event == NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL) {
652 ng_hci_read_remote_features_compl_ep *ep =
653 (ng_hci_read_remote_features_compl_ep *)(e + 1);
655 if (ep->status != 0x00) {
656 fprintf(stdout, "Status: %s [%#02x]\n",
657 hci_status2str(ep->status), ep->status);
661 fprintf(stdout, "Connection handle: %d\n",
662 le16toh(ep->con_handle));
663 fprintf(stdout, "Features: ");
664 for (n = 0; n < sizeof(ep->features); n++)
665 fprintf(stdout, "%#02x ", ep->features[n]);
666 fprintf(stdout, "\n%s\n", hci_features2str(ep->features,
667 buffer, sizeof(buffer)));
672 } /* hci_read_remote_supported_features */
674 /* Send Read_Remote_Version_Information command to the unit */
676 hci_read_remote_version_information(int s, int argc, char **argv)
680 ng_hci_read_remote_ver_info_cp cp;
681 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
683 /* parse command parameters */
686 /* connecton handle */
687 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
690 cp.con_handle = (n & 0x0fff);
691 cp.con_handle = htole16(cp.con_handle);
698 /* send request and expect status response */
700 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
701 NG_HCI_OCF_READ_REMOTE_VER_INFO),
702 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
711 if (hci_recv(s, b, &n) == ERROR)
714 if (n < sizeof(*e)) {
719 if (e->event == NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL) {
720 ng_hci_read_remote_ver_info_compl_ep *ep =
721 (ng_hci_read_remote_ver_info_compl_ep *)(e + 1);
723 if (ep->status != 0x00) {
724 fprintf(stdout, "Status: %s [%#02x]\n",
725 hci_status2str(ep->status), ep->status);
729 ep->manufacturer = le16toh(ep->manufacturer);
731 fprintf(stdout, "Connection handle: %d\n",
732 le16toh(ep->con_handle));
733 fprintf(stdout, "LMP version: %s [%#02x]\n",
734 hci_lmpver2str(ep->lmp_version), ep->lmp_version);
735 fprintf(stdout, "LMP sub-version: %#04x\n",
736 le16toh(ep->lmp_subversion));
737 fprintf(stdout, "Manufacturer: %s [%#04x]\n",
738 hci_manufacturer2str(ep->manufacturer),
744 } /* hci_read_remote_version_information */
746 /* Send Read_Clock_Offset command to the unit */
748 hci_read_clock_offset(int s, int argc, char **argv)
752 ng_hci_read_clock_offset_cp cp;
753 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
755 /* parse command parameters */
758 /* connecton handle */
759 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
762 cp.con_handle = (n & 0x0fff);
763 cp.con_handle = htole16(cp.con_handle);
770 /* send request and expect status response */
772 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
773 NG_HCI_OCF_READ_CLOCK_OFFSET),
774 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
783 if (hci_recv(s, b, &n) == ERROR)
786 if (n < sizeof(*e)) {
791 if (e->event == NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL) {
792 ng_hci_read_clock_offset_compl_ep *ep =
793 (ng_hci_read_clock_offset_compl_ep *)(e + 1);
795 if (ep->status != 0x00) {
796 fprintf(stdout, "Status: %s [%#02x]\n",
797 hci_status2str(ep->status), ep->status);
801 fprintf(stdout, "Connection handle: %d\n",
802 le16toh(ep->con_handle));
803 fprintf(stdout, "Clock offset: %#04x\n",
804 le16toh(ep->clock_offset));
809 } /* hci_read_clock_offset */
811 struct hci_command link_control_commands[] = {
813 "inquiry <LAP> <inquiry_length> <num_reponses>",
814 "\nThis command will cause the Bluetooth unit to enter Inquiry Mode.\n" \
815 "Inquiry Mode is used to discover other nearby Bluetooth units. The LAP\n" \
816 "input parameter contains the LAP from which the inquiry access code shall\n" \
817 "be derived when the inquiry procedure is made. The Inquiry_Length parameter\n"\
818 "specifies the total duration of the Inquiry Mode and, when this time\n" \
819 "expires, Inquiry will be halted. The Num_Responses parameter specifies the\n" \
820 "number of responses that can be received before the Inquiry is halted.\n\n" \
821 "\t<LAP> - xx:xx:xx; 9e:8b:33 (GIAC), 93:8b:00 (LDIAC)\n" \
822 "\t<inquiry_length> - dd; total length == dd * 1.28 sec\n" \
823 "\t<num_responses> - dd",
827 "create_connection <BD_ADDR> <pkt> <rep_mode> <ps_mode> <clck_off> <role_sw>",
829 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name\n\n" \
830 "\t<pkt> - xxxx; packet type\n" \
832 "\t\tACL packets\n" \
833 "\t\t-----------\n" \
839 "\t\t0x8000 DH5\n\n" \
841 "\trep_mode - d; page scan repetition mode\n" \
843 "\t\tPage scan repetition modes\n" \
844 "\t\t--------------------------\n" \
845 "\t\t0 Page scan repetition mode 0\n" \
846 "\t\t1 Page scan repetition mode 1\n" \
847 "\t\t2 Page scan repetition mode 2\n" \
849 "\tps_mode - d; Page scan mode\n" \
851 "\t\tPage scan modes\n" \
852 "\t\t---------------\n" \
853 "\t\t0 Mandatory page scan mode\n" \
854 "\t\t1 Optional page scan mode1\n" \
855 "\t\t2 Optional page scan mode2\n" \
856 "\t\t3 Optional page scan mode3\n" \
858 "\tclck_off - dddd; clock offset. Use 0 if unknown\n\n" \
859 "\trole_sw - d; allow (1) or deny role switch\n",
860 &hci_create_connection
863 "disconnect <connection_handle> <reason>",
864 "\nThe Disconnection command is used to terminate an existing connection.\n" \
865 "The connection handle command parameter indicates which connection is to\n" \
866 "be disconnected. The Reason command parameter indicates the reason for\n" \
867 "ending the connection.\n\n" \
868 "\t<connection_handle> - dddd; connection handle\n" \
869 "\t<reason> - dd; reason; usually 19 (0x13) - user ended;\n" \
870 "\t also 0x05, 0x13-0x15, 0x1A, 0x29",
874 "add_sco_connection <acl connection handle> <packet type>",
875 "This command will cause the link manager to create a SCO connection using\n" \
876 "the ACL connection specified by the connection handle command parameter.\n" \
877 "The Link Manager will determine how the new connection is established. This\n"\
878 "connection is determined by the current state of the device, its piconet,\n" \
879 "and the state of the device to be connected. The packet type command parameter\n" \
880 "specifies which packet types the Link Manager should use for the connection.\n"\
881 "The Link Manager must only use the packet type(s) specified by the packet\n" \
882 "type command parameter for sending HCI SCO data packets. Multiple packet\n" \
883 "types may be specified for the packet type command parameter by performing\n" \
884 "a bitwise OR operation of the different packet types. Note: An SCO connection\n" \
885 "can only be created when an ACL connection already exists and when it is\n" \
886 "not put in park mode.\n\n" \
887 "\t<connection_handle> - dddd; ACL connection handle\n" \
888 "\t<packet_type> - xxxx; packet type\n" \
890 "\t\tSCO packets\n" \
891 "\t\t-----------\n" \
895 &hci_add_sco_connection
898 "change_connection_packet_type <connection_hande> <packet_type>",
899 "The Change_Connection_Packet_Type command is used to change which packet\n" \
900 "types can be used for a connection that is currently established. This\n" \
901 "allows current connections to be dynamically modified to support different\n" \
902 "types of user data. The Packet_Type command parameter specifies which\n" \
903 "packet types the Link Manager can use for the connection. Multiple packet\n" \
904 "types may be specified for the Packet_Type command parameter by bitwise OR\n" \
905 "operation of the different packet types.\n\n" \
906 "\t<connection_handle> - dddd; connection handle\n" \
907 "\t<packet_type> - xxxx; packet type mask\n" \
909 "\t\tACL packets\n" \
910 "\t\t-----------\n" \
916 "\t\t0x8000 DH5\n\n" \
918 "\t\tSCO packets\n" \
919 "\t\t-----------\n" \
924 &hci_change_connection_packet_type
927 "remote_name_request <BD_ADDR> <ps_rep_mode> <ps_mode> <clock_offset>",
928 "\nThe Remote_Name_Request command is used to obtain the user-friendly\n" \
929 "name of another Bluetooth unit.\n\n" \
930 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name\n" \
931 "\t<ps_rep_mode> - dd; page scan repetition mode [0-2]\n" \
932 "\t<ps_mode> - dd; page scan mode [0-3]\n" \
933 "\t<clock_offset> - xxxx; clock offset [0 - 0xffff]",
934 &hci_remote_name_request
937 "read_remote_supported_features <connection_handle>",
938 "\nThis command requests a list of the supported features for the remote\n" \
939 "unit identified by the connection handle parameter. The connection handle\n" \
940 "must be a connection handle for an ACL connection.\n\n" \
941 "\t<connection_handle> - dddd; connection handle",
942 &hci_read_remote_supported_features
945 "read_remote_version_information <connection_handle>",
946 "\nThis command will obtain the values for the version information for the\n" \
947 "remote Bluetooth unit identified by the connection handle parameter. The\n" \
948 "connection handle must be a connection handle for an ACL connection.\n\n" \
949 "\t<connection_handle> - dddd; connection handle",
950 &hci_read_remote_version_information
953 "read_clock_offset <connection_handle>",
954 "\nThis command allows the Host to read the clock offset from the remote unit.\n" \
955 "\t<connection_handle> - dddd; connection handle",
956 &hci_read_clock_offset