Change the MTU or Packet Size for Bluetooth in Android?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 21:08:40

问题


How can I change the MTU or Packet Size for Bluetooth in Android?! It is not possible in using Android's API, right? I believe I should change the native codes. How can I change it? And is it also possible to change the transmission rate, or it is hardware dependent? Thanks


回答1:


Yes, You are right - it is not possible in Android API. You can only get MTU value for an interface with networkInterface.getMTU() method.

Based on sources for the NetworkInterface class

public int getMTU() throws SocketException {
    return readIntFile("/sys/class/net/" + name + "/mtu");
}

You probably can change MTU value (for rooted devices) - You need to write new int MTU value to "/sys/class/net/" + networkInterface.getName() + "/mtu" file.

But I'm not sure if it is reliable solution for You.



来源:https://stackoverflow.com/questions/20579166/change-the-mtu-or-packet-size-for-bluetooth-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!