- 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)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31036 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2009-06-13 19:17:10 +00:00
parent dc3d592369
commit a1163de83e
6 changed files with 18 additions and 14 deletions

View File

@ -75,7 +75,7 @@ typedef struct bt_hci_device {
#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 @@ enum {
/* 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"

View File

@ -164,6 +164,8 @@ event_complete(void* cookie, status_t status, void* data, size_t actual_len)
//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;

View File

@ -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 @@ post_packet_up(bt_usb_dev* bdev, bt_packet_t type, void* buf)
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;

View File

@ -32,14 +32,16 @@ DispatchEvent(struct hci_event_header* header, int32 code, size_t size)
{
// 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;
}

View File

@ -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 @@ typedef enum {
#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
{

View File

@ -481,8 +481,8 @@ LocalDeviceImpl::CommandStatus(struct hci_ev_cmd_status* event, BMessage* reques
// 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);