Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/include/net/bluetooth/hci_drv.h
26285 views
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
/*
3
* Copyright (C) 2025 Google Corporation
4
*/
5
6
#ifndef __HCI_DRV_H
7
#define __HCI_DRV_H
8
9
#include <linux/types.h>
10
11
#include <net/bluetooth/bluetooth.h>
12
#include <net/bluetooth/hci.h>
13
14
struct hci_drv_cmd_hdr {
15
__le16 opcode;
16
__le16 len;
17
} __packed;
18
19
struct hci_drv_ev_hdr {
20
__le16 opcode;
21
__le16 len;
22
} __packed;
23
24
#define HCI_DRV_EV_CMD_STATUS 0x0000
25
struct hci_drv_ev_cmd_status {
26
__le16 opcode;
27
__u8 status;
28
} __packed;
29
30
#define HCI_DRV_EV_CMD_COMPLETE 0x0001
31
struct hci_drv_ev_cmd_complete {
32
__le16 opcode;
33
__u8 status;
34
__u8 data[];
35
} __packed;
36
37
#define HCI_DRV_STATUS_SUCCESS 0x00
38
#define HCI_DRV_STATUS_UNSPECIFIED_ERROR 0x01
39
#define HCI_DRV_STATUS_UNKNOWN_COMMAND 0x02
40
#define HCI_DRV_STATUS_INVALID_PARAMETERS 0x03
41
42
#define HCI_DRV_MAX_DRIVER_NAME_LENGTH 32
43
44
/* Common commands that make sense on all drivers start from 0x0000 */
45
#define HCI_DRV_OP_READ_INFO 0x0000
46
#define HCI_DRV_READ_INFO_SIZE 0
47
struct hci_drv_rp_read_info {
48
__u8 driver_name[HCI_DRV_MAX_DRIVER_NAME_LENGTH];
49
__le16 num_supported_commands;
50
__le16 supported_commands[];
51
} __packed;
52
53
/* Driver specific OGF (Opcode Group Field)
54
* Commands in this group may have different meanings across different drivers.
55
*/
56
#define HCI_DRV_OGF_DRIVER_SPECIFIC 0x01
57
58
int hci_drv_cmd_status(struct hci_dev *hdev, u16 cmd, u8 status);
59
int hci_drv_cmd_complete(struct hci_dev *hdev, u16 cmd, u8 status, void *rp,
60
size_t rp_len);
61
int hci_drv_process_cmd(struct hci_dev *hdev, struct sk_buff *cmd_skb);
62
63
struct hci_drv_handler {
64
int (*func)(struct hci_dev *hdev, void *data, u16 data_len);
65
size_t data_len;
66
};
67
68
struct hci_drv {
69
size_t common_handler_count;
70
const struct hci_drv_handler *common_handlers;
71
72
size_t specific_handler_count;
73
const struct hci_drv_handler *specific_handlers;
74
};
75
76
#endif /* __HCI_DRV_H */
77
78