浏览代码

Bluetooth: btusb: Add internal callback for USB bulk rx data

Some vendors require special handling of the rx data from the USB
bulk endpoints. For that case provide an internal callback that
can overwrite it with a custom receive function.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Marcel Holtmann 10 年之前
父节点
当前提交
2cbd3f5ccd
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      drivers/bluetooth/btusb.c

+ 5 - 1
drivers/bluetooth/btusb.c

@@ -299,6 +299,8 @@ struct btusb_data {
 	unsigned int sco_num;
 	unsigned int sco_num;
 	int isoc_altsetting;
 	int isoc_altsetting;
 	int suspend_count;
 	int suspend_count;
+
+	int (*recv_bulk)(struct btusb_data *data, void *buffer, int count);
 };
 };
 
 
 static inline void btusb_free_frags(struct btusb_data *data)
 static inline void btusb_free_frags(struct btusb_data *data)
@@ -590,7 +592,7 @@ static void btusb_bulk_complete(struct urb *urb)
 	if (urb->status == 0) {
 	if (urb->status == 0) {
 		hdev->stat.byte_rx += urb->actual_length;
 		hdev->stat.byte_rx += urb->actual_length;
 
 
-		if (btusb_recv_bulk(data, urb->transfer_buffer,
+		if (data->recv_bulk(data, urb->transfer_buffer,
 				    urb->actual_length) < 0) {
 				    urb->actual_length) < 0) {
 			BT_ERR("%s corrupted ACL packet", hdev->name);
 			BT_ERR("%s corrupted ACL packet", hdev->name);
 			hdev->stat.err_rx++;
 			hdev->stat.err_rx++;
@@ -2012,6 +2014,8 @@ static int btusb_probe(struct usb_interface *intf,
 	init_usb_anchor(&data->isoc_anchor);
 	init_usb_anchor(&data->isoc_anchor);
 	spin_lock_init(&data->rxlock);
 	spin_lock_init(&data->rxlock);
 
 
+	data->recv_bulk = btusb_recv_bulk;
+
 	hdev = hci_alloc_dev();
 	hdev = hci_alloc_dev();
 	if (!hdev)
 	if (!hdev)
 		return -ENOMEM;
 		return -ENOMEM;