hci_request.c (f17d858ed0a48270db4368d8cf370e3839ee6f4f) | hci_request.c (2064ee332e4c1b7495cf68b84355c213d8fe71fd) |
---|---|
1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 4 Copyright (C) 2014 Intel Corporation 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 322 unchanged lines hidden (view full) --- 331 /* If an error occurred during request building, there is no point in 332 * queueing the HCI command. We can simply return. 333 */ 334 if (req->err) 335 return; 336 337 skb = hci_prepare_cmd(hdev, opcode, plen, param); 338 if (!skb) { | 1/* 2 BlueZ - Bluetooth protocol stack for Linux 3 4 Copyright (C) 2014 Intel Corporation 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 322 unchanged lines hidden (view full) --- 331 /* If an error occurred during request building, there is no point in 332 * queueing the HCI command. We can simply return. 333 */ 334 if (req->err) 335 return; 336 337 skb = hci_prepare_cmd(hdev, opcode, plen, param); 338 if (!skb) { |
339 BT_ERR("%s no memory for command (opcode 0x%4.4x)", 340 hdev->name, opcode); | 339 bt_dev_err(hdev, "no memory for command (opcode 0x%4.4x)", 340 opcode); |
341 req->err = -ENOMEM; 342 return; 343 } 344 345 if (skb_queue_empty(&req->cmd_q)) 346 bt_cb(skb)->hci.req_flags |= HCI_REQ_START; 347 348 bt_cb(skb)->hci.req_event = event; --- 1072 unchanged lines hidden (view full) --- 1421 *own_addr_type = ADDR_LE_DEV_RANDOM; 1422 1423 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && 1424 !bacmp(&hdev->random_addr, &hdev->rpa)) 1425 return 0; 1426 1427 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); 1428 if (err < 0) { | 341 req->err = -ENOMEM; 342 return; 343 } 344 345 if (skb_queue_empty(&req->cmd_q)) 346 bt_cb(skb)->hci.req_flags |= HCI_REQ_START; 347 348 bt_cb(skb)->hci.req_event = event; --- 1072 unchanged lines hidden (view full) --- 1421 *own_addr_type = ADDR_LE_DEV_RANDOM; 1422 1423 if (!hci_dev_test_and_clear_flag(hdev, HCI_RPA_EXPIRED) && 1424 !bacmp(&hdev->random_addr, &hdev->rpa)) 1425 return 0; 1426 1427 err = smp_generate_rpa(hdev, hdev->irk, &hdev->rpa); 1428 if (err < 0) { |
1429 BT_ERR("%s failed to generate new RPA", hdev->name); | 1429 bt_dev_err(hdev, "failed to generate new RPA"); |
1430 return err; 1431 } 1432 1433 set_random_addr(req, &hdev->rpa); 1434 1435 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); 1436 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); 1437 --- 345 unchanged lines hidden (view full) --- 1783 int err; 1784 1785 hci_req_init(&req, conn->hdev); 1786 1787 __hci_abort_conn(&req, conn, reason); 1788 1789 err = hci_req_run(&req, abort_conn_complete); 1790 if (err && err != -ENODATA) { | 1430 return err; 1431 } 1432 1433 set_random_addr(req, &hdev->rpa); 1434 1435 to = msecs_to_jiffies(hdev->rpa_timeout * 1000); 1436 queue_delayed_work(hdev->workqueue, &hdev->rpa_expired, to); 1437 --- 345 unchanged lines hidden (view full) --- 1783 int err; 1784 1785 hci_req_init(&req, conn->hdev); 1786 1787 __hci_abort_conn(&req, conn, reason); 1788 1789 err = hci_req_run(&req, abort_conn_complete); 1790 if (err && err != -ENODATA) { |
1791 BT_ERR("Failed to run HCI request: err %d", err); | 1791 bt_dev_err(conn->hdev, "failed to run HCI request: err %d", err); |
1792 return err; 1793 } 1794 1795 return 0; 1796} 1797 1798static int update_bg_scan(struct hci_request *req, unsigned long opt) 1799{ --- 67 unchanged lines hidden (view full) --- 1867 1868 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) 1869 return; 1870 1871 cancel_delayed_work(&hdev->le_scan_restart); 1872 1873 hci_req_sync(hdev, le_scan_disable, 0, HCI_CMD_TIMEOUT, &status); 1874 if (status) { | 1792 return err; 1793 } 1794 1795 return 0; 1796} 1797 1798static int update_bg_scan(struct hci_request *req, unsigned long opt) 1799{ --- 67 unchanged lines hidden (view full) --- 1867 1868 if (!hci_dev_test_flag(hdev, HCI_LE_SCAN)) 1869 return; 1870 1871 cancel_delayed_work(&hdev->le_scan_restart); 1872 1873 hci_req_sync(hdev, le_scan_disable, 0, HCI_CMD_TIMEOUT, &status); 1874 if (status) { |
1875 BT_ERR("Failed to disable LE scan: status 0x%02x", status); | 1875 bt_dev_err(hdev, "failed to disable LE scan: status 0x%02x", 1876 status); |
1876 return; 1877 } 1878 1879 hdev->discovery.scan_start = 0; 1880 1881 /* If we were running LE only scan, change discovery state. If 1882 * we were running both LE and BR/EDR inquiry simultaneously, 1883 * and BR/EDR inquiry is already finished, stop discovery, --- 14 unchanged lines hidden (view full) --- 1898 goto discov_stopped; 1899 1900 return; 1901 } 1902 1903 hci_req_sync(hdev, bredr_inquiry, DISCOV_INTERLEAVED_INQUIRY_LEN, 1904 HCI_CMD_TIMEOUT, &status); 1905 if (status) { | 1877 return; 1878 } 1879 1880 hdev->discovery.scan_start = 0; 1881 1882 /* If we were running LE only scan, change discovery state. If 1883 * we were running both LE and BR/EDR inquiry simultaneously, 1884 * and BR/EDR inquiry is already finished, stop discovery, --- 14 unchanged lines hidden (view full) --- 1899 goto discov_stopped; 1900 1901 return; 1902 } 1903 1904 hci_req_sync(hdev, bredr_inquiry, DISCOV_INTERLEAVED_INQUIRY_LEN, 1905 HCI_CMD_TIMEOUT, &status); 1906 if (status) { |
1906 BT_ERR("Inquiry failed: status 0x%02x", status); | 1907 bt_dev_err(hdev, "inquiry failed: status 0x%02x", status); |
1907 goto discov_stopped; 1908 } 1909 1910 return; 1911 1912discov_stopped: 1913 hci_dev_lock(hdev); 1914 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); --- 25 unchanged lines hidden (view full) --- 1940 le_scan_restart.work); 1941 unsigned long timeout, duration, scan_start, now; 1942 u8 status; 1943 1944 BT_DBG("%s", hdev->name); 1945 1946 hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status); 1947 if (status) { | 1908 goto discov_stopped; 1909 } 1910 1911 return; 1912 1913discov_stopped: 1914 hci_dev_lock(hdev); 1915 hci_discovery_set_state(hdev, DISCOVERY_STOPPED); --- 25 unchanged lines hidden (view full) --- 1941 le_scan_restart.work); 1942 unsigned long timeout, duration, scan_start, now; 1943 u8 status; 1944 1945 BT_DBG("%s", hdev->name); 1946 1947 hci_req_sync(hdev, le_scan_restart, 0, HCI_CMD_TIMEOUT, &status); 1948 if (status) { |
1948 BT_ERR("Failed to restart LE scan: status %d", status); | 1949 bt_dev_err(hdev, "failed to restart LE scan: status %d", 1950 status); |
1949 return; 1950 } 1951 1952 hci_dev_lock(hdev); 1953 1954 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) || 1955 !hdev->discovery.scan_start) 1956 goto unlock; --- 412 unchanged lines hidden --- | 1951 return; 1952 } 1953 1954 hci_dev_lock(hdev); 1955 1956 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) || 1957 !hdev->discovery.scan_start) 1958 goto unlock; --- 412 unchanged lines hidden --- |