Bluetooth: Print error message for HCI_Hardware_Error event
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 2 Nov 2014 01:56:41 +0000 (02:56 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 2 Nov 2014 07:59:42 +0000 (09:59 +0200)
When the HCI_Hardware_Error event is send by the controller or
injected by the driver, then at least print an error message.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_event.c

index 6e8f249673089badfb3e512341478171ada9d174..ecfa306e1375b5f492a72d927d4eed6bf8aea8af 100644 (file)
@@ -1463,6 +1463,11 @@ struct hci_ev_cmd_status {
        __le16   opcode;
 } __packed;
 
+#define HCI_EV_HARDWARE_ERROR          0x10
+struct hci_ev_hardware_error {
+       __u8     code;
+} __packed;
+
 #define HCI_EV_ROLE_CHANGE             0x12
 struct hci_ev_role_change {
        __u8     status;
index 3dd2550b4c0752a44f17f805897e1bf1c50473cd..2f02ff0ed781f88085394acc7a582c2765091d5e 100644 (file)
@@ -2925,6 +2925,13 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
        }
 }
 
+static void hci_hardware_error_evt(struct hci_dev *hdev, struct sk_buff *skb)
+{
+       struct hci_ev_hardware_error *ev = (void *) skb->data;
+
+       BT_ERR("%s hardware error 0x%2.2x", hdev->name, ev->code);
+}
+
 static void hci_role_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct hci_ev_role_change *ev = (void *) skb->data;
@@ -4746,6 +4753,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
                hci_cmd_status_evt(hdev, skb);
                break;
 
+       case HCI_EV_HARDWARE_ERROR:
+               hci_hardware_error_evt(hdev, skb);
+               break;
+
        case HCI_EV_ROLE_CHANGE:
                hci_role_change_evt(hdev, skb);
                break;