Creating an application to send custom commands to the Bluetooth chip on an AOSP build

62 views
Skip to first unread message

Tijo Thomas John

unread,
Mar 19, 2018, 3:10:33 PM3/19/18
to android-porting
Hi,

I am trying to create an application (c/cpp) that would allow me to send custom commands to the CSR8510 Bluetooth chip on my development board. I was able to find out from the bluedroid source that the function being used to perform such actions is btu_hcif_send_cmd and that this function is available in the bluetooth.default.so library. I tried linking the bluetooth.default.so library to my application which was using btu_hcif_send_cmd and osi_malloc functions. The code snippet I used is below.


    uint8_t controllerID = LOCAL_BR_EDR_CONTROLLER_ID;
    size_t cmdSize = HCI_CMD_BUF_SIZE;

    cmdPacket = (BT_HDR*)osi_malloc(cmdSize);
     
    cmdPacket->event = 0;
    cmdPacket->offset = 0;
    cmdPacket->layer_specific = 0;
    cmdPacket->len = HCIC_PREAMBLE_SIZE; /*! RESET Command doesn't have any parameters */
    cmdStream = cmdPacket->data;
      
     UINT16_TO_STREAM(cmdStream, HCI_RESET);
     UINT8_TO_STREAM(cmdStream, 0);  /*! RESET Command doesn't have any parameters */     
          btu_hcif_send_cmd(controllerID, cmdPacket);


However, I keep getting the following undefined reference errors when trying to compile the application within the AOSP build.

error: undefined reference to 'osi_malloc(unsigned int)'
error
: undefined reference to 'btu_hcif_send_cmd(unsigned char, BT_HDR*)'

Could someone please tell me if I am doing this right and if not, how to do what I want to achieve properly?


Regards,
Tijo
Reply all
Reply to author
Forward
0 new messages