From: Sudha Bheemanna Date: Wed, 7 Sep 2016 10:12:22 +0000 (+0530) Subject: Bluetooth: Add hardware error MGMT event X-Git-Tag: accepted/tizen/unified/20210330.111217~198 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efb76df24d643149c872e50387b5f5987bced770;p=platform%2Fkernel%2Flinux-rpi.git Bluetooth: Add hardware error MGMT event Add code to handle hardware error MGMT event. Change-Id: I5875ea2aeae7aba95c1f8e15b456704dc6bcdee4 Signed-off-by: Sudha Bheemanna Signed-off-by: Amit Purwar --- diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 35c839c..d8488f7 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1882,6 +1882,7 @@ int mgmt_le_conn_updated(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type, u16 supervision_timeout); int mgmt_le_conn_update_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, u8 addr_type, u8 status); +void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code); #endif u8 hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, u16 latency, diff --git a/include/net/bluetooth/mgmt_tizen.h b/include/net/bluetooth/mgmt_tizen.h index 4c2e9d0..680ad8b 100644 --- a/include/net/bluetooth/mgmt_tizen.h +++ b/include/net/bluetooth/mgmt_tizen.h @@ -162,6 +162,13 @@ struct mgmt_ev_device_name_update { } __packed; /* Device name update changes */ +/* For handling of hardware error event */ +#define MGMT_EV_HARDWARE_ERROR (TIZEN_EV_BASE + 0x02) +struct mgmt_ev_hardware_error { + __u8 error_code; +} __packed; +/* handling of hardware error event */ + /* For handling of RSSI Events */ #define MGMT_EV_RSSI_ALERT (TIZEN_EV_BASE + 0x04) struct mgmt_ev_vendor_specific_rssi_alert { diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 67dec97..2529e89 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3812,6 +3812,11 @@ static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_hardware_error *ev = (void *) skb->data; +#ifdef TIZEN_BT + hci_dev_lock(hdev); + mgmt_hardware_error(hdev, ev->code); + hci_dev_unlock(hdev); +#endif hdev->hw_error_code = ev->code; queue_work(hdev->req_workqueue, &hdev->error_reset); diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 5e98bf2..3d96ca6 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -7605,6 +7605,14 @@ static int le_set_scan_params(struct sock *sk, struct hci_dev *hdev, return err; } + +void mgmt_hardware_error(struct hci_dev *hdev, u8 err_code) +{ + struct mgmt_ev_hardware_error ev; + + ev.error_code = err_code; + mgmt_event(MGMT_EV_HARDWARE_ERROR, hdev, &ev, sizeof(ev), NULL); +} #endif /* TIZEN_BT */ static bool ltk_is_valid(struct mgmt_ltk_info *key)