Deleted Added
full compact
host_controller_baseband.c (281210) host_controller_baseband.c (281680)
1/*
2 * host_controller_baseband.c
3 *
4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

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
26 * SUCH DAMAGE.
27 *
28 * $Id: host_controller_baseband.c,v 1.4 2003/08/18 19:19:53 max Exp $
1/*
2 * host_controller_baseband.c
3 *
4 * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

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
26 * SUCH DAMAGE.
27 *
28 * $Id: host_controller_baseband.c,v 1.4 2003/08/18 19:19:53 max Exp $
29 * $FreeBSD: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c 281210 2015-04-07 16:48:23Z takawata $
29 * $FreeBSD: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c 281680 2015-04-18 04:53:17Z takawata $
30 */
31
32#define L2CAP_SOCKET_CHECKED
33#include <bluetooth.h>
34#include <errno.h>
35#include <stdio.h>
36#include <string.h>
37#include "hccontrol.h"

--- 1445 unchanged lines hidden (view full) ---

1483 fprintf(stdout, "Status: %s [%#02x]\n",
1484 hci_status2str(rp.status), rp.status);
1485 return (FAILED);
1486 }
1487
1488 return (OK);
1489} /* hci_write_page_scan_mode */
1490
30 */
31
32#define L2CAP_SOCKET_CHECKED
33#include <bluetooth.h>
34#include <errno.h>
35#include <stdio.h>
36#include <string.h>
37#include "hccontrol.h"

--- 1445 unchanged lines hidden (view full) ---

1483 fprintf(stdout, "Status: %s [%#02x]\n",
1484 hci_status2str(rp.status), rp.status);
1485 return (FAILED);
1486 }
1487
1488 return (OK);
1489} /* hci_write_page_scan_mode */
1490
1491static int
1492hci_read_le_host_supported_command(int s, int argc, char **argv)
1493{
1494 ng_hci_read_le_host_supported_rp rp;
1495 int n;
1496 n = sizeof(rp);
1497 if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1498 NG_HCI_OCF_READ_LE_HOST_SUPPORTED),
1499 (char *) &rp, &n) == ERROR)
1500 return (ERROR);
1501
1502 if (rp.status != 0x00) {
1503 fprintf(stdout, "Status: %s [%#02x]\n",
1504 hci_status2str(rp.status), rp.status);
1505 return (FAILED);
1506 }
1507
1508 fprintf(stdout, "LE Host support: %#02x\n", rp.le_supported_host);
1509 fprintf(stdout, "Simulateneouse LE Host : %#02x\n", rp.simultaneous_le_host);
1510
1511 return (OK);
1512
1513}
1514static int
1515hci_write_le_host_supported_command(int s, int argc, char **argv)
1516{
1517 ng_hci_write_le_host_supported_cp cp;
1518 ng_hci_write_le_host_supported_rp rp;
1519
1520 int n;
1521
1522 cp.le_supported_host = 0;
1523 cp.simultaneous_le_host = 0;
1524 switch (argc) {
1525 case 2:
1526 if (sscanf(argv[1], "%d", &n) != 1 || (n != 0 && n != 1)){
1527 printf("ARGC2: %d\n", n);
1528 return (USAGE);
1529 }
1530 cp.simultaneous_le_host = (n &1);
1531
1532 case 1:
1533 if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){
1534 printf("ARGC1: %d\n", n);
1535 return (USAGE);
1536 }
1537
1538 cp.le_supported_host = (n &1);
1539 break;
1540
1541 default:
1542 return (USAGE);
1543 }
1544
1545
1546 /* send command */
1547 n = sizeof(rp);
1548 if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
1549 NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED),
1550 (char const *) &cp, sizeof(cp),
1551 (char *) &rp, &n) == ERROR)
1552 return (ERROR);
1553
1554 if (rp.status != 0x00) {
1555 fprintf(stdout, "Status: %s [%#02x]\n",
1556 hci_status2str(rp.status), rp.status);
1557 return (FAILED);
1558 }
1559
1560 return (OK);
1561}
1562
1491struct hci_command host_controller_baseband_commands[] = {
1492{
1493"reset",
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.",

--- 369 unchanged lines hidden (view full) ---

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
1875},
1563struct hci_command host_controller_baseband_commands[] = {
1564{
1565"reset",
1566"\nThe Reset command will reset the Host Controller and the Link Manager.\n" \
1567"After the reset is completed, the current operational state will be lost,\n" \
1568"the Bluetooth unit will enter standby mode and the Host Controller will\n" \
1569"automatically revert to the default values for the parameters for which\n" \
1570"default values are defined in the specification.",

--- 369 unchanged lines hidden (view full) ---

1940"mandatory page scan mode must be applied.\n\n" \
1941"\t<page_scan_mode> - dd; page scan mode:\n" \
1942"\t0x00 - Mandatory Page Scan Mode (Default)\n" \
1943"\t0x01 - Optional Page Scan Mode I\n" \
1944"\t0x02 - Optional Page Scan Mode II\n" \
1945"\t0x03 - Optional Page Scan Mode III",
1946&hci_write_page_scan_mode
1947},
1948{
1949"read_le_host_supported_command", \
1950"Read if this host is in le supported mode and stimulatenouse le supported mode",
1951&hci_read_le_host_supported_command,
1952},
1953{
1954"write_le_host_supported_command", \
1955"write_le_host_supported_command le_host[0|1] stimultajeous_le[0|1]",
1956&hci_write_le_host_supported_command,
1957},
1958
1876{ NULL, }
1877};
1878
1959{ NULL, }
1960};
1961