btusb: Raw mode and ACL/SCO data
PATCH 1/1 btusb: Raw mode and ACL/SCO data
This patch allows sending ACL/SCO packets if device is in RAW mode. Previously only command packets were allowed.
drivers/bluetooth/btusb.c +6 -2
@@ -663,7 +663,9 @@break ;case HCI_ACLDATA_PKT : -if (!data->bulk_tx_ep || hdev->conn_hash.acl_num <1 ) +if (!data->bulk_tx_ep || + (!test_bit (HCI_RAW , &hdev->flags) && + hdev->conn_hash.acl_num <1 ))return -ENODEV ; urb =usb_alloc_urb (0 ,GFP_ATOMIC );
@@ -680,7 +682,9 @@break ;case HCI_SCODATA_PKT : -if (!data->isoc_tx_ep || hdev->conn_hash.sco_num <1 ) +if (!data->isoc_tx_ep || + (!test_bit (HCI_RAW , &hdev->flags) && + hdev->conn_hash.sco_num <1 ))return -ENODEV ; urb =usb_alloc_urb (BTUSB_MAX_ISOC_FRAMES ,GFP_ATOMIC );
Marcel Holtmann
maintainerHi Kim,
Quoted 2 lines
This patch allows sending ACL/SCO packets if device is in RAW mode. Previously only command packets were allowed.
so do I really wanna know why such a change is required?
drivers/bluetooth/btusb.c line 669
Quoted 12 lines
diff -ur
orig/drivers/bluetooth/btusb.clinux-2.6.33.2/drivers/bluetooth/btusb.cdrivers/bluetooth/btusb.c +3
-1@@ -663,7 +663,9 @@break ;case HCI_ACLDATA_PKT : -if (!data->bulk_tx_ep || hdev->conn_hash.acl_num <1 ) +if (!data->bulk_tx_ep || + (!test_bit (HCI_RAW , &hdev->flags) && + hdev->conn_hash.acl_num <1 ))return -ENODEV ;
Actually this one is wrong. The conn_hash.acl_num check just has to go away. We always start the bulk URBs anyway since otherwise a lot of devices break. We had to figure this out the hard way. Some device manufactures have endpoints that rely on each other and do their flow control based on submitted URBs.
So no need to do another HCI_RAW test here.
drivers/bluetooth/btusb.c line 690
Quoted 12 lines
drivers/bluetooth/btusb.c +3
-1urb =usb_alloc_urb (0 ,GFP_ATOMIC );@@ -680,7 +682,9 @@break ;case HCI_SCODATA_PKT : -if (!data->isoc_tx_ep || hdev->conn_hash.sco_num <1 ) +if (!data->isoc_tx_ep || + (!test_bit (HCI_RAW , &hdev->flags) && + hdev->conn_hash.sco_num <1 ))return -ENODEV ; urb =usb_alloc_urb (BTUSB_MAX_ISOC_FRAMES ,GFP_ATOMIC );
And my assumption is that you only tested ACL data since this clearly doesn't do anything useful. The isoc URBs and incoming data are not magically started only because you pass this checkpoint.
No SCO links and no isoc URBs in the system. Period. If you wanna disable the kernel Bluetooth stack, then you don't get SCO support over USB.
Regards
Marcel