2 * host_controller_baseband.c
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: host_controller_baseband.c,v 1.4 2003/08/18 19:19:53 max Exp $
32 #define L2CAP_SOCKET_CHECKED
33 #include <bluetooth.h>
37 #include "hccontrol.h"
39 /* Convert hex ASCII to int4 */
41 hci_hexa2int4(const char *a)
43 if ('0' <= *a && *a <= '9')
46 if ('A' <= *a && *a <= 'F')
47 return (*a - 'A' + 0xa);
49 if ('a' <= *a && *a <= 'f')
50 return (*a - 'a' + 0xa);
55 /* Convert hex ASCII to int8 */
57 hci_hexa2int8(const char *a)
59 int hi = hci_hexa2int4(a);
60 int lo = hci_hexa2int4(a + 1);
65 return ((hi << 4) | lo);
68 /* Convert ascii hex string to the uint8_t[] */
70 hci_hexstring2array(char const *s, uint8_t *a, int asize)
78 for (i = 0; i < l; i++) {
79 b = hci_hexa2int8(s + i * 2);
89 /* Send RESET to the unit */
91 hci_reset(int s, int argc, char **argv)
97 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
98 NG_HCI_OCF_RESET), (char *) &rp, &n) == ERROR)
101 if (rp.status != 0x00) {
102 fprintf(stdout, "Status: %s [%#02x]\n",
103 hci_status2str(rp.status), rp.status);
110 /* Send Read_PIN_Type command to the unit */
112 hci_read_pin_type(int s, int argc, char **argv)
114 ng_hci_read_pin_type_rp rp;
118 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
119 NG_HCI_OCF_READ_PIN_TYPE),
120 (char *) &rp, &n) == ERROR)
123 if (rp.status != 0x00) {
124 fprintf(stdout, "Status: %s [%#02x]\n",
125 hci_status2str(rp.status), rp.status);
129 fprintf(stdout, "PIN type: %s [%#02x]\n",
130 hci_pin2str(rp.pin_type), rp.pin_type);
133 } /* hci_read_pin_type */
135 /* Send Write_PIN_Type command to the unit */
137 hci_write_pin_type(int s, int argc, char **argv)
139 ng_hci_write_pin_type_cp cp;
140 ng_hci_write_pin_type_rp rp;
143 /* parse command parameters */
146 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 1)
149 cp.pin_type = (uint8_t) n;
158 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
159 NG_HCI_OCF_WRITE_PIN_TYPE),
160 (char const *) &cp, sizeof(cp),
161 (char *) &rp , &n) == ERROR)
164 if (rp.status != 0x00) {
165 fprintf(stdout, "Status: %s [%#02x]\n",
166 hci_status2str(rp.status), rp.status);
171 } /* hci_write_pin_type */
173 /* Send Read_Stored_Link_Key command to the unit */
175 hci_read_stored_link_key(int s, int argc, char **argv)
178 ng_hci_cmd_pkt_t hdr;
179 ng_hci_read_stored_link_key_cp cp;
180 } __attribute__ ((packed)) cmd;
183 ng_hci_event_pkt_t hdr;
185 ng_hci_command_compl_ep cc;
186 ng_hci_return_link_keys_ep key;
187 uint8_t b[NG_HCI_EVENT_PKT_SIZE];
189 } __attribute__ ((packed)) event;
194 memset(&cmd, 0, sizeof(cmd));
195 cmd.hdr.type = NG_HCI_CMD_PKT;
196 cmd.hdr.opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
197 NG_HCI_OCF_READ_STORED_LINK_KEY));
198 cmd.hdr.length = sizeof(cmd.cp);
203 if (!bt_aton(argv[0], &cmd.cp.bdaddr)) {
204 struct hostent *he = NULL;
206 if ((he = bt_gethostbyname(argv[0])) == NULL)
209 memcpy(&cmd.cp.bdaddr, he->h_addr, sizeof(cmd.cp.bdaddr));
218 if (hci_send(s, (char const *) &cmd, sizeof(cmd)) != OK)
223 memset(&event, 0, sizeof(event));
225 if (hci_recv(s, (char *) &event, &n) != OK)
228 if (n <= sizeof(event.hdr)) {
233 if (event.hdr.type != NG_HCI_EVENT_PKT) {
239 switch (event.hdr.event) {
240 case NG_HCI_EVENT_COMMAND_COMPL: {
241 ng_hci_read_stored_link_key_rp *rp = NULL;
243 if (event.ep.cc.opcode == 0x0000 ||
244 event.ep.cc.opcode != cmd.hdr.opcode)
247 rp = (ng_hci_read_stored_link_key_rp *)(event.ep.b +
248 sizeof(event.ep.cc));
250 fprintf(stdout, "Complete: Status: %s [%#x]\n",
251 hci_status2str(rp->status), rp->status);
252 fprintf(stdout, "Maximum Number of keys: %d\n",
253 le16toh(rp->max_num_keys));
254 fprintf(stdout, "Number of keys read: %d\n",
255 le16toh(rp->num_keys_read));
258 case NG_HCI_EVENT_RETURN_LINK_KEYS: {
261 uint8_t key[NG_HCI_KEY_SIZE];
262 } __attribute__ ((packed)) *k = NULL;
264 fprintf(stdout, "Event: Number of keys: %d\n",
265 event.ep.key.num_keys);
267 k = (struct _key *)(event.ep.b + sizeof(event.ep.key));
268 for (n = 0; n < event.ep.key.num_keys; n++) {
269 fprintf(stdout, "\t%d: %s ",
270 n + 1, hci_bdaddr2str(&k->bdaddr));
272 for (n1 = 0; n1 < sizeof(k->key); n1++)
273 fprintf(stdout, "%02x", k->key[n1]);
274 fprintf(stdout, "\n");
288 } /* hci_read_store_link_key */
290 /* Send Write_Stored_Link_Key command to the unit */
292 hci_write_stored_link_key(int s, int argc, char **argv)
295 ng_hci_write_stored_link_key_cp p;
297 uint8_t key[NG_HCI_KEY_SIZE];
299 ng_hci_write_stored_link_key_rp rp;
302 memset(&cp, 0, sizeof(cp));
306 cp.p.num_keys_write = 1;
309 if (!bt_aton(argv[0], &cp.bdaddr)) {
310 struct hostent *he = NULL;
312 if ((he = bt_gethostbyname(argv[0])) == NULL)
315 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
319 if (hci_hexstring2array(argv[1], cp.key, sizeof(cp.key)) < 0)
329 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
330 NG_HCI_OCF_WRITE_STORED_LINK_KEY),
331 (char const *) &cp, sizeof(cp),
332 (char *) &rp, &n) == ERROR)
335 if (rp.status != 0x00) {
336 fprintf(stdout, "Status: %s [%#02x]\n",
337 hci_status2str(rp.status), rp.status);
341 fprintf(stdout, "Number of keys written: %d\n", rp.num_keys_written);
344 } /* hci_write_stored_link_key */
347 /* Send Delete_Stored_Link_Key command to the unit */
349 hci_delete_stored_link_key(int s, int argc, char **argv)
351 ng_hci_delete_stored_link_key_cp cp;
352 ng_hci_delete_stored_link_key_rp rp;
355 memset(&cp, 0, sizeof(cp));
360 if (!bt_aton(argv[0], &cp.bdaddr)) {
361 struct hostent *he = NULL;
363 if ((he = bt_gethostbyname(argv[0])) == NULL)
366 memcpy(&cp.bdaddr, he->h_addr, sizeof(cp.bdaddr));
377 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
378 NG_HCI_OCF_DELETE_STORED_LINK_KEY),
379 (char const *) &cp, sizeof(cp),
380 (char *) &rp, &n) == ERROR)
383 if (rp.status != 0x00) {
384 fprintf(stdout, "Status: %s [%#02x]\n",
385 hci_status2str(rp.status), rp.status);
389 fprintf(stdout, "Number of keys deleted: %d\n", rp.num_keys_deleted);
392 } /* hci_delete_stored_link_key */
394 /* Send Change_Local_Name command to the unit */
396 hci_change_local_name(int s, int argc, char **argv)
398 ng_hci_change_local_name_cp cp;
399 ng_hci_change_local_name_rp rp;
402 /* parse command parameters */
405 snprintf(cp.name, sizeof(cp.name), "%s", argv[0]);
414 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
415 NG_HCI_OCF_CHANGE_LOCAL_NAME),
416 (char const *) &cp, sizeof(cp),
417 (char *) &rp, &n) == ERROR)
420 if (rp.status != 0x00) {
421 fprintf(stdout, "Status: %s [%#02x]\n",
422 hci_status2str(rp.status), rp.status);
427 } /* hci_change_local_name */
429 /* Send Read_Local_Name command to the unit */
431 hci_read_local_name(int s, int argc, char **argv)
433 ng_hci_read_local_name_rp rp;
437 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
438 NG_HCI_OCF_READ_LOCAL_NAME),
439 (char *) &rp, &n) == ERROR)
442 if (rp.status != 0x00) {
443 fprintf(stdout, "Status: %s [%#02x]\n",
444 hci_status2str(rp.status), rp.status);
448 fprintf(stdout, "Local name: %s\n", rp.name);
451 } /* hci_read_local_name */
453 /* Send Read_Connection_Accept_Timeout to the unit */
455 hci_read_connection_accept_timeout(int s, int argc, char **argv)
457 ng_hci_read_con_accept_timo_rp rp;
461 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
462 NG_HCI_OCF_READ_CON_ACCEPT_TIMO),
463 (char *) &rp, &n) == ERROR)
466 if (rp.status != 0x00) {
467 fprintf(stdout, "Status: %s [%#02x]\n",
468 hci_status2str(rp.status), rp.status);
472 rp.timeout = le16toh(rp.timeout);
473 fprintf(stdout, "Connection accept timeout: %.2f msec [%d slots]\n",
474 rp.timeout * 0.625, rp.timeout);
477 } /* hci_read_connection_accept_timeout */
479 /* Send Write_Connection_Accept_Timeout to the unit */
481 hci_write_connection_accept_timeout(int s, int argc, char **argv)
483 ng_hci_write_con_accept_timo_cp cp;
484 ng_hci_write_con_accept_timo_rp rp;
487 /* parse command parameters */
490 if (sscanf(argv[0], "%d", &n) != 1 || n < 1 || n > 0xb540)
493 cp.timeout = (uint16_t) n;
494 cp.timeout = htole16(cp.timeout);
503 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
504 NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO),
505 (char const *) &cp, sizeof(cp),
506 (char *) &rp, &n) == ERROR)
509 if (rp.status != 0x00) {
510 fprintf(stdout, "Status: %s [%#02x]\n",
511 hci_status2str(rp.status), rp.status);
516 } /* hci_write_connection_accept_timeout */
518 /* Send Read_Page_Timeout command to the unit */
520 hci_read_page_timeout(int s, int argc, char **argv)
522 ng_hci_read_page_timo_rp rp;
526 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
527 NG_HCI_OCF_READ_PAGE_TIMO),
528 (char *) &rp, &n) == ERROR)
531 if (rp.status != 0x00) {
532 fprintf(stdout, "Status: %s [%#02x]\n",
533 hci_status2str(rp.status), rp.status);
537 rp.timeout = le16toh(rp.timeout);
538 fprintf(stdout, "Page timeout: %.2f msec [%d slots]\n",
539 rp.timeout * 0.625, rp.timeout);
542 } /* hci_read_page_timeoout */
544 /* Send Write_Page_Timeout command to the unit */
546 hci_write_page_timeout(int s, int argc, char **argv)
548 ng_hci_write_page_timo_cp cp;
549 ng_hci_write_page_timo_rp rp;
552 /* parse command parameters */
555 if (sscanf(argv[0], "%d", &n) != 1 || n < 1 || n > 0xffff)
558 cp.timeout = (uint16_t) n;
559 cp.timeout = htole16(cp.timeout);
568 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
569 NG_HCI_OCF_WRITE_PAGE_TIMO),
570 (char const *) &cp, sizeof(cp),
571 (char *) &rp, &n) == ERROR)
574 if (rp.status != 0x00) {
575 fprintf(stdout, "Status: %s [%#02x]\n",
576 hci_status2str(rp.status), rp.status);
581 } /* hci_write_page_timeout */
583 /* Send Read_Scan_Enable command to the unit */
585 hci_read_scan_enable(int s, int argc, char **argv)
587 ng_hci_read_scan_enable_rp rp;
591 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
592 NG_HCI_OCF_READ_SCAN_ENABLE),
593 (char *) &rp, &n) == ERROR)
596 if (rp.status != 0x00) {
597 fprintf(stdout, "Status: %s [%#02x]\n",
598 hci_status2str(rp.status), rp.status);
602 fprintf(stdout, "Scan enable: %s [%#02x]\n",
603 hci_scan2str(rp.scan_enable), rp.scan_enable);
606 } /* hci_read_scan_enable */
608 /* Send Write_Scan_Enable command to the unit */
610 hci_write_scan_enable(int s, int argc, char **argv)
612 ng_hci_write_scan_enable_cp cp;
613 ng_hci_write_scan_enable_rp rp;
616 /* parse command parameters */
619 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 3)
622 cp.scan_enable = (uint8_t) n;
630 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
631 NG_HCI_OCF_WRITE_SCAN_ENABLE),
632 (char const *) &cp, sizeof(cp),
633 (char *) &rp, &n) == ERROR)
636 if (rp.status != 0x00) {
637 fprintf(stdout, "Status: %s [%#02x]\n",
638 hci_status2str(rp.status), rp.status);
643 } /* hci_write_scan_enable */
645 /* Send Read_Page_Scan_Activity command to the unit */
647 hci_read_page_scan_activity(int s, int argc, char **argv)
649 ng_hci_read_page_scan_activity_rp rp;
653 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
654 NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY),
655 (char *) &rp, &n) == ERROR)
658 if (rp.status != 0x00) {
659 fprintf(stdout, "Status: %s [%#02x]\n",
660 hci_status2str(rp.status), rp.status);
664 rp.page_scan_interval = le16toh(rp.page_scan_interval);
665 rp.page_scan_window = le16toh(rp.page_scan_window);
667 fprintf(stdout, "Page Scan Interval: %.2f msec [%d slots]\n",
668 rp.page_scan_interval * 0.625, rp.page_scan_interval);
669 fprintf(stdout, "Page Scan Window: %.2f msec [%d slots]\n",
670 rp.page_scan_window * 0.625, rp.page_scan_window);
673 } /* hci_read_page_scan_activity */
675 /* Send Write_Page_Scan_Activity command to the unit */
677 hci_write_page_scan_activity(int s, int argc, char **argv)
679 ng_hci_write_page_scan_activity_cp cp;
680 ng_hci_write_page_scan_activity_rp rp;
683 /* parse command parameters */
686 /* page scan interval */
687 if (sscanf(argv[0], "%d", &n) != 1 || n < 0x12 || n > 0x1000)
690 cp.page_scan_interval = (uint16_t) n;
692 /* page scan window */
693 if (sscanf(argv[1], "%d", &n) != 1 || n < 0x12 || n > 0x1000)
696 cp.page_scan_window = (uint16_t) n;
698 if (cp.page_scan_window > cp.page_scan_interval)
701 cp.page_scan_interval = htole16(cp.page_scan_interval);
702 cp.page_scan_window = htole16(cp.page_scan_window);
711 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
712 NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY),
713 (char const *) &cp, sizeof(cp),
714 (char *) &rp, &n) == ERROR)
717 if (rp.status != 0x00) {
718 fprintf(stdout, "Status: %s [%#02x]\n",
719 hci_status2str(rp.status), rp.status);
724 } /* hci_write_page_scan_activity */
726 /* Send Read_Inquiry_Scan_Activity command to the unit */
728 hci_read_inquiry_scan_activity(int s, int argc, char **argv)
730 ng_hci_read_inquiry_scan_activity_rp rp;
734 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
735 NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY),
736 (char *) &rp, &n) == ERROR)
739 if (rp.status != 0x00) {
740 fprintf(stdout, "Status: %s [%#02x]\n",
741 hci_status2str(rp.status), rp.status);
745 rp.inquiry_scan_interval = le16toh(rp.inquiry_scan_interval);
746 rp.inquiry_scan_window = le16toh(rp.inquiry_scan_window);
748 fprintf(stdout, "Inquiry Scan Interval: %.2f msec [%d slots]\n",
749 rp.inquiry_scan_interval * 0.625, rp.inquiry_scan_interval);
750 fprintf(stdout, "Inquiry Scan Window: %.2f msec [%d slots]\n",
751 rp.inquiry_scan_window * 0.625, rp.inquiry_scan_interval);
754 } /* hci_read_inquiry_scan_activity */
756 /* Send Write_Inquiry_Scan_Activity command to the unit */
758 hci_write_inquiry_scan_activity(int s, int argc, char **argv)
760 ng_hci_write_inquiry_scan_activity_cp cp;
761 ng_hci_write_inquiry_scan_activity_rp rp;
764 /* parse command parameters */
767 /* inquiry scan interval */
768 if (sscanf(argv[0], "%d", &n) != 1 || n < 0x12 || n > 0x1000)
771 cp.inquiry_scan_interval = (uint16_t) n;
773 /* inquiry scan window */
774 if (sscanf(argv[1], "%d", &n) != 1 || n < 0x12 || n > 0x1000)
777 cp.inquiry_scan_window = (uint16_t) n;
779 if (cp.inquiry_scan_window > cp.inquiry_scan_interval)
782 cp.inquiry_scan_interval =
783 htole16(cp.inquiry_scan_interval);
784 cp.inquiry_scan_window = htole16(cp.inquiry_scan_window);
793 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
794 NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY),
795 (char const *) &cp, sizeof(cp),
796 (char *) &rp, &n) == ERROR)
799 if (rp.status != 0x00) {
800 fprintf(stdout, "Status: %s [%#02x]\n",
801 hci_status2str(rp.status), rp.status);
806 } /* hci_write_inquiry_scan_activity */
808 /* Send Read_Authentication_Enable command to the unit */
810 hci_read_authentication_enable(int s, int argc, char **argv)
812 ng_hci_read_auth_enable_rp rp;
816 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
817 NG_HCI_OCF_READ_AUTH_ENABLE),
818 (char *) &rp, &n) == ERROR)
821 if (rp.status != 0x00) {
822 fprintf(stdout, "Status: %s [%#02x]\n",
823 hci_status2str(rp.status), rp.status);
827 fprintf(stdout, "Authentication Enable: %s [%d]\n",
828 rp.auth_enable? "Enabled" : "Disabled", rp.auth_enable);
831 } /* hci_read_authentication_enable */
833 /* Send Write_Authentication_Enable command to the unit */
835 hci_write_authentication_enable(int s, int argc, char **argv)
837 ng_hci_write_auth_enable_cp cp;
838 ng_hci_write_auth_enable_rp rp;
841 /* parse command parameters */
844 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 1)
847 cp.auth_enable = (uint8_t) n;
856 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
857 NG_HCI_OCF_WRITE_AUTH_ENABLE),
858 (char const *) &cp, sizeof(cp),
859 (char *) &rp, &n) == ERROR)
862 if (rp.status != 0x00) {
863 fprintf(stdout, "Status: %s [%#02x]\n",
864 hci_status2str(rp.status), rp.status);
869 } /* hci_write_authentication_enable */
871 /* Send Read_Encryption_Mode command to the unit */
873 hci_read_encryption_mode(int s, int argc, char **argv)
875 ng_hci_read_encryption_mode_rp rp;
879 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
880 NG_HCI_OCF_READ_ENCRYPTION_MODE),
881 (char *) &rp, &n) == ERROR)
884 if (rp.status != 0x00) {
885 fprintf(stdout, "Status: %s [%#02x]\n",
886 hci_status2str(rp.status), rp.status);
890 fprintf(stdout, "Encryption mode: %s [%#02x]\n",
891 hci_encrypt2str(rp.encryption_mode, 0), rp.encryption_mode);
894 } /* hci_read_encryption_mode */
896 /* Send Write_Encryption_Mode command to the unit */
898 hci_write_encryption_mode(int s, int argc, char **argv)
900 ng_hci_write_encryption_mode_cp cp;
901 ng_hci_write_encryption_mode_rp rp;
904 /* parse command parameters */
907 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 2)
910 cp.encryption_mode = (uint8_t) n;
919 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
920 NG_HCI_OCF_WRITE_ENCRYPTION_MODE),
921 (char const *) &cp, sizeof(cp),
922 (char *) &rp, &n) == ERROR)
925 if (rp.status != 0x00) {
926 fprintf(stdout, "Status: %s [%#02x]\n",
927 hci_status2str(rp.status), rp.status);
932 } /* hci_write_encryption_mode */
934 /* Send Read_Class_Of_Device command to the unit */
936 hci_read_class_of_device(int s, int argc, char **argv)
938 ng_hci_read_unit_class_rp rp;
942 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
943 NG_HCI_OCF_READ_UNIT_CLASS),
944 (char *) &rp, &n) == ERROR)
947 if (rp.status != 0x00) {
948 fprintf(stdout, "Status: %s [%#02x]\n",
949 hci_status2str(rp.status), rp.status);
953 fprintf(stdout, "Class: %02x:%02x:%02x\n",
954 rp.uclass[2], rp.uclass[1], rp.uclass[0]);
957 } /* hci_read_class_of_device */
959 /* Send Write_Class_Of_Device command to the unit */
961 hci_write_class_of_device(int s, int argc, char **argv)
963 ng_hci_write_unit_class_cp cp;
964 ng_hci_write_unit_class_rp rp;
967 /* parse command parameters */
970 if (sscanf(argv[0], "%x:%x:%x", &n2, &n1, &n0) != 3)
973 cp.uclass[0] = (n0 & 0xff);
974 cp.uclass[1] = (n1 & 0xff);
975 cp.uclass[2] = (n2 & 0xff);
984 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
985 NG_HCI_OCF_WRITE_UNIT_CLASS),
986 (char const *) &cp, sizeof(cp),
987 (char *) &rp, &n0) == ERROR)
990 if (rp.status != 0x00) {
991 fprintf(stdout, "Status: %s [%#02x]\n",
992 hci_status2str(rp.status), rp.status);
997 } /* hci_write_class_of_device */
999 /* Send Read_Voice_Settings command to the unit */
1001 hci_read_voice_settings(int s, int argc, char **argv)
1003 ng_hci_read_voice_settings_rp rp;
1010 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1011 NG_HCI_OCF_READ_VOICE_SETTINGS),
1012 (char *) &rp, &n) == ERROR)
1015 if (rp.status != 0x00) {
1016 fprintf(stdout, "Status: %s [%#02x]\n",
1017 hci_status2str(rp.status), rp.status);
1021 rp.settings = le16toh(rp.settings);
1023 input_coding = (rp.settings & 0x0300) >> 8;
1024 input_data_format = (rp.settings & 0x00c0) >> 6;
1025 input_sample_size = (rp.settings & 0x0020) >> 5;
1027 fprintf(stdout, "Voice settings: %#04x\n", rp.settings);
1028 fprintf(stdout, "Input coding: %s [%d]\n",
1029 hci_coding2str(input_coding), input_coding);
1030 fprintf(stdout, "Input data format: %s [%d]\n",
1031 hci_vdata2str(input_data_format), input_data_format);
1033 if (input_coding == 0x00) /* Only for Linear PCM */
1034 fprintf(stdout, "Input sample size: %d bit [%d]\n",
1035 input_sample_size? 16 : 8, input_sample_size);
1038 } /* hci_read_voice_settings */
1040 /* Send Write_Voice_Settings command to the unit */
1042 hci_write_voice_settings(int s, int argc, char **argv)
1044 ng_hci_write_voice_settings_cp cp;
1045 ng_hci_write_voice_settings_rp rp;
1048 /* parse command parameters */
1051 if (sscanf(argv[0], "%x", &n) != 1)
1054 cp.settings = (uint16_t) n;
1055 cp.settings = htole16(cp.settings);
1064 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1065 NG_HCI_OCF_WRITE_VOICE_SETTINGS),
1066 (char const *) &cp, sizeof(cp),
1067 (char *) &rp, &n) == ERROR)
1070 if (rp.status != 0x00) {
1071 fprintf(stdout, "Status: %s [%#02x]\n",
1072 hci_status2str(rp.status), rp.status);
1077 } /* hci_write_voice_settings */
1079 /* Send Read_Number_Broadcast_Restransmissions */
1081 hci_read_number_broadcast_retransmissions(int s, int argc, char **argv)
1083 ng_hci_read_num_broadcast_retrans_rp rp;
1087 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1088 NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS),
1089 (char *) &rp, &n) == ERROR)
1092 if (rp.status != 0x00) {
1093 fprintf(stdout, "Status: %s [%#02x]\n",
1094 hci_status2str(rp.status), rp.status);
1098 fprintf(stdout, "Number of broadcast retransmissions: %d\n",
1102 } /* hci_read_number_broadcast_retransmissions */
1104 /* Send Write_Number_Broadcast_Restransmissions */
1106 hci_write_number_broadcast_retransmissions(int s, int argc, char **argv)
1108 ng_hci_write_num_broadcast_retrans_cp cp;
1109 ng_hci_write_num_broadcast_retrans_rp rp;
1112 /* parse command parameters */
1115 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 0xff)
1118 cp.counter = (uint8_t) n;
1127 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1128 NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS),
1129 (char const *) &cp, sizeof(cp),
1130 (char *) &rp, &n) == ERROR)
1133 if (rp.status != 0x00) {
1134 fprintf(stdout, "Status: %s [%#02x]\n",
1135 hci_status2str(rp.status), rp.status);
1140 } /* hci_write_number_broadcast_retransmissions */
1142 /* Send Read_Hold_Mode_Activity command to the unit */
1144 hci_read_hold_mode_activity(int s, int argc, char **argv)
1146 ng_hci_read_hold_mode_activity_rp rp;
1151 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1152 NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY),
1153 (char *) &rp, &n) == ERROR)
1156 if (rp.status != 0x00) {
1157 fprintf(stdout, "Status: %s [%#02x]\n",
1158 hci_status2str(rp.status), rp.status);
1162 fprintf(stdout, "Hold Mode Activities: %#02x\n", rp.hold_mode_activity);
1163 if (rp.hold_mode_activity == 0)
1164 fprintf(stdout, "Maintain current Power State");
1166 fprintf(stdout, "%s", hci_hmode2str(rp.hold_mode_activity,
1167 buffer, sizeof(buffer)));
1169 fprintf(stdout, "\n");
1172 } /* hci_read_hold_mode_activity */
1174 /* Send Write_Hold_Mode_Activity command to the unit */
1176 hci_write_hold_mode_activity(int s, int argc, char **argv)
1178 ng_hci_write_hold_mode_activity_cp cp;
1179 ng_hci_write_hold_mode_activity_rp rp;
1182 /* parse command parameters */
1185 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 4)
1188 cp.hold_mode_activity = (uint8_t) n;
1197 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1198 NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY),
1199 (char const *) &cp, sizeof(cp),
1200 (char *) &rp, &n) == ERROR)
1203 if (rp.status != 0x00) {
1204 fprintf(stdout, "Status: %s [%#02x]\n",
1205 hci_status2str(rp.status), rp.status);
1210 } /* hci_write_hold_mode_activity */
1212 /* Send Read_SCO_Flow_Control_Enable command to the unit */
1214 hci_read_sco_flow_control_enable(int s, int argc, char **argv)
1216 ng_hci_read_sco_flow_control_rp rp;
1220 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1221 NG_HCI_OCF_READ_SCO_FLOW_CONTROL),
1222 (char *) &rp, &n) == ERROR)
1225 if (rp.status != 0x00) {
1226 fprintf(stdout, "Status: %s [%#02x]\n",
1227 hci_status2str(rp.status), rp.status);
1231 fprintf(stdout, "SCO flow control %s [%d]\n",
1232 rp.flow_control? "enabled" : "disabled", rp.flow_control);
1235 } /* hci_read_sco_flow_control_enable */
1237 /* Send Write_SCO_Flow_Control_Enable command to the unit */
1239 hci_write_sco_flow_control_enable(int s, int argc, char **argv)
1241 ng_hci_write_sco_flow_control_cp cp;
1242 ng_hci_write_sco_flow_control_rp rp;
1245 /* parse command parameters */
1248 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 1)
1251 cp.flow_control = (uint8_t) n;
1260 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1261 NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL),
1262 (char const *) &cp, sizeof(cp),
1263 (char *) &rp, &n) == ERROR)
1266 if (rp.status != 0x00) {
1267 fprintf(stdout, "Status: %s [%#02x]\n",
1268 hci_status2str(rp.status), rp.status);
1273 } /* hci_write_sco_flow_control_enable */
1275 /* Send Read_Link_Supervision_Timeout command to the unit */
1277 hci_read_link_supervision_timeout(int s, int argc, char **argv)
1279 ng_hci_read_link_supervision_timo_cp cp;
1280 ng_hci_read_link_supervision_timo_rp rp;
1285 /* connection handle */
1286 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
1289 cp.con_handle = (uint16_t) (n & 0x0fff);
1290 cp.con_handle = htole16(cp.con_handle);
1299 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1300 NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO),
1301 (char const *) &cp, sizeof(cp),
1302 (char *) &rp, &n) == ERROR)
1305 if (rp.status != 0x00) {
1306 fprintf(stdout, "Status: %s [%#02x]\n",
1307 hci_status2str(rp.status), rp.status);
1311 rp.timeout = le16toh(rp.timeout);
1313 fprintf(stdout, "Connection handle: %d\n", le16toh(rp.con_handle));
1314 fprintf(stdout, "Link supervision timeout: %.2f msec [%d slots]\n",
1315 rp.timeout * 0.625, rp.timeout);
1318 } /* hci_read_link_supervision_timeout */
1320 /* Send Write_Link_Supervision_Timeout command to the unit */
1322 hci_write_link_supervision_timeout(int s, int argc, char **argv)
1324 ng_hci_write_link_supervision_timo_cp cp;
1325 ng_hci_write_link_supervision_timo_rp rp;
1330 /* connection handle */
1331 if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff)
1334 cp.con_handle = (uint16_t) (n & 0x0fff);
1335 cp.con_handle = htole16(cp.con_handle);
1337 /* link supervision timeout */
1338 if (sscanf(argv[1], "%d", &n) != 1 || n < 0 || n > 0xffff)
1341 cp.timeout = (uint16_t) (n & 0x0fff);
1342 cp.timeout = htole16(cp.timeout);
1351 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1352 NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO),
1353 (char const *) &cp, sizeof(cp),
1354 (char *) &rp, &n) == ERROR)
1357 if (rp.status != 0x00) {
1358 fprintf(stdout, "Status: %s [%#02x]\n",
1359 hci_status2str(rp.status), rp.status);
1364 } /* hci_write_link_supervision_timeout */
1366 /* Send Read_Page_Scan_Period_Mode command to the unit */
1368 hci_read_page_scan_period_mode(int s, int argc, char **argv)
1370 ng_hci_read_page_scan_period_rp rp;
1374 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1375 NG_HCI_OCF_READ_PAGE_SCAN_PERIOD),
1376 (char *) &rp, &n) == ERROR)
1379 if (rp.status != 0x00) {
1380 fprintf(stdout, "Status: %s [%#02x]\n",
1381 hci_status2str(rp.status), rp.status);
1385 fprintf(stdout, "Page scan period mode: %#02x\n",
1386 rp.page_scan_period_mode);
1389 } /* hci_read_page_scan_period_mode */
1391 /* Send Write_Page_Scan_Period_Mode command to the unit */
1393 hci_write_page_scan_period_mode(int s, int argc, char **argv)
1395 ng_hci_write_page_scan_period_cp cp;
1396 ng_hci_write_page_scan_period_rp rp;
1399 /* parse command arguments */
1402 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 2)
1405 cp.page_scan_period_mode = (n & 0xff);
1414 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1415 NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD),
1416 (char const *) &cp, sizeof(cp),
1417 (char *) &rp, &n) == ERROR)
1420 if (rp.status != 0x00) {
1421 fprintf(stdout, "Status: %s [%#02x]\n",
1422 hci_status2str(rp.status), rp.status);
1427 } /* hci_write_page_scan_period_mode */
1429 /* Send Read_Page_Scan_Mode command to the unit */
1431 hci_read_page_scan_mode(int s, int argc, char **argv)
1433 ng_hci_read_page_scan_rp rp;
1437 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1438 NG_HCI_OCF_READ_PAGE_SCAN),
1439 (char *) &rp, &n) == ERROR)
1442 if (rp.status != 0x00) {
1443 fprintf(stdout, "Status: %s [%#02x]\n",
1444 hci_status2str(rp.status), rp.status);
1448 fprintf(stdout, "Page scan mode: %#02x\n", rp.page_scan_mode);
1451 } /* hci_read_page_scan_mode */
1453 /* Send Write_Page_Scan_Mode command to the unit */
1455 hci_write_page_scan_mode(int s, int argc, char **argv)
1457 ng_hci_write_page_scan_cp cp;
1458 ng_hci_write_page_scan_rp rp;
1461 /* parse command arguments */
1464 if (sscanf(argv[0], "%d", &n) != 1 || n < 0 || n > 3)
1467 cp.page_scan_mode = (n & 0xff);
1476 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1477 NG_HCI_OCF_WRITE_PAGE_SCAN),
1478 (char const *) &cp, sizeof(cp),
1479 (char *) &rp, &n) == ERROR)
1482 if (rp.status != 0x00) {
1483 fprintf(stdout, "Status: %s [%#02x]\n",
1484 hci_status2str(rp.status), rp.status);
1489 } /* hci_write_page_scan_mode */
1491 struct hci_command host_controller_baseband_commands[] = {
1494 "\nThe Reset command will reset the Host Controller and the Link Manager.\n" \
1495 "After the reset is completed, the current operational state will be lost,\n" \
1496 "the Bluetooth unit will enter standby mode and the Host Controller will\n" \
1497 "automatically revert to the default values for the parameters for which\n" \
1498 "default values are defined in the specification.",
1503 "\nThe Read_PIN_Type command is used for the Host to read whether the Link\n" \
1504 "Manager assumes that the Host supports variable PIN codes only a fixed PIN\n" \
1509 "write_pin_type <pin_type>",
1510 "\nThe Write_PIN_Type command is used for the Host to write to the Host\n" \
1511 "Controller whether the Host supports variable PIN codes or only a fixed PIN\n"\
1513 "\t<pin_type> - dd; 0 - Variable; 1 - Fixed",
1517 "read_stored_link_key [<BD_ADDR>]",
1518 "\nThe Read_Stored_Link_Key command provides the ability to read one or\n" \
1519 "more link keys stored in the Bluetooth Host Controller. The Bluetooth Host\n" \
1520 "Controller can store a limited number of link keys for other Bluetooth\n" \
1522 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name",
1523 &hci_read_stored_link_key
1526 "write_stored_link_key <BD_ADDR> <key>",
1527 "\nThe Write_Stored_Link_Key command provides the ability to write one\n" \
1528 "or more link keys to be stored in the Bluetooth Host Controller. The\n" \
1529 "Bluetooth Host Controller can store a limited number of link keys for other\n"\
1530 "Bluetooth devices. If no additional space is available in the Bluetooth\n"\
1531 "Host Controller then no additional link keys will be stored.\n\n" \
1532 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name\n" \
1533 "\t<key> - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx up to 16 bytes link key",
1534 &hci_write_stored_link_key
1537 "delete_stored_link_key [<BD_ADDR>]",
1538 "\nThe Delete_Stored_Link_Key command provides the ability to remove one\n" \
1539 "or more of the link keys stored in the Bluetooth Host Controller. The\n" \
1540 "Bluetooth Host Controller can store a limited number of link keys for other\n"\
1541 "Bluetooth devices.\n\n" \
1542 "\t<BD_ADDR> - xx:xx:xx:xx:xx:xx BD_ADDR or name",
1543 &hci_delete_stored_link_key
1546 "change_local_name <name>",
1547 "\nThe Change_Local_Name command provides the ability to modify the user\n" \
1548 "friendly name for the Bluetooth unit.\n\n" \
1549 "\t<name> - string",
1550 &hci_change_local_name
1554 "\nThe Read_Local_Name command provides the ability to read the\n" \
1555 "stored user-friendly name for the Bluetooth unit.",
1556 &hci_read_local_name
1559 "read_connection_accept_timeout",
1560 "\nThis command will read the value for the Connection_Accept_Timeout\n" \
1561 "configuration parameter. The Connection_Accept_Timeout configuration\n" \
1562 "parameter allows the Bluetooth hardware to automatically deny a\n" \
1563 "connection request after a specified time period has occurred and\n" \
1564 "the new connection is not accepted. Connection Accept Timeout\n" \
1565 "measured in Number of Baseband slots.",
1566 &hci_read_connection_accept_timeout
1569 "write_connection_accept_timeout <timeout>",
1570 "\nThis command will write the value for the Connection_Accept_Timeout\n" \
1571 "configuration parameter.\n\n" \
1572 "\t<timeout> - dddd; measured in number of baseband slots.",
1573 &hci_write_connection_accept_timeout
1576 "read_page_timeout",
1577 "\nThis command will read the value for the Page_Timeout configuration\n" \
1578 "parameter. The Page_Timeout configuration parameter defines the\n" \
1579 "maximum time the local Link Manager will wait for a baseband page\n" \
1580 "response from the remote unit at a locally initiated connection\n" \
1581 "attempt. Page Timeout measured in Number of Baseband slots.",
1582 &hci_read_page_timeout
1585 "write_page_timeout <timeout>",
1586 "\nThis command will write the value for the Page_Timeout configuration\n" \
1588 "\t<timeout> - dddd; measured in number of baseband slots.",
1589 &hci_write_page_timeout
1593 "\nThis command will read the value for the Scan_Enable parameter. The\n" \
1594 "Scan_Enable parameter controls whether or not the Bluetooth uint\n" \
1595 "will periodically scan for page attempts and/or inquiry requests\n" \
1596 "from other Bluetooth unit.\n\n" \
1597 "\t0x00 - No Scans enabled.\n" \
1598 "\t0x01 - Inquiry Scan enabled. Page Scan disabled.\n" \
1599 "\t0x02 - Inquiry Scan disabled. Page Scan enabled.\n" \
1600 "\t0x03 - Inquiry Scan enabled. Page Scan enabled.",
1601 &hci_read_scan_enable
1604 "write_scan_enable <scan_enable>",
1605 "\nThis command will write the value for the Scan_Enable parameter.\n" \
1606 "The Scan_Enable parameter controls whether or not the Bluetooth\n" \
1607 "unit will periodically scan for page attempts and/or inquiry\n" \
1608 "requests from other Bluetooth unit.\n\n" \
1609 "\t<scan_enable> - dd;\n" \
1610 "\t0 - No Scans enabled.\n" \
1611 "\t1 - Inquiry Scan enabled. Page Scan disabled.\n" \
1612 "\t2 - Inquiry Scan disabled. Page Scan enabled.\n" \
1613 "\t3 - Inquiry Scan enabled. Page Scan enabled.",
1614 &hci_write_scan_enable
1617 "read_page_scan_activity",
1618 "\nThis command will read the value for Page_Scan_Activity configuration\n" \
1619 "parameters. The Page_Scan_Interval configuration parameter defines the\n" \
1620 "amount of time between consecutive page scans. This time interval is \n" \
1621 "defined from when the Host Controller started its last page scan until\n" \
1622 "it begins the next page scan. The Page_Scan_Window configuration parameter\n" \
1623 "defines the amount of time for the duration of the page scan. The\n" \
1624 "Page_Scan_Window can only be less than or equal to the Page_Scan_Interval.",
1625 &hci_read_page_scan_activity
1628 "write_page_scan_activity interval(dddd) window(dddd)",
1629 "\nThis command will write the value for Page_Scan_Activity configuration\n" \
1630 "parameter. The Page_Scan_Interval configuration parameter defines the\n" \
1631 "amount of time between consecutive page scans. This is defined as the time\n" \
1632 "interval from when the Host Controller started its last page scan until it\n" \
1633 "begins the next page scan. The Page_Scan_Window configuration parameter\n" \
1634 "defines the amount of time for the duration of the page scan. \n" \
1635 "The Page_Scan_Window can only be less than or equal to the Page_Scan_Interval.\n\n" \
1636 "\t<interval> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n" \
1637 "\t<window> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec",
1638 &hci_write_page_scan_activity
1641 "read_inquiry_scan_activity",
1642 "\nThis command will read the value for Inquiry_Scan_Activity configuration\n" \
1643 "parameter. The Inquiry_Scan_Interval configuration parameter defines the\n" \
1644 "amount of time between consecutive inquiry scans. This is defined as the\n" \
1645 "time interval from when the Host Controller started its last inquiry scan\n" \
1646 "until it begins the next inquiry scan.",
1647 &hci_read_inquiry_scan_activity
1650 "write_inquiry_scan_activity interval(dddd) window(dddd)",
1651 "\nThis command will write the value for Inquiry_Scan_Activity configuration\n"\
1652 "parameter. The Inquiry_Scan_Interval configuration parameter defines the\n" \
1653 "amount of time between consecutive inquiry scans. This is defined as the\n" \
1654 "time interval from when the Host Controller started its last inquiry scan\n" \
1655 "until it begins the next inquiry scan. The Inquiry_Scan_Window configuration\n" \
1656 "parameter defines the amount of time for the duration of the inquiry scan.\n" \
1657 "The Inquiry_Scan_Window can only be less than or equal to the Inquiry_Scan_Interval.\n\n" \
1658 "\t<interval> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec\n" \
1659 "\t<window> - Range: 0x0012 -- 0x100, Time = N * 0.625 msec",
1660 &hci_write_inquiry_scan_activity
1663 "read_authentication_enable",
1664 "\nThis command will read the value for the Authentication_Enable parameter.\n"\
1665 "The Authentication_Enable parameter controls if the local unit requires\n"\
1666 "to authenticate the remote unit at connection setup (between the\n" \
1667 "Create_Connection command or acceptance of an incoming ACL connection\n"\
1668 "and the corresponding Connection Complete event). At connection setup, only\n"\
1669 "the unit(s) with the Authentication_Enable parameter enabled will try to\n"\
1670 "authenticate the other unit.",
1671 &hci_read_authentication_enable
1674 "write_authentication_enable enable(0|1)",
1675 "\nThis command will write the value for the Authentication_Enable parameter.\n"\
1676 "The Authentication_Enable parameter controls if the local unit requires to\n"\
1677 "authenticate the remote unit at connection setup (between the\n" \
1678 "Create_Connection command or acceptance of an incoming ACL connection\n" \
1679 "and the corresponding Connection Complete event). At connection setup, only\n"\
1680 "the unit(s) with the Authentication_Enable parameter enabled will try to\n"\
1681 "authenticate the other unit.",
1682 &hci_write_authentication_enable
1685 "read_encryption_mode",
1686 "\nThis command will read the value for the Encryption_Mode parameter. The\n" \
1687 "Encryption_Mode parameter controls if the local unit requires encryption\n" \
1688 "to the remote unit at connection setup (between the Create_Connection\n" \
1689 "command or acceptance of an incoming ACL connection and the corresponding\n" \
1690 "Connection Complete event). At connection setup, only the unit(s) with\n" \
1691 "the Authentication_Enable parameter enabled and Encryption_Mode parameter\n" \
1692 "enabled will try to encrypt the connection to the other unit.\n\n" \
1693 "\t<encryption_mode>:\n" \
1694 "\t0x00 - Encryption disabled.\n" \
1695 "\t0x01 - Encryption only for point-to-point packets.\n" \
1696 "\t0x02 - Encryption for both point-to-point and broadcast packets.",
1697 &hci_read_encryption_mode
1700 "write_encryption_mode mode(0|1|2)",
1701 "\tThis command will write the value for the Encryption_Mode parameter.\n" \
1702 "The Encryption_Mode parameter controls if the local unit requires\n" \
1703 "encryption to the remote unit at connection setup (between the\n" \
1704 "Create_Connection command or acceptance of an incoming ACL connection\n" \
1705 "and the corresponding Connection Complete event). At connection setup,\n" \
1706 "only the unit(s) with the Authentication_Enable parameter enabled and\n" \
1707 "Encryption_Mode parameter enabled will try to encrypt the connection to\n" \
1708 "the other unit.\n\n" \
1709 "\t<encryption_mode> (dd)\n" \
1710 "\t0 - Encryption disabled.\n" \
1711 "\t1 - Encryption only for point-to-point packets.\n" \
1712 "\t2 - Encryption for both point-to-point and broadcast packets.",
1713 &hci_write_encryption_mode
1716 "read_class_of_device",
1717 "\nThis command will read the value for the Class_of_Device parameter.\n" \
1718 "The Class_of_Device parameter is used to indicate the capabilities of\n" \
1719 "the local unit to other units.",
1720 &hci_read_class_of_device
1723 "write_class_of_device class(xx:xx:xx)",
1724 "\nThis command will write the value for the Class_of_Device parameter.\n" \
1725 "The Class_of_Device parameter is used to indicate the capabilities of \n" \
1726 "the local unit to other units.\n\n" \
1727 "\t<class> (xx:xx:xx) - class of device",
1728 &hci_write_class_of_device
1731 "read_voice_settings",
1732 "\nThis command will read the values for the Voice_Setting parameter.\n" \
1733 "The Voice_Setting parameter controls all the various settings for voice\n" \
1734 "connections. These settings apply to all voice connections, and cannot be\n" \
1735 "set for individual voice connections. The Voice_Setting parameter controls\n" \
1736 "the configuration for voice connections: Input Coding, Air coding format,\n" \
1737 "input data format, Input sample size, and linear PCM parameter.",
1738 &hci_read_voice_settings
1741 "write_voice_settings settings(xxxx)",
1742 "\nThis command will write the values for the Voice_Setting parameter.\n" \
1743 "The Voice_Setting parameter controls all the various settings for voice\n" \
1744 "connections. These settings apply to all voice connections, and cannot be\n" \
1745 "set for individual voice connections. The Voice_Setting parameter controls\n" \
1746 "the configuration for voice connections: Input Coding, Air coding format,\n" \
1747 "input data format, Input sample size, and linear PCM parameter.\n\n" \
1748 "\t<voice_settings> (xxxx) - voice settings",
1749 &hci_write_voice_settings
1752 "read_number_broadcast_retransmissions",
1753 "\nThis command will read the unit's parameter value for the Number of\n" \
1754 "Broadcast Retransmissions. Broadcast packets are not acknowledged and are\n" \
1756 &hci_read_number_broadcast_retransmissions
1759 "write_number_broadcast_retransmissions count(dd)",
1760 "\nThis command will write the unit's parameter value for the Number of\n" \
1761 "Broadcast Retransmissions. Broadcast packets are not acknowledged and are\n" \
1763 "\t<count> (dd) - number of broadcast retransimissions",
1764 &hci_write_number_broadcast_retransmissions
1767 "read_hold_mode_activity",
1768 "\nThis command will read the value for the Hold_Mode_Activity parameter.\n" \
1769 "The Hold_Mode_Activity value is used to determine what activities should\n" \
1770 "be suspended when the unit is in hold mode.",
1771 &hci_read_hold_mode_activity
1774 "write_hold_mode_activity settings(0|1|2|4)",
1775 "\nThis command will write the value for the Hold_Mode_Activity parameter.\n" \
1776 "The Hold_Mode_Activity value is used to determine what activities should\n" \
1777 "be suspended when the unit is in hold mode.\n\n" \
1778 "\t<settings> (dd) - bit mask:\n" \
1779 "\t0 - Maintain current Power State. Default\n" \
1780 "\t1 - Suspend Page Scan.\n" \
1781 "\t2 - Suspend Inquiry Scan.\n" \
1782 "\t4 - Suspend Periodic Inquiries.",
1783 &hci_write_hold_mode_activity
1786 "read_sco_flow_control_enable",
1787 "\nThe Read_SCO_Flow_Control_Enable command provides the ability to read\n" \
1788 "the SCO_Flow_Control_Enable setting. By using this setting, the Host can\n" \
1789 "decide if the Host Controller will send Number Of Completed Packets events\n" \
1790 "for SCO Connection Handles. This setting allows the Host to enable and\n" \
1791 "disable SCO flow control.",
1792 &hci_read_sco_flow_control_enable
1795 "write_sco_flow_control_enable enable(0|1)",
1796 "\nThe Write_SCO_Flow_Control_Enable command provides the ability to write\n" \
1797 "the SCO_Flow_Control_Enable setting. By using this setting, the Host can\n" \
1798 "decide if the Host Controller will send Number Of Completed Packets events\n" \
1799 "for SCO Connection Handles. This setting allows the Host to enable and\n" \
1800 "disable SCO flow control. The SCO_Flow_Control_Enable setting can only be\n" \
1801 "changed if no connections exist.",
1802 &hci_write_sco_flow_control_enable
1805 "read_link_supervision_timeout <connection_handle>",
1806 "\nThis command will read the value for the Link_Supervision_Timeout\n" \
1807 "parameter for the device. The Link_Supervision_Timeout parameter is used\n" \
1808 "by the master or slave Bluetooth device to monitor link loss. If, for any\n" \
1809 "reason, no Baseband packets are received from that Connection Handle for a\n" \
1810 "duration longer than the Link_Supervision_Timeout, the connection is\n"
1811 "disconnected.\n\n" \
1812 "\t<connection_handle> - dddd; connection handle\n",
1813 &hci_read_link_supervision_timeout
1816 "write_link_supervision_timeout <connection_handle> <timeout>",
1817 "\nThis command will write the value for the Link_Supervision_Timeout\n" \
1818 "parameter for the device. The Link_Supervision_Timeout parameter is used\n" \
1819 "by the master or slave Bluetooth device to monitor link loss. If, for any\n" \
1820 "reason, no Baseband packets are received from that connection handle for a\n" \
1821 "duration longer than the Link_Supervision_Timeout, the connection is\n" \
1822 "disconnected.\n\n" \
1823 "\t<connection_handle> - dddd; connection handle\n" \
1824 "\t<timeout> - dddd; timeout measured in number of baseband slots\n",
1825 &hci_write_link_supervision_timeout
1828 "read_page_scan_period_mode",
1829 "\nThis command is used to read the mandatory Page_Scan_Period_Mode of the\n" \
1830 "local Bluetooth device. Every time an inquiry response message is sent, the\n"\
1831 "Bluetooth device will start a timer (T_mandatory_pscan), the value of which\n"\
1832 "is dependent on the Page_Scan_Period_Mode. As long as this timer has not\n" \
1833 "expired, the Bluetooth device will use the Page_Scan_Period_Mode for all\n" \
1834 "following page scans.",
1835 &hci_read_page_scan_period_mode
1838 "write_page_scan_period_mode <page_scan_period_mode>",
1839 "\nThis command is used to write the mandatory Page_Scan_Period_Mode of the\n" \
1840 "local Bluetooth device. Every time an inquiry response message is sent, the\n"\
1841 "Bluetooth device will start a timer (T_mandatory_pscan), the value of which\n"\
1842 "is dependent on the Page_Scan_Period_Mode. As long as this timer has not\n" \
1843 "expired, the Bluetooth device will use the Page_Scan_Period_Mode for all\n" \
1844 "following page scans.\n\n" \
1845 "\t<page_scan_period_mode> - dd; page scan period mode:\n" \
1846 "\t0x00 - P0 (Default)\n" \
1849 &hci_write_page_scan_period_mode
1852 "read_page_scan_mode",
1853 "\nThis command is used to read the default page scan mode of the local\n" \
1854 "Bluetooth device. The Page_Scan_Mode parameter indicates the page scan mode\n"\
1855 "that is used for the default page scan. Currently one mandatory page scan\n"\
1856 "mode and three optional page scan modes are defined. Following an inquiry\n" \
1857 "response, if the Baseband timer T_mandatory_pscan has not expired, the\n" \
1858 "mandatory page scan mode must be applied.",
1859 &hci_read_page_scan_mode
1862 "write_page_scan_mode <page_scan_mode>",
1863 "\nThis command is used to write the default page scan mode of the local\n" \
1864 "Bluetooth device. The Page_Scan_Mode parameter indicates the page scan mode\n"\
1865 "that is used for the default page scan. Currently, one mandatory page scan\n"\
1866 "mode and three optional page scan modes are defined. Following an inquiry\n"\
1867 "response, if the Baseband timer T_mandatory_pscan has not expired, the\n" \
1868 "mandatory page scan mode must be applied.\n\n" \
1869 "\t<page_scan_mode> - dd; page scan mode:\n" \
1870 "\t0x00 - Mandatory Page Scan Mode (Default)\n" \
1871 "\t0x01 - Optional Page Scan Mode I\n" \
1872 "\t0x02 - Optional Page Scan Mode II\n" \
1873 "\t0x03 - Optional Page Scan Mode III",
1874 &hci_write_page_scan_mode