[Haiku-commits] r31036 - in haiku/trunk: headers/os/bluetooth/HCI src/add-ons/kernel/drivers/bluetooth/h2/h2generic src/servers/bluetooth

oruizdorantes at BerliOS oruizdorantes at mail.berlios.de
Sat Jun 13 21:17:11 CEST 2009


Author: oruizdorantes
Date: 2009-06-13 21:17:10 +0200 (Sat, 13 Jun 2009)
New Revision: 31036
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=31036&view=rev

Modified:
   haiku/trunk/headers/os/bluetooth/HCI/btHCI_transport.h
   haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c
   haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c
   haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp
   haiku/trunk/src/servers/bluetooth/BluetoothServer.h
   haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp
Log:
- Long events were locking the bluetooth server, as events can be more than 256 counting with the header.
- Add debug more information in H2 driver and Command Status event
- Change name of port for posting events(former was too long)



Modified: haiku/trunk/headers/os/bluetooth/HCI/btHCI_transport.h
===================================================================
--- haiku/trunk/headers/os/bluetooth/HCI/btHCI_transport.h	2009-06-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/headers/os/bluetooth/HCI/btHCI_transport.h	2009-06-13 19:17:10 UTC (rev 31036)
@@ -75,7 +75,7 @@
 #define BT_IOCTLS_OFFSET 3000
 
 enum {
-	ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET,
+	ISSUE_BT_COMMAND = B_DEVICE_OP_CODES_END + BT_IOCTLS_OFFSET, //12999
 	GET_STATS,
 	GET_NOTIFICATION_PORT,
 	GET_HCI_ID,
@@ -89,7 +89,7 @@
 
 /*  Port drivers can use to send information (1 for all for
 	at moment refer to ioctl GET_NOTIFICATION_PORT)*/
-#define BT_USERLAND_PORT_NAME "bluetooth kernel-user Land"
+#define BT_USERLAND_PORT_NAME "Kernel-User Event"
 #define BLUETOOTH_CONNECTION_PORT "bluetooth connection port"
 #define BLUETOOTH_CONNECTION_SCHED_PORT "bluetooth con sched port"
 

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-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2transactions.c	2009-06-13 19:17:10 UTC (rev 31036)
@@ -164,6 +164,8 @@
 	//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);
+
 	if (bdev == NULL)
 		return;
 

Modified: haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c	2009-06-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c	2009-06-13 19:17:10 UTC (rev 31036)
@@ -14,7 +14,7 @@
 #include "h2transactions.h"
 #include "snet_buffer.h"
 
-//#define BT_DEBUG_THIS_MODULE
+#define BT_DEBUG_THIS_MODULE
 #include <btDebug.h>
 
 
@@ -93,14 +93,14 @@
 
     if (type == BT_EVENT) {
 		snet_buffer* snbuf = (snet_buffer*)buf;
-		flowf("to btDataCore\n");
 		btCoreData->PostEvent(bdev->ndev, snb_get(snbuf), (size_t)snb_size(snbuf));
 		snb_park(&bdev->snetBufferRecycleTrash, snbuf);
+		debugf("to btDataCore len=%d\n", snb_size(snbuf));
 	} else {
 		net_buffer* nbuf = (net_buffer*) buf;
   		/* No need to free the buffer at allocation is gonna be reused */
-  		flowf("to net_device\n");
 		btDevices->receive_data(bdev->ndev, &nbuf);
+		flowf("to net_device\n");
     }
 
     return err;

Modified: haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp
===================================================================
--- haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp	2009-06-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp	2009-06-13 19:17:10 UTC (rev 31036)
@@ -32,14 +32,16 @@
 {
 	// we only handle events
 	if (GET_PORTCODE_TYPE(code)!= BT_EVENT) {
-		Output::Instance()->Post("Wrong type frame code", BLACKBOARD_GENERAL);
+		Output::Instance()->Post("Wrong type frame code", BLACKBOARD_KIT);
 		return B_OK;
 	}
 	
 	// fetch the LocalDevice who belongs this event 	    
-    LocalDeviceImpl* lDeviceImplementation = ((BluetoothServer*)be_app)->LocateLocalDeviceImpl(GET_PORTCODE_HID(code));
+    LocalDeviceImpl* lDeviceImplementation = ((BluetoothServer*)be_app)->
+    	LocateLocalDeviceImpl(GET_PORTCODE_HID(code));
+    	
 	if (lDeviceImplementation == NULL) {
-		Output::Instance()->Post("LocalDevice could not be fetched", BLACKBOARD_GENERAL);
+		Output::Instance()->Post("LocalDevice could not be fetched", BLACKBOARD_KIT);
 		return B_OK;
 	}
 

Modified: haiku/trunk/src/servers/bluetooth/BluetoothServer.h
===================================================================
--- haiku/trunk/src/servers/bluetooth/BluetoothServer.h	2009-06-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/src/servers/bluetooth/BluetoothServer.h	2009-06-13 19:17:10 UTC (rev 31036)
@@ -1,10 +1,7 @@
 /*
  * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
- *
  * All rights reserved. Distributed under the terms of the MIT License.
- *
  */
-
 #ifndef _BLUETOOTH_SERVER_APP_H
 #define _BLUETOOTH_SERVER_APP_H
 
@@ -38,7 +35,10 @@
 #define BLACKBOARD_LD(X) (BLACKBOARD_END+X-HCI_DEVICE_INDEX_OFFSET)
 
 typedef BObjectList<LocalDeviceImpl> LocalDevicesList;
-typedef PortListener<struct hci_event_header> BluetoothPortListener;
+typedef PortListener<struct hci_event_header, 
+	HCI_MAX_EVENT_SIZE, // Event Body can hold max 255 + 2 header
+	24					// Some devices have sent chunks of 24 events(inquiry result)
+	> BluetoothPortListener;
 
 class BluetoothServer : public BApplication
 {

Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp
===================================================================
--- haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp	2009-06-13 17:06:58 UTC (rev 31035)
+++ haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp	2009-06-13 19:17:10 UTC (rev 31036)
@@ -481,8 +481,8 @@
 	// Handle command complete information
 	request->FindInt16("opcodeExpected", index, &opcodeExpected);
 
-	Output::Instance()->Postf(BLACKBOARD_LD(GetID()),"%s(%d) for %s\n",__FUNCTION__,
-		event->ncmd,GetCommand(opcodeExpected));
+	Output::Instance()->Postf(BLACKBOARD_LD(GetID()),"%s(%d) %x for %s\n",__FUNCTION__,
+		event->ncmd, event->status, GetCommand(event->opcode));
 
 	if (request->IsSourceWaiting() == false)
 		Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT);




More information about the Haiku-commits mailing list