- Cancelling pending transfers at close hook while it is still plugged preventing any resubmittion, this is related ticket 2353
- Free device in correct hook This allows closing and reopening the bluetooth_server keeping bluetooth functionality git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -374,23 +374,21 @@ device_removed(void* cookie)
|
|||||||
flowf("Cancelling queues...\n");
|
flowf("Cancelling queues...\n");
|
||||||
if (bdev->intr_in_ep != NULL) {
|
if (bdev->intr_in_ep != NULL) {
|
||||||
usb->cancel_queued_transfers(bdev->intr_in_ep->handle);
|
usb->cancel_queued_transfers(bdev->intr_in_ep->handle);
|
||||||
flowf("Cancelling impossible EVENTS\n");
|
flowf("Cancelling possible EVENTS\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdev->bulk_in_ep!=NULL) {
|
if (bdev->bulk_in_ep!=NULL) {
|
||||||
usb->cancel_queued_transfers(bdev->bulk_in_ep->handle);
|
usb->cancel_queued_transfers(bdev->bulk_in_ep->handle);
|
||||||
flowf("Cancelling impossible ACL in\n");
|
flowf("Cancelling possible ACL in\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bdev->bulk_out_ep!=NULL) {
|
if (bdev->bulk_out_ep!=NULL) {
|
||||||
usb->cancel_queued_transfers(bdev->bulk_out_ep->handle);
|
usb->cancel_queued_transfers(bdev->bulk_out_ep->handle);
|
||||||
flowf("Cancelling impossible ACL out\n");
|
flowf("Cancelling possible ACL out\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bdev->connected = false;
|
bdev->connected = false;
|
||||||
|
|
||||||
// TODO: place this in the appropiated hook
|
|
||||||
// kill_device(bdev);
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -533,6 +531,24 @@ device_close(void *cookie)
|
|||||||
|
|
||||||
// Clean queues
|
// Clean queues
|
||||||
|
|
||||||
|
if (bdev->connected == true) {
|
||||||
|
flowf("Cancelling queues...\n");
|
||||||
|
if (bdev->intr_in_ep != NULL) {
|
||||||
|
usb->cancel_queued_transfers(bdev->intr_in_ep->handle);
|
||||||
|
flowf("Cancelling possible EVENTS\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bdev->bulk_in_ep!=NULL) {
|
||||||
|
usb->cancel_queued_transfers(bdev->bulk_in_ep->handle);
|
||||||
|
flowf("Cancelling possible ACL in\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bdev->bulk_out_ep!=NULL) {
|
||||||
|
usb->cancel_queued_transfers(bdev->bulk_out_ep->handle);
|
||||||
|
flowf("Cancelling possible ACL out\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TX
|
// TX
|
||||||
for (i = 0; i < BT_DRIVER_TXCOVERAGE; i++) {
|
for (i = 0; i < BT_DRIVER_TXCOVERAGE; i++) {
|
||||||
if (i == BT_COMMAND)
|
if (i == BT_COMMAND)
|
||||||
@@ -578,14 +594,9 @@ device_free (void *cookie)
|
|||||||
|
|
||||||
debugf("device_free() called on %s \n",BLUETOOTH_DEVICE_PATH);
|
debugf("device_free() called on %s \n",BLUETOOTH_DEVICE_PATH);
|
||||||
|
|
||||||
|
if (!bdev->connected) {
|
||||||
if (--bdev->open_count == 0) {
|
flowf("Device not present can be killed\n");
|
||||||
|
kill_device(bdev);
|
||||||
/* GotoLowPower */
|
|
||||||
// interesting .....
|
|
||||||
} else {
|
|
||||||
/* The last client has closed, and the device is no longer
|
|
||||||
connected, so remove it from the list. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|||||||
@@ -164,12 +164,12 @@ event_complete(void* cookie, status_t status, void* data, size_t actual_len)
|
|||||||
//bt_usb_dev* bdev = fetch_device(cookie, 0); -> safer/slower option
|
//bt_usb_dev* bdev = fetch_device(cookie, 0); -> safer/slower option
|
||||||
status_t error;
|
status_t error;
|
||||||
|
|
||||||
debugf("cookie@%p status=%ld len=%ld\n", cookie, status, actual_len);
|
debugf("cookie@%p status=%s len=%ld\n", cookie, strerror(status), actual_len);
|
||||||
|
|
||||||
if (bdev == NULL)
|
if (bdev == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status == B_CANCELED) // or not running anymore...
|
if (status == B_CANCELED || status == B_DEV_CRC_ERROR) // or not running anymore...
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status != B_OK || actual_len == 0)
|
if (status != B_OK || actual_len == 0)
|
||||||
@@ -210,7 +210,7 @@ acl_rx_complete(void* cookie, status_t status, void* data, size_t actual_len)
|
|||||||
if (bdev == NULL)
|
if (bdev == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status == B_CANCELED) // or not running anymore...
|
if (status == B_CANCELED || status == B_DEV_CRC_ERROR) // or not running anymore...
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (status != B_OK || actual_len == 0)
|
if (status != B_OK || actual_len == 0)
|
||||||
@@ -312,7 +312,7 @@ command_complete(void* cookie, status_t status, void* data, size_t actual_len)
|
|||||||
snet_buffer* snbuf = (snet_buffer*)cookie;
|
snet_buffer* snbuf = (snet_buffer*)cookie;
|
||||||
bt_usb_dev* bdev = snb_cookie(snbuf);
|
bt_usb_dev* bdev = snb_cookie(snbuf);
|
||||||
|
|
||||||
debugf("len = %ld @%p\n", actual_len, data);
|
debugf("status = %ld len = %ld @%p\n", status, actual_len, data);
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
bdev->stat.successfulTX++;
|
bdev->stat.successfulTX++;
|
||||||
@@ -379,7 +379,7 @@ submit_tx_command(bt_usb_dev* bdev, snet_buffer* snbuf)
|
|||||||
snb_set_cookie(snbuf, bdev);
|
snb_set_cookie(snbuf, bdev);
|
||||||
|
|
||||||
debugf("@%p\n", snb_get(snbuf));
|
debugf("@%p\n", snb_get(snbuf));
|
||||||
|
|
||||||
error = usb->queue_request(bdev->dev, bRequestType, bRequest,
|
error = usb->queue_request(bdev->dev, bRequestType, bRequest,
|
||||||
value, wIndex, wLength, snb_get(snbuf),
|
value, wIndex, wLength, snb_get(snbuf),
|
||||||
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
|
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
|||||||
Reference in New Issue
Block a user