[Haiku-commits] r31053 - haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic
oruizdorantes at BerliOS
oruizdorantes at mail.berlios.de
Sun Jun 14 21:51:30 CEST 2009
Author: oruizdorantes
Date: 2009-06-14 21:51:29 +0200 (Sun, 14 Jun 2009)
New Revision: 31053
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31053&view=rev
Modified:
haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c
haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c
Log:
- 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
Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c 2009-06-14 17:16:08 UTC (rev 31052)
+++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c 2009-06-14 19:51:29 UTC (rev 31053)
@@ -374,23 +374,21 @@
flowf("Cancelling queues...\n");
if (bdev->intr_in_ep != NULL) {
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) {
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) {
usb->cancel_queued_transfers(bdev->bulk_out_ep->handle);
- flowf("Cancelling impossible ACL out\n");
+ flowf("Cancelling possible ACL out\n");
}
bdev->connected = false;
- // TODO: place this in the appropiated hook
- // kill_device(bdev);
return B_OK;
}
@@ -533,6 +531,24 @@
// 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
for (i = 0; i < BT_DRIVER_TXCOVERAGE; i++) {
if (i == BT_COMMAND)
@@ -578,14 +594,9 @@
debugf("device_free() called on %s \n",BLUETOOTH_DEVICE_PATH);
-
- if (--bdev->open_count == 0) {
-
- /* GotoLowPower */
- // interesting .....
- } else {
- /* The last client has closed, and the device is no longer
- connected, so remove it from the list. */
+ if (!bdev->connected) {
+ flowf("Device not present can be killed\n");
+ kill_device(bdev);
}
return err;
Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c 2009-06-14 17:16:08 UTC (rev 31052)
+++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c 2009-06-14 19:51:29 UTC (rev 31053)
@@ -164,12 +164,12 @@
//bt_usb_dev* bdev = fetch_device(cookie, 0); -> safer/slower option
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)
return;
- if (status == B_CANCELED) // or not running anymore...
+ if (status == B_CANCELED || status == B_DEV_CRC_ERROR) // or not running anymore...
return;
if (status != B_OK || actual_len == 0)
@@ -210,7 +210,7 @@
if (bdev == NULL)
return;
- if (status == B_CANCELED) // or not running anymore...
+ if (status == B_CANCELED || status == B_DEV_CRC_ERROR) // or not running anymore...
return;
if (status != B_OK || actual_len == 0)
@@ -312,7 +312,7 @@
snet_buffer* snbuf = (snet_buffer*)cookie;
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) {
bdev->stat.successfulTX++;
@@ -379,7 +379,7 @@
snb_set_cookie(snbuf, bdev);
debugf("@%p\n", snb_get(snbuf));
-
+
error = usb->queue_request(bdev->dev, bRequestType, bRequest,
value, wIndex, wLength, snb_get(snbuf),
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
More information about the Haiku-commits
mailing list