RE: Problem on HCI Command via Bluetooth Extension Layer

Tech-Archive recommends: Speed Up your PC by fixing your registry



It works!!!! thank you very much for your help. much appreciated !!!

"sea horse" wrote:

Because the HCI code have some problem.
When you call typedef int (*HCI_CustomCode_In) (HANDLE hDeviceContext,
void *pCallContext, unsigned short usOpCode, unsigned short cPacketSize,
unsigned char *pPacket, PacketMarker *pMarker, unsigned char cEvent);
the parameter(cEvent) you set what?
for example when you sent the HCI command (0xfc -- OCF) , you will return
the (0xff) event, so you must set the cEvent = 0xff, but MS Bt stack set:
#define HCI_NO_EVENT 0xff
so you have to change it in the bt_ddi.h
you can see the function
static void ProcessEvent (unsigned char *pBuffer, int cSize)
if the event code is not in the
enum HCI_EVENT_CODE {。。。}
it will come in the function UnknownEvent (cEventCode, cLength, pParms);
but it the function find the command packet in the (gpHCI->pPacketsPending)
eg. HCIPacket *pPacket = ExtractCommandPacketByEvent
(&gpHCI->pPacketsPending, cEventCode);
because it find fail the command packet, so when it call back your
HCI_CustomCodeEvent function. the pCallContext = NULL.

I change the ProcessEvent () function to support the CSR event. and
successful!

You can try it! good luck!



in HCI.cxx

if



"RichardMAN" wrote:

Dear All

I have create a HCI extension layer for issuing Vendor/Manufacturer specific
HCI commands, via HCI_CustomCode_In HCI interface callback, and I am able to
receive correct responses via HCI_CustomCodeEvent event.

However, any success HCI call will cause the extension later to receive
"STACK DOWN" indication, i.e. BT stack is down., within seconds right after
the corresponding HCI response is received.

Would anyone knows if there is anything I need to response to
HCI_CustomCodeEvent event callback?

One thing I noticed, is that for CallContext I pass into HCI_CustomCode_In,
I do not get the same CallContext pointer in HCI_CustomCodeEvent event
callback. In fact, HCI_CustomCodeEvent returns a NULL CallContext to me. And
there is UserContext HCI_CustomCodeEvent being returned, which I don't know
what it is, contain a non-NULL pointor.

typedef int (*HCI_CustomCode_In) (HANDLE hDeviceContext, void *pCallContext,
unsigned short usOpCode, unsigned short cPacketSize, unsigned char *pPacket,
PacketMarker *pMarker, unsigned char cEvent);

typedef int (*HCI_CustomCodeEvent) (void *pUserContext, void *pCallContext,
unsigned char cEventCode, unsigned char cEventLength, unsigned char *pEvent);

Before receiving STACK DOWN indication, I will also get a hci_AbortCall call
back. hci_AbortCall returns the same CallContext I passed into
HCI_CustomCode_In to me.

Can someone suggest where I should look at to tack down the reason why the
BT stack will goes down right after I send a vendor specific HCI command and
with success and correct HCI response?

Regards
RichardMAN
.



Relevant Pages

  • RE: Problem on HCI Command via Bluetooth Extension Layer
    ... Because the HCI code have some problem. ... unsigned char *pPacket, PacketMarker *pMarker, unsigned char cEvent); ...
    (microsoft.public.windowsce.embedded)
  • Re: "Sorting" assignment
    ... you think using memcpy a block at a time is not the best way to swap ... It was allocated on the stack. ... unsigned char *right = vright; ... memcpy(right, buf, BUF_LEN); ...
    (comp.programming)
  • x86: minor cleanup for ptrace_32/64
    ... * This routine assumes that all the privileged stacks are in our ... data space. ... unsigned char *stack; ... unsigned char * stack; ...
    (Linux-Kernel)
  • Re: Codewarrior / c problem?
    ... void display_string_still(const unsigned char *str0, ... The arrays are local in the function, so they are allocated on stack. ... Then it will be allocated somewhere in the RAM (but it is not local anymore ...
    (comp.arch.embedded)
  • Re: int main(void) { return main(); }
    ... int main ... is an infinite recursive loop. ... It will run until the stack blows ... unsigned char pop ...
    (comp.lang.c)