Android version: 2.3.7

Kernel version: 2.6.35-14-CyanogenMod-Arco-Kalim arco@tuxbox #1

Mod version: CyanogenMod-7.1.0.1-click

The device has been fully rooted.

I have added piece of code in my project

which taken from Bluez Utils in hidd.c.

The code is the following:

if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
    close(sk);
    return -1;
}

bind() keeps returning -1.

I added a line(DisablePlugins = input) to the bluetooth configuration in my Android device

/system/etc/bluetooth/main.conf

The information I have is: sk:37

(struct sockaddr *) &addr=0x44597e90

sizeof(addr)=12

errno:13

Reason: Permission Denied.

Can anyone help? If you need to know in more detail, feel free to let me know.

有帮助吗?

解决方案

sdp could be created by blueZ source code.

Therefore, you can create your own sdptool and then take advantage of this one to bind the socket. Surely, you have to chmod before you use it to gain ownership of that.

This approach works for me and hope this approach will be useful for you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top