Hi,

I am relatively new to Android. I have to develop an FM application for
testing FM on Android. The FM chip is a combo chip (BT/FM) using HCI as
transport. I need to activate the Hciattach daemon when BT is switched off
and FM is to be switched on.

I use the same code as present in bluetooth.c for enabling the hciattach
daemon as below :
          property_set("ctl.start", "hciattach");
          /* Set the FM IP State to started*/
          // Try for 10 seconds, this can only succeed once hciattach has
sent the
          // firmware and then turned on hci device via HCIUARTSETPROTO
ioctl
          for (attempt = 1000; attempt > 0;  attempt--) {
              hci_sock =  socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
              if (hci_sock < 0) {
                    FM_DEBUG_REPORT("EnableHCI: Unable to open HCI
Socket!!!");
                    goto out;
              }

              if (!ioctl(hci_sock, HCIDEVUP, HCI_DEV_ID)) {
                  FM_DEBUG_REPORT("EnableHCI: HCI Device is up and
running");
                  break;
              }
              close(hci_sock);
              usleep(10000);  // 10 ms retry delay
          }
          if (attempt == 0) {
              FM_ERR_REPORT("EnableHCI:  Timeout waiting for HCI device to
come up");
              goto out;
          }

The problem is this code does not work when I try to launch my FM
application (radiofm.apk => libfm.so) This code is present in libfm.so.
I am unable to start hciattach daemon, and the socket call fails.

Interestingly if i build a command line application, which uses the same
function calls, the above code works fine. Can you let me know if I am
missing something, is it related to some permission that needs to be given
to the radiofm.apk to start the hciattach daemon ?

Help would be really appreciated since I am clueless and unable to proceed
because of this issue.

Best Regards
Hemant

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to