26 #include <linux/module.h>
28 #include <linux/kernel.h>
30 #include <linux/slab.h>
31 #include <linux/types.h>
32 #include <linux/errno.h>
33 #include <linux/sched.h>
34 #include <linux/poll.h>
55 static int vhci_open_dev(
struct hci_dev *hdev)
62 static int vhci_close_dev(
struct hci_dev *hdev)
74 static int vhci_flush(
struct hci_dev *hdev)
76 struct vhci_data *data = hci_get_drvdata(hdev);
83 static int vhci_send_frame(
struct sk_buff *
skb)
89 BT_ERR(
"Frame for unknown HCI device (hdev=NULL)");
96 data = hci_get_drvdata(hdev);
107 const char __user *
buf,
size_t count)
123 skb->
dev = (
void *) data->
hdev;
133 struct sk_buff *skb,
char __user *buf,
int count)
138 len =
min_t(
unsigned int, skb->
len, count);
145 data->
hdev->stat.byte_tx +=
len;
149 data->
hdev->stat.cmd_tx++;
153 data->
hdev->stat.acl_tx++;
157 data->
hdev->stat.sco_tx++;
165 char __user *buf,
size_t count, loff_t *
pos)
174 ret = vhci_put_user(data, skb, buf, count);
188 !skb_queue_empty(&data->
readq));
196 static ssize_t vhci_write(
struct file *file,
197 const char __user *buf,
size_t count, loff_t *pos)
201 return vhci_get_user(data, buf, count);
204 static unsigned int vhci_poll(
struct file *file,
poll_table *
wait)
210 if (!skb_queue_empty(&data->
readq))
216 static int vhci_open(
struct inode *
inode,
struct file *file)
225 skb_queue_head_init(&data->
readq);
237 hci_set_drvdata(hdev, data);
242 hdev->
open = vhci_open_dev;
243 hdev->
close = vhci_close_dev;
244 hdev->
flush = vhci_flush;
245 hdev->
send = vhci_send_frame;
248 BT_ERR(
"Can't register HCI device");
260 static int vhci_release(
struct inode *inode,
struct file *file)
280 .release = vhci_release,
290 static int __init vhci_init(
void)
297 static void __exit vhci_exit(
void)