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 #include <bluetooth.h>
36 #include "hccontrol.h"
38 static void hci_inquiry_response (int n, uint8_t **b);
40 /* Send Inquiry command to the unit */
42 hci_inquiry(int s, int argc, char **argv)
47 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
53 cp.inquiry_length = 5;
56 /* parse command parameters */
59 /* number of responses, range 0x00 - 0xff */
60 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0 || n0 > 0xff)
63 cp.num_responses = (n0 & 0xff);
66 /* inquiry length (N * 1.28) sec, range 0x01 - 0x30 */
67 if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x1 || n0 > 0x30)
70 cp.inquiry_length = (n0 & 0xff);
74 if (sscanf(argv[0], "%x:%x:%x", &n2, &n1, &n0) != 3)
77 cp.lap[0] = (n0 & 0xff);
78 cp.lap[1] = (n1 & 0xff);
79 cp.lap[2] = (n2 & 0xff);
89 /* send request and expect status back */
91 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
92 NG_HCI_OCF_INQUIRY), (char const *) &cp, sizeof(cp),
100 timeout = cp.inquiry_length * 1.28 + 1;
103 /* wait for inquiry events */
105 if (hci_recv(s, b, &n0) == ERROR) {
110 if (n0 < sizeof(*e)) {
117 case NG_HCI_EVENT_INQUIRY_RESULT: {
118 ng_hci_inquiry_result_ep *ir =
119 (ng_hci_inquiry_result_ep *)(e + 1);
120 uint8_t *r = (uint8_t *)(ir + 1);
122 fprintf(stdout, "Inquiry result, num_responses=%d\n",
125 for (n0 = 0; n0 < ir->num_responses; n0++)
126 hci_inquiry_response(n0, &r);
131 case NG_HCI_EVENT_INQUIRY_COMPL:
132 fprintf(stdout, "Inquiry complete. Status: %s [%#02x]\n",
133 hci_status2str(*(b + sizeof(*e))), *(b + sizeof(*e)));
145 /* Print Inquiry_Result event */
147 hci_inquiry_response(int n, uint8_t **b)
149 ng_hci_inquiry_response *ir = (ng_hci_inquiry_response *)(*b);
151 fprintf(stdout, "Inquiry result #%d\n", n);
152 fprintf(stdout, "\tBD_ADDR: %s\n", hci_bdaddr2str(&ir->bdaddr));
153 fprintf(stdout, "\tPage Scan Rep. Mode: %#02x\n",
154 ir->page_scan_rep_mode);
155 fprintf(stdout, "\tPage Scan Period Mode: %#02x\n",
156 ir->page_scan_period_mode);
157 fprintf(stdout, "\tPage Scan Mode: %#02x\n",
159 fprintf(stdout, "\tClass: %02x:%02x:%02x\n",
160 ir->uclass[2], ir->uclass[1], ir->uclass[0]);
161 fprintf(stdout, "\tClock offset: %#04x\n",
162 le16toh(ir->clock_offset));
165 } /* hci_inquiry_response */
167 /* Send Create_Connection command to the unit */
169 hci_create_connection(int s, int argc, char **argv)
173 ng_hci_create_con_cp cp;
174 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
177 memset(&cp, 0, sizeof(cp));
178 cp.pkt_type = htole16( NG_HCI_PKT_DM1 | NG_HCI_PKT_DH1 |
179 NG_HCI_PKT_DM3 | NG_HCI_PKT_DH3 |
181 cp.page_scan_rep_mode = NG_HCI_SCAN_REP_MODE0;
182 cp.page_scan_mode = NG_HCI_MANDATORY_PAGE_SCAN_MODE;
184 cp.accept_role_switch = 1;
186 /* parse command parameters */
189 /* accept role switch */
190 if (sscanf(argv[5], "%d", &n0) != 1)
193 cp.accept_role_switch = n0 ? 1 : 0;
197 if (sscanf(argv[4], "%d", &n0) != 1)
200 cp.clock_offset = (n0 & 0xffff);
201 cp.clock_offset = htole16(cp.clock_offset);
205 if (sscanf(argv[3], "%d", &n0) != 1 || n0 < 0 || n0 > 3)
208 cp.page_scan_mode = (n0 & 0xff);
211 /* page scan rep mode */
212 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0 || n0 > 2)
215 cp.page_scan_rep_mode = (n0 & 0xff);
219 if (sscanf(argv[1], "%x", &n0) != 1)
222 n0 &= ( NG_HCI_PKT_DM1 | NG_HCI_PKT_DH1 |
223 NG_HCI_PKT_DM3 | NG_HCI_PKT_DH3 |
228 cp.pkt_type = (n0 & 0xffff);
229 cp.pkt_type = htole16(cp.pkt_type);
233 if (!bt_aton(argv[0], &cp.bdaddr)) {
234 struct hostent *he = NULL;
236 if ((he = bt_gethostbyname(argv[0])) == NULL)
239 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
247 /* send request and expect status response */
249 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
250 NG_HCI_OCF_CREATE_CON),
251 (char const *) &cp, sizeof(cp), b, &n0) == ERROR)
260 if (hci_recv(s, b, &n0) == ERROR)
262 if (n0 < sizeof(*e)) {
267 if (e->event == NG_HCI_EVENT_CON_COMPL) {
268 ng_hci_con_compl_ep *ep = (ng_hci_con_compl_ep *)(e + 1);
270 if (ep->status != 0x00) {
271 fprintf(stdout, "Status: %s [%#02x]\n",
272 hci_status2str(ep->status), ep->status);
276 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
277 fprintf(stdout, "Connection handle: %d\n",
278 le16toh(ep->con_handle));
279 fprintf(stdout, "Encryption mode: %s [%d]\n",
280 hci_encrypt2str(ep->encryption_mode, 0),
281 ep->encryption_mode);
286 } /* hci_create_connection */
288 /* Send Disconnect command to the unit */
290 hci_disconnect(int s, int argc, char **argv)
295 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
298 memset(&cp, 0, sizeof(cp));
301 /* parse command parameters */
305 if (sscanf(argv[1], "%d", &n) != 1 || n <= 0x00 || n > 0xff)
308 cp.reason = (uint8_t) (n & 0xff);
311 /* connection handle */
312 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
315 cp.con_handle = (uint16_t) (n & 0x0fff);
316 cp.con_handle = htole16(cp.con_handle);
323 /* send request and expect status response */
325 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
327 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
336 if (hci_recv(s, b, &n) == ERROR)
338 if (n < sizeof(*e)) {
343 if (e->event == NG_HCI_EVENT_DISCON_COMPL) {
344 ng_hci_discon_compl_ep *ep = (ng_hci_discon_compl_ep *)(e + 1);
346 if (ep->status != 0x00) {
347 fprintf(stdout, "Status: %s [%#02x]\n",
348 hci_status2str(ep->status), ep->status);
352 fprintf(stdout, "Connection handle: %d\n",
353 le16toh(ep->con_handle));
354 fprintf(stdout, "Reason: %s [%#02x]\n",
355 hci_status2str(ep->reason), ep->reason);
360 } /* hci_diconnect */
362 /* Send Add_SCO_Connection command to the unit */
364 hci_add_sco_connection(int s, int argc, char **argv)
368 ng_hci_add_sco_con_cp cp;
369 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
372 memset(&cp, 0, sizeof(cp));
373 cp.pkt_type = htole16(NG_HCI_PKT_HV1 | NG_HCI_PKT_HV2 | NG_HCI_PKT_HV3);
375 /* parse command parameters */
379 if (sscanf(argv[1], "%x", &n) != 1)
382 n &= (NG_HCI_PKT_HV1 | NG_HCI_PKT_HV2 | NG_HCI_PKT_HV3);
386 cp.pkt_type = (uint16_t) (n & 0x0fff);
387 cp.pkt_type = htole16(cp.pkt_type);
390 /* acl connection handle */
391 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
394 cp.con_handle = (uint16_t) (n & 0x0fff);
395 cp.con_handle = htole16(cp.con_handle);
402 /* send request and expect status response */
404 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
405 NG_HCI_OCF_ADD_SCO_CON),
406 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
415 if (hci_recv(s, b, &n) == ERROR)
417 if (n < sizeof(*e)) {
422 if (e->event == NG_HCI_EVENT_CON_COMPL) {
423 ng_hci_con_compl_ep *ep = (ng_hci_con_compl_ep *)(e + 1);
425 if (ep->status != 0x00) {
426 fprintf(stdout, "Status: %s [%#02x]\n",
427 hci_status2str(ep->status), ep->status);
431 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
432 fprintf(stdout, "Connection handle: %d\n",
433 le16toh(ep->con_handle));
434 fprintf(stdout, "Encryption mode: %s [%d]\n",
435 hci_encrypt2str(ep->encryption_mode, 0),
436 ep->encryption_mode);
441 } /* Add_SCO_Connection */
443 /* Send Change_Connection_Packet_Type command to the unit */
445 hci_change_connection_packet_type(int s, int argc, char **argv)
449 ng_hci_change_con_pkt_type_cp cp;
450 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
454 /* connection handle */
455 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
458 cp.con_handle = (uint16_t) (n & 0x0fff);
459 cp.con_handle = htole16(cp.con_handle);
462 if (sscanf(argv[1], "%x", &n) != 1)
465 cp.pkt_type = (uint16_t) (n & 0xffff);
466 cp.pkt_type = htole16(cp.pkt_type);
473 /* send request and expect status response */
475 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
476 NG_HCI_OCF_CHANGE_CON_PKT_TYPE),
477 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
486 if (hci_recv(s, b, &n) == ERROR)
488 if (n < sizeof(*e)) {
493 if (e->event == NG_HCI_EVENT_CON_PKT_TYPE_CHANGED) {
494 ng_hci_con_pkt_type_changed_ep *ep =
495 (ng_hci_con_pkt_type_changed_ep *)(e + 1);
497 if (ep->status != 0x00) {
498 fprintf(stdout, "Status: %s [%#02x]\n",
499 hci_status2str(ep->status), ep->status);
503 fprintf(stdout, "Connection handle: %d\n",
504 le16toh(ep->con_handle));
505 fprintf(stdout, "Packet type: %#04x\n",
506 le16toh(ep->pkt_type));
511 } /* hci_change_connection_packet_type */
513 /* Send Remote_Name_Request command to the unit */
515 hci_remote_name_request(int s, int argc, char **argv)
519 ng_hci_remote_name_req_cp cp;
520 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
522 memset(&cp, 0, sizeof(cp));
523 cp.page_scan_rep_mode = NG_HCI_SCAN_REP_MODE0;
524 cp.page_scan_mode = NG_HCI_MANDATORY_PAGE_SCAN_MODE;
526 /* parse command parameters */
530 if (sscanf(argv[3], "%x", &n0) != 1)
533 cp.clock_offset = (n0 & 0xffff);
534 cp.clock_offset = htole16(cp.clock_offset);
538 if (sscanf(argv[2], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x03)
541 cp.page_scan_mode = (n0 & 0xff);
544 /* page_scan_rep_mode */
545 if (sscanf(argv[1], "%d", &n0) != 1 || n0 < 0x00 || n0 > 0x02)
548 cp.page_scan_rep_mode = (n0 & 0xff);
552 if (!bt_aton(argv[0], &cp.bdaddr)) {
553 struct hostent *he = NULL;
555 if ((he = bt_gethostbyname(argv[0])) == NULL)
558 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
566 /* send request and expect status response */
568 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
569 NG_HCI_OCF_REMOTE_NAME_REQ),
570 (char const *) &cp, sizeof(cp), b, &n0) == ERROR)
579 if (hci_recv(s, b, &n0) == ERROR)
581 if (n0 < sizeof(*e)) {
586 if (e->event == NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL) {
587 ng_hci_remote_name_req_compl_ep *ep =
588 (ng_hci_remote_name_req_compl_ep *)(e + 1);
590 if (ep->status != 0x00) {
591 fprintf(stdout, "Status: %s [%#02x]\n",
592 hci_status2str(ep->status), ep->status);
596 fprintf(stdout, "BD_ADDR: %s\n", hci_bdaddr2str(&ep->bdaddr));
597 fprintf(stdout, "Name: %s\n", ep->name);
602 } /* hci_remote_name_request */
604 /* Send Read_Remote_Supported_Features command to the unit */
606 hci_read_remote_supported_features(int s, int argc, char **argv)
610 ng_hci_read_remote_features_cp cp;
611 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
614 /* parse command parameters */
617 /* connecton handle */
618 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
621 cp.con_handle = (n & 0x0fff);
622 cp.con_handle = htole16(cp.con_handle);
629 /* send request and expect status response */
631 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
632 NG_HCI_OCF_READ_REMOTE_FEATURES),
633 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
642 if (hci_recv(s, b, &n) == ERROR)
645 if (n < sizeof(*e)) {
650 if (e->event == NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL) {
651 ng_hci_read_remote_features_compl_ep *ep =
652 (ng_hci_read_remote_features_compl_ep *)(e + 1);
654 if (ep->status != 0x00) {
655 fprintf(stdout, "Status: %s [%#02x]\n",
656 hci_status2str(ep->status), ep->status);
660 fprintf(stdout, "Connection handle: %d\n",
661 le16toh(ep->con_handle));
662 fprintf(stdout, "Features: ");
663 for (n = 0; n < sizeof(ep->features); n++)
664 fprintf(stdout, "%#02x ", ep->features[n]);
665 fprintf(stdout, "\n%s\n", hci_features2str(ep->features,
666 buffer, sizeof(buffer)));
671 } /* hci_read_remote_supported_features */
673 /* Send Read_Remote_Version_Information command to the unit */
675 hci_read_remote_version_information(int s, int argc, char **argv)
679 ng_hci_read_remote_ver_info_cp cp;
680 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
682 /* parse command parameters */
685 /* connecton handle */
686 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
689 cp.con_handle = (n & 0x0fff);
690 cp.con_handle = htole16(cp.con_handle);
697 /* send request and expect status response */
699 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
700 NG_HCI_OCF_READ_REMOTE_VER_INFO),
701 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
710 if (hci_recv(s, b, &n) == ERROR)
713 if (n < sizeof(*e)) {
718 if (e->event == NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL) {
719 ng_hci_read_remote_ver_info_compl_ep *ep =
720 (ng_hci_read_remote_ver_info_compl_ep *)(e + 1);
722 if (ep->status != 0x00) {
723 fprintf(stdout, "Status: %s [%#02x]\n",
724 hci_status2str(ep->status), ep->status);
728 ep->manufacturer = le16toh(ep->manufacturer);
730 fprintf(stdout, "Connection handle: %d\n",
731 le16toh(ep->con_handle));
732 fprintf(stdout, "LMP version: %s [%#02x]\n",
733 hci_lmpver2str(ep->lmp_version), ep->lmp_version);
734 fprintf(stdout, "LMP sub-version: %#04x\n",
735 le16toh(ep->lmp_subversion));
736 fprintf(stdout, "Manufacturer: %s [%#04x]\n",
737 hci_manufacturer2str(ep->manufacturer),
743 } /* hci_read_remote_version_information */
745 /* Send Read_Clock_Offset command to the unit */
747 hci_read_clock_offset(int s, int argc, char **argv)
751 ng_hci_read_clock_offset_cp cp;
752 ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b;
754 /* parse command parameters */
757 /* connecton handle */
758 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0x0eff)
761 cp.con_handle = (n & 0x0fff);
762 cp.con_handle = htole16(cp.con_handle);
769 /* send request and expect status response */
771 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,
772 NG_HCI_OCF_READ_CLOCK_OFFSET),
773 (char const *) &cp, sizeof(cp), b, &n) == ERROR)
782 if (hci_recv(s, b, &n) == ERROR)
785 if (n < sizeof(*e)) {
790 if (e->event == NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL) {
791 ng_hci_read_clock_offset_compl_ep *ep =
792 (ng_hci_read_clock_offset_compl_ep *)(e + 1);
794 if (ep->status != 0x00) {
795 fprintf(stdout, "Status: %s [%#02x]\n",
796 hci_status2str(ep->status), ep->status);
800 fprintf(stdout, "Connection handle: %d\n",
801 le16toh(ep->con_handle));
802 fprintf(stdout, "Clock offset: %#04x\n",
803 le16toh(ep->clock_offset));
808 } /* hci_read_clock_offset */
810 struct hci_command link_control_commands[] = {
812 "inquiry <LAP> <inquiry_length> <num_reponses>",
813 "\nThis command will cause the Bluetooth unit to enter Inquiry Mode.\n" \
814 "Inquiry Mode is used to discover other nearby Bluetooth units. The LAP\n" \
815 "input parameter contains the LAP from which the inquiry access code shall\n" \
816 "be derived when the inquiry procedure is made. The Inquiry_Length parameter\n"\
817 "specifies the total duration of the Inquiry Mode and, when this time\n" \
818 "expires, Inquiry will be halted. The Num_Responses parameter specifies the\n" \
819 "number of responses that can be received before the Inquiry is halted.\n\n" \
820 "\t<LAP> - xx:xx:xx; 9e:8b:33 (GIAC), 93:8b:00 (LDIAC)\n" \
821 "\t<inquiry_length> - dd; total length == dd * 1.28 sec\n" \
822 "\t<num_responses> - dd",
826 "create_connection <BD_ADDR> <pkt> <rep_mode> <ps_mode> <clck_off> <role_sw>",
828 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name\n\n" \
829 "\t<pkt> - xxxx; packet type\n" \
831 "\t\tACL packets\n" \
832 "\t\t-----------\n" \
838 "\t\t0x8000 DH5\n\n" \
840 "\trep_mode - d; page scan repetition mode\n" \
842 "\t\tPage scan repetition modes\n" \
843 "\t\t--------------------------\n" \
844 "\t\t0 Page scan repetition mode 0\n" \
845 "\t\t1 Page scan repetition mode 1\n" \
846 "\t\t2 Page scan repetition mode 2\n" \
848 "\tps_mode - d; Page scan mode\n" \
850 "\t\tPage scan modes\n" \
851 "\t\t---------------\n" \
852 "\t\t0 Mandatory page scan mode\n" \
853 "\t\t1 Optional page scan mode1\n" \
854 "\t\t2 Optional page scan mode2\n" \
855 "\t\t3 Optional page scan mode3\n" \
857 "\tclck_off - dddd; clock offset. Use 0 if unknown\n\n" \
858 "\trole_sw - d; allow (1) or deny role switch\n",
859 &hci_create_connection
862 "disconnect <connection_handle> <reason>",
863 "\nThe Disconnection command is used to terminate an existing connection.\n" \
864 "The connection handle command parameter indicates which connection is to\n" \
865 "be disconnected. The Reason command parameter indicates the reason for\n" \
866 "ending the connection.\n\n" \
867 "\t<connection_handle> - dddd; connection handle\n" \
868 "\t<reason> - dd; reason; usually 19 (0x13) - user ended;\n" \
869 "\t also 0x05, 0x13-0x15, 0x1A, 0x29",
873 "add_sco_connection <acl connection handle> <packet type>",
874 "This command will cause the link manager to create a SCO connection using\n" \
875 "the ACL connection specified by the connection handle command parameter.\n" \
876 "The Link Manager will determine how the new connection is established. This\n"\
877 "connection is determined by the current state of the device, its piconet,\n" \
878 "and the state of the device to be connected. The packet type command parameter\n" \
879 "specifies which packet types the Link Manager should use for the connection.\n"\
880 "The Link Manager must only use the packet type(s) specified by the packet\n" \
881 "type command parameter for sending HCI SCO data packets. Multiple packet\n" \
882 "types may be specified for the packet type command parameter by performing\n" \
883 "a bitwise OR operation of the different packet types. Note: An SCO connection\n" \
884 "can only be created when an ACL connection already exists and when it is\n" \
885 "not put in park mode.\n\n" \
886 "\t<connection_handle> - dddd; ACL connection handle\n" \
887 "\t<packet_type> - xxxx; packet type\n" \
889 "\t\tSCO packets\n" \
890 "\t\t-----------\n" \
894 &hci_add_sco_connection
897 "change_connection_packet_type <connection_hande> <packet_type>",
898 "The Change_Connection_Packet_Type command is used to change which packet\n" \
899 "types can be used for a connection that is currently established. This\n" \
900 "allows current connections to be dynamically modified to support different\n" \
901 "types of user data. The Packet_Type command parameter specifies which\n" \
902 "packet types the Link Manager can use for the connection. Multiple packet\n" \
903 "types may be specified for the Packet_Type command parameter by bitwise OR\n" \
904 "operation of the different packet types.\n\n" \
905 "\t<connection_handle> - dddd; connection handle\n" \
906 "\t<packet_type> - xxxx; packet type mask\n" \
908 "\t\tACL packets\n" \
909 "\t\t-----------\n" \
915 "\t\t0x8000 DH5\n\n" \
917 "\t\tSCO packets\n" \
918 "\t\t-----------\n" \
923 &hci_change_connection_packet_type
926 "remote_name_request <BD_ADDR> <ps_rep_mode> <ps_mode> <clock_offset>",
927 "\nThe Remote_Name_Request command is used to obtain the user-friendly\n" \
928 "name of another Bluetooth unit.\n\n" \
929 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name\n" \
930 "\t<ps_rep_mode> - dd; page scan repetition mode [0-2]\n" \
931 "\t<ps_mode> - dd; page scan mode [0-3]\n" \
932 "\t<clock_offset> - xxxx; clock offset [0 - 0xffff]",
933 &hci_remote_name_request
936 "read_remote_supported_features <connection_handle>",
937 "\nThis command requests a list of the supported features for the remote\n" \
938 "unit identified by the connection handle parameter. The connection handle\n" \
939 "must be a connection handle for an ACL connection.\n\n" \
940 "\t<connection_handle> - dddd; connection handle",
941 &hci_read_remote_supported_features
944 "read_remote_version_information <connection_handle>",
945 "\nThis command will obtain the values for the version information for the\n" \
946 "remote Bluetooth unit identified by the connection handle parameter. The\n" \
947 "connection handle must be a connection handle for an ACL connection.\n\n" \
948 "\t<connection_handle> - dddd; connection handle",
949 &hci_read_remote_version_information
952 "read_clock_offset <connection_handle>",
953 "\nThis command allows the Host to read the clock offset from the remote unit.\n" \
954 "\t<connection_handle> - dddd; connection handle",
955 &hci_read_clock_offset