Code & text output cleaning
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24317 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -64,18 +64,6 @@ BPortNot::loop()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (int i=0 ; i<ssize ; i++ ) {
|
|
||||||
printf("%x:",((uint8*)hdr)[i]);
|
|
||||||
}
|
|
||||||
printf("$\n");
|
|
||||||
|
|
||||||
for (int i=0 ; i<ssize ; i++) {
|
|
||||||
printf("%c",((uint8*)hdr)[i]);
|
|
||||||
}
|
|
||||||
printf("$\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ld = ourapp->LocateLocalDeviceImpl(GET_PORTCODE_HID(code));
|
ld = ourapp->LocateLocalDeviceImpl(GET_PORTCODE_HID(code));
|
||||||
if (ld == NULL) {
|
if (ld == NULL) {
|
||||||
Output::Instance()->Post("LocalDevice could not be fetched", BLACKBOARD_EVENTS);
|
Output::Instance()->Post("LocalDevice could not be fetched", BLACKBOARD_EVENTS);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ void BluetoothServer::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
/* Handle if the bluetooth preferences is running */
|
/* Handle if the bluetooth preferences is running?? */
|
||||||
case B_SOME_APP_LAUNCHED:
|
case B_SOME_APP_LAUNCHED:
|
||||||
{
|
{
|
||||||
const char *signature;
|
const char *signature;
|
||||||
@@ -178,7 +178,8 @@ void BluetoothServer::MessageReceived(BMessage *message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Can we reply right now? */
|
// Can we reply right now?
|
||||||
|
// TOD: review this condition
|
||||||
if (status != B_WOULD_BLOCK) {
|
if (status != B_WOULD_BLOCK) {
|
||||||
reply.AddInt32("status", status);
|
reply.AddInt32("status", status);
|
||||||
message->SendReply(&reply);
|
message->SendReply(&reply);
|
||||||
@@ -391,50 +392,6 @@ BluetoothServer::sdp_server_Thread(void* data)
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
void BluetoothServer::DevicesWatching(void) {
|
|
||||||
|
|
||||||
BDirectory* hdoses;
|
|
||||||
BEntry entrada;
|
|
||||||
BPath path;
|
|
||||||
|
|
||||||
//status_t err;
|
|
||||||
int fd1 = -1;
|
|
||||||
|
|
||||||
// only cheks the actual driver which we have
|
|
||||||
hdoses = new BDirectory("/dev/bus/bluetooth/h2/");
|
|
||||||
// hdoses = new BDirectory("/dev/bus/bluetooth/h3/...");
|
|
||||||
// hdoses = new BDirectory("/dev/bus/bluetooth/h4/...");
|
|
||||||
Output::Instance()->Post("Exploring present devices ...\n",1);
|
|
||||||
|
|
||||||
while (hdoses->GetNextEntry(&entrada,true) == B_OK) {
|
|
||||||
Output::Instance()->Post((char*)path.Path(), 1);
|
|
||||||
entrada.GetPath(&path);
|
|
||||||
if (entrada.IsDirectory()) {
|
|
||||||
Output::Instance()->Post((char*)path.Path(),1);
|
|
||||||
BDirectory* driver_directory = new BDirectory(path.Path());
|
|
||||||
BEntry driver_entry;
|
|
||||||
|
|
||||||
syslog(LOG_ALERT, "Bluetooth driver %s\n",path.Path());
|
|
||||||
fprintf(stderr, "Bluetooth driver %s\n",path.Path());
|
|
||||||
|
|
||||||
while (driver_directory->GetNextEntry(&driver_entry,true) == B_OK) {
|
|
||||||
Output::Instance()->Post((char*)path.Path(),1);
|
|
||||||
driver_entry.GetPath(&path);
|
|
||||||
fd1 = open(path.Path(), O_RDWR);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Watching all folders under and set some kind of internal structure that hold all
|
|
||||||
// LocalDevices.
|
|
||||||
// devloop = new DeviceLooper();
|
|
||||||
// devloop->StartMonitoringDevice("bus/bluetooth/h2");
|
|
||||||
|
|
||||||
if (fd1 < 0) {
|
|
||||||
syslog(LOG_ALERT,BT "Error opening device %s\n",path.Path());
|
|
||||||
fprintf(stderr, "Error opening device %s\n",path.Path());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
struct {
|
struct {
|
||||||
size_t size;
|
size_t size;
|
||||||
struct hci_command_header header;
|
struct hci_command_header header;
|
||||||
@@ -468,7 +425,7 @@ void BluetoothServer::DevicesWatching(void) {
|
|||||||
cm1.header.clen = 0;
|
cm1.header.clen = 0;
|
||||||
ioctl(fd1, ISSUE_BT_COMMAND, &cm1, sizeof(cm1));
|
ioctl(fd1, ISSUE_BT_COMMAND, &cm1, sizeof(cm1));
|
||||||
|
|
||||||
/*cm1.size = sizeof(struct hci_command_header);
|
cm1.size = sizeof(struct hci_command_header);
|
||||||
cm1.header.opcode = B_HOST_TO_LENDIAN_INT16(hci_opcode_pack(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME));
|
cm1.header.opcode = B_HOST_TO_LENDIAN_INT16(hci_opcode_pack(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME));
|
||||||
cm1.header.clen = 0;
|
cm1.header.clen = 0;
|
||||||
ioctl(fd1, ISSUE_BT_COMMAND, &cm1, sizeof(cm1));
|
ioctl(fd1, ISSUE_BT_COMMAND, &cm1, sizeof(cm1));
|
||||||
@@ -487,6 +444,7 @@ void BluetoothServer::DevicesWatching(void) {
|
|||||||
cm2.body.num_rsp = 8;
|
cm2.body.num_rsp = 8;
|
||||||
cm2.header.clen = 5;
|
cm2.header.clen = 5;
|
||||||
ioctl(fd1, ISSUE_BT_COMMAND, &cm2, sizeof(cm1));
|
ioctl(fd1, ISSUE_BT_COMMAND, &cm2, sizeof(cm1));
|
||||||
|
|
||||||
snooze(60*1000*1000);*/
|
snooze(60*1000*1000);*/
|
||||||
cm3.size = sizeof(struct hci_command_header)+sizeof(struct hci_remote_name_request);
|
cm3.size = sizeof(struct hci_command_header)+sizeof(struct hci_remote_name_request);
|
||||||
cm3.header.opcode = B_HOST_TO_LENDIAN_INT16(hci_opcode_pack(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST));
|
cm3.header.opcode = B_HOST_TO_LENDIAN_INT16(hci_opcode_pack(OGF_LINK_CONTROL, OCF_REMOTE_NAME_REQUEST));
|
||||||
@@ -518,14 +476,7 @@ void BluetoothServer::DevicesWatching(void) {
|
|||||||
ioctl(fd1, ISSUE_BT_COMMAND, &cm4, sizeof(cm4));
|
ioctl(fd1, ISSUE_BT_COMMAND, &cm4, sizeof(cm4));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
syslog(LOG_ALERT,BT "All devices registered\n");
|
|
||||||
fprintf(stderr, "Waiting with opened devices\n");
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -47,7 +47,11 @@ inline void* buildCommand(uint8 ogf, uint8 ocf, void** param, size_t psize, size
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* CONTROL BASEBAND */
|
#if 0
|
||||||
|
#pragma mark - CONTROL BASEBAND -
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void* buildReset(size_t* outsize)
|
void* buildReset(size_t* outsize)
|
||||||
{
|
{
|
||||||
return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET, NULL, 0, outsize);
|
return buildCommand(OGF_CONTROL_BASEBAND, OCF_RESET, NULL, 0, outsize);
|
||||||
@@ -60,7 +64,11 @@ void* buildReadLocalName(size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* LINK CONTROL */
|
#if 0
|
||||||
|
#pragma mark - LINK CONTROL -
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void* buildRemoteNameRequest(bdaddr_t bdaddr,uint8 pscan_rep_mode, uint16 clock_offset, size_t* outsize)
|
void* buildRemoteNameRequest(bdaddr_t bdaddr,uint8 pscan_rep_mode, uint16 clock_offset, size_t* outsize)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -96,7 +104,11 @@ void* buildInquiry(uint32 lap, uint8 length, uint8 num_rsp, size_t* outsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* OGF_INFORMATIONAL_PARAM */
|
#if 0
|
||||||
|
#pragma mark - INFORMATIONAL_PARAM -
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void* buildReadBufferSize(size_t* outsize)
|
void* buildReadBufferSize(size_t* outsize)
|
||||||
{
|
{
|
||||||
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE, NULL, 0, outsize);
|
return buildCommand(OGF_INFORMATIONAL_PARAM, OCF_READ_BUFFER_SIZE, NULL, 0, outsize);
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "HCIControllerAccessor.h"
|
#include "HCIControllerAccessor.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
/* */
|
/*
|
||||||
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _HCICONTROLLER_ACCESSOR_H_
|
#ifndef _HCICONTROLLER_ACCESSOR_H_
|
||||||
#define _HCICONTROLLER_ACCESSOR_H_
|
#define _HCICONTROLLER_ACCESSOR_H_
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _HCIDELEGATE_H_
|
#ifndef _HCIDELEGATE_H_
|
||||||
#define _HCIDELEGATE_H_
|
#define _HCIDELEGATE_H_
|
||||||
|
|
||||||
@@ -20,14 +27,13 @@ class HCIDelegate {
|
|||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
fFD = open (path->Path(), O_RDWR);
|
fFD = open (path->Path(), O_RDWR);
|
||||||
printf("## fdesc %d\n", fFD);
|
|
||||||
if (fFD > 0) {
|
if (fFD > 0) {
|
||||||
// find out which ID was assigned
|
// find out which ID was assigned
|
||||||
status = ioctl(fFD, GET_HCI_ID, &fHID, 0);
|
status = ioctl(fFD, GET_HCI_ID, &fHID, 0);
|
||||||
printf("## id fdesc %ld ### %ld\n", fHID, status);
|
printf("%s: hid retrieved %ld status=%ld\n", __FUNCTION__, fHID, status);
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
printf("%s: Device driver could not be opened %ld\n", __FUNCTION__, fHID);
|
||||||
fHID = B_ERROR;
|
fHID = B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
@@ -17,11 +24,11 @@ HCITransportAccessor::IssueCommand(raw_command rc, size_t size)
|
|||||||
if (GetID() < 0 || fFD < 0)
|
if (GetID() < 0 || fFD < 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
printf("Command going: len = %d\n", size);
|
printf("### Command going: len = %ld\n", size);
|
||||||
for (int16 index = 0 ; index < size; index++ ) {
|
for (uint16 index = 0 ; index < size; index++ ) {
|
||||||
printf("%x:",((uint8*)rc)[index]);
|
printf("%x:",((uint8*)rc)[index]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("### \n");
|
||||||
|
|
||||||
|
|
||||||
return ioctl(fFD, ISSUE_BT_COMMAND, rc, size);
|
return ioctl(fFD, ISSUE_BT_COMMAND, rc, size);
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
/* */
|
/*
|
||||||
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
||||||
|
*
|
||||||
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _HCITRANSPORT_ACCESSOR_H_
|
#ifndef _HCITRANSPORT_ACCESSOR_H_
|
||||||
#define _HCITRANSPORT_ACCESSOR_H_
|
#define _HCITRANSPORT_ACCESSOR_H_
|
||||||
|
|||||||
@@ -110,9 +110,10 @@ LocalDeviceHandler::ClearWantedEvent(BMessage* msg, uint16 event = 0, uint16 opc
|
|||||||
}
|
}
|
||||||
|
|
||||||
bail: */
|
bail: */
|
||||||
|
fEventsWanted.RemoveMessage(msg);
|
||||||
|
|
||||||
fEventsWanted.Unlock();
|
fEventsWanted.Unlock();
|
||||||
|
|
||||||
fEventsWanted.RemoveMessage(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,14 @@
|
|||||||
#include <bluetooth/bluetooth_error.h>
|
#include <bluetooth/bluetooth_error.h>
|
||||||
#include <bluetooth/HCI/btHCI_event.h>
|
#include <bluetooth/HCI/btHCI_event.h>
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#pragma mark - Class methods -
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Factory methods
|
// Factory methods
|
||||||
LocalDeviceImpl*
|
LocalDeviceImpl*
|
||||||
LocalDeviceImpl::CreateControllerAccessor(BPath* path)
|
LocalDeviceImpl::CreateControllerAccessor(BPath* path)
|
||||||
@@ -49,27 +54,33 @@ LocalDeviceImpl::LocalDeviceImpl(HCIDelegate* hd) : LocalDeviceHandler(hd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#pragma mark - Class methods -
|
#pragma mark - Event handling methods -
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalDeviceImpl::HandleEvent(struct hci_event_header* event)
|
LocalDeviceImpl::HandleEvent(struct hci_event_header* event)
|
||||||
{
|
{
|
||||||
// Check if it was a non requested events
|
|
||||||
|
printf("### Event comming: len = %d\n", event->elen);
|
||||||
|
for (int16 index = 0 ; index < event->elen + 2; index++ ) {
|
||||||
|
printf("%x:",((uint8*)event)[index]);
|
||||||
|
}
|
||||||
|
printf("### \n");
|
||||||
|
|
||||||
|
// Events here might have not been initated by us
|
||||||
switch (event->ecode) {
|
switch (event->ecode) {
|
||||||
case HCI_EVENT_HARDWARE_ERROR:
|
case HCI_EVENT_HARDWARE_ERROR:
|
||||||
//HardwareError(event);
|
//HardwareError(event);
|
||||||
return;
|
return;
|
||||||
|
case HCI_EVENT_CONN_REQUEST:
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// lets go on
|
// lets go on
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Event comming: len = %d\n", event->elen);
|
|
||||||
for (int16 index = 0 ; index < event->elen + 2; index++ ) {
|
|
||||||
printf("%x:",((uint8*)event)[index]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
|
|
||||||
BMessage* request = NULL;
|
BMessage* request = NULL;
|
||||||
@@ -102,9 +113,6 @@ printf("\n");
|
|||||||
case HCI_EVENT_CONN_COMPLETE:
|
case HCI_EVENT_CONN_COMPLETE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_CONN_REQUEST:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -216,15 +224,9 @@ LocalDeviceImpl::CommandComplete(struct hci_ev_cmd_complete* event, BMessage* re
|
|||||||
// Handle command complete information
|
// Handle command complete information
|
||||||
request->FindInt16("opcodeExpected", 0 /*REVIEW!*/, &opcodeExpected);
|
request->FindInt16("opcodeExpected", 0 /*REVIEW!*/, &opcodeExpected);
|
||||||
|
|
||||||
printf("Command complete ...%p\n",event);
|
|
||||||
for (int16 index = 0 ; index < 10; index++ ) {
|
|
||||||
printf("%x:",((uint8*)event)[index]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
|
|
||||||
if (request->IsSourceWaiting() == false)
|
if (request->IsSourceWaiting() == false)
|
||||||
Output::Instance()->Post("nobody waiting\n", BLACKBOARD_KIT);
|
Output::Instance()->Post("Nobody waiting for the event\n", BLACKBOARD_KIT);
|
||||||
|
|
||||||
|
|
||||||
switch (opcodeExpected) {
|
switch (opcodeExpected) {
|
||||||
@@ -233,13 +235,6 @@ printf("\n");
|
|||||||
{
|
{
|
||||||
struct hci_rp_read_bd_addr* readbdaddr = (struct hci_rp_read_bd_addr*)(event+1);
|
struct hci_rp_read_bd_addr* readbdaddr = (struct hci_rp_read_bd_addr*)(event+1);
|
||||||
|
|
||||||
printf("read bdaddr ...%p\n", readbdaddr);
|
|
||||||
for (int16 index = 0 ; index < 10; index++ ) {
|
|
||||||
printf("%x:",((uint8*)readbdaddr)[index]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
|
|
||||||
if (readbdaddr->status == BT_OK) {
|
if (readbdaddr->status == BT_OK) {
|
||||||
|
|
||||||
|
|
||||||
@@ -266,12 +261,6 @@ printf("\n");
|
|||||||
{
|
{
|
||||||
struct hci_rp_read_local_name* readLocalName = (struct hci_rp_read_local_name*)(event+1);
|
struct hci_rp_read_local_name* readLocalName = (struct hci_rp_read_local_name*)(event+1);
|
||||||
|
|
||||||
printf("read bdaddr ...%p\n", readLocalName);
|
|
||||||
for (int16 index = 0 ; index < 10; index++ ) {
|
|
||||||
printf("%x:",((uint8*)readLocalName)[index]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
reply.AddInt8("status", readLocalName->status);
|
reply.AddInt8("status", readLocalName->status);
|
||||||
|
|
||||||
if (readLocalName->status == BT_OK) {
|
if (readLocalName->status == BT_OK) {
|
||||||
|
|||||||
Reference in New Issue
Block a user