From ae736793e8d8f6fc83d20bcac1fb56409df8d8b9 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Wed, 16 Apr 2008 22:21:28 +0000 Subject: [PATCH] - Fix parsing of the inquiry replies. There is a first byte indicating the number responses which was ignored. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24993 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/bluetooth/BluetoothServer.cpp | 1 + src/servers/bluetooth/LocalDeviceImpl.cpp | 14 +++++++++----- src/servers/bluetooth/LocalDeviceImpl.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/servers/bluetooth/BluetoothServer.cpp b/src/servers/bluetooth/BluetoothServer.cpp index 1fa5d75a64..28854371fb 100644 --- a/src/servers/bluetooth/BluetoothServer.cpp +++ b/src/servers/bluetooth/BluetoothServer.cpp @@ -362,6 +362,7 @@ BluetoothServer::HandleSimpleRequest(BMessage* message, BMessage* reply) // we are gonna need issue the command ... if (ldi->ProcessSimpleRequest(DetachCurrentMessage()) == B_OK) +// if (ldi->ProcessSimpleRequest(message) == B_OK) return B_WOULD_BLOCK; else return B_ERROR; diff --git a/src/servers/bluetooth/LocalDeviceImpl.cpp b/src/servers/bluetooth/LocalDeviceImpl.cpp index 46ebe806e5..1870af9e9d 100644 --- a/src/servers/bluetooth/LocalDeviceImpl.cpp +++ b/src/servers/bluetooth/LocalDeviceImpl.cpp @@ -115,7 +115,7 @@ printf("### \n"); break; case HCI_EVENT_INQUIRY_RESULT: - InquiryResult((struct inquiry_info*)(event+1), request); + InquiryResult((uint8*)(event+1), request); break; case HCI_EVENT_CONN_COMPLETE: @@ -357,7 +357,7 @@ LocalDeviceImpl::CommandStatus(struct hci_ev_cmd_status* event, BMessage* reques Output::Instance()->Post("Negative reply for inquiry status\n", BLACKBOARD_KIT); } - printf("Sending reply ... %ld\n",request->SendReply(&reply)); + printf("Sending reply ... %ld\n", request->SendReply(&reply)); reply.PrintToStream(); ClearWantedEvent(request, HCI_EVENT_CMD_STATUS, PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); @@ -373,12 +373,14 @@ LocalDeviceImpl::CommandStatus(struct hci_ev_cmd_status* event, BMessage* reques void -LocalDeviceImpl::InquiryResult(struct inquiry_info* event, BMessage* request) +LocalDeviceImpl::InquiryResult(uint8* numberOfResponses, BMessage* request) { BMessage reply(BT_MSG_INQUIRY_DEVICE); + - reply.AddData("info", B_ANY_TYPE, &event, sizeof(struct inquiry_info)); + reply.AddData("info", B_ANY_TYPE, numberOfResponses+1 // skiping here the number of responses + , (*numberOfResponses) * sizeof(struct inquiry_info) ); printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); @@ -392,8 +394,10 @@ LocalDeviceImpl::InquiryComplete(uint8* status, BMessage* request) reply.AddInt8("status", *status); - printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); + printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); +// (request->ReturnAddress()).SendMessage(&reply); + ClearWantedEvent(request); } diff --git a/src/servers/bluetooth/LocalDeviceImpl.h b/src/servers/bluetooth/LocalDeviceImpl.h index 3778d9d2c1..5c8a2b4890 100644 --- a/src/servers/bluetooth/LocalDeviceImpl.h +++ b/src/servers/bluetooth/LocalDeviceImpl.h @@ -41,7 +41,7 @@ public: void CommandStatus(struct hci_ev_cmd_status* event, BMessage* request); // Inquiry - void InquiryResult(struct inquiry_info* event, BMessage* request); + void InquiryResult(uint8* numberOfResponses, BMessage* request); void InquiryComplete(uint8* status, BMessage* request); };