iosipadbluezbluetooth-lowenergyarchlinux-arm

Communication issues between Arch Linux and iPad


I'm running Arch Linux and the Bluez libraries on my computer, and I'm trying to connect to an iPad [w/ Retina] over BLE. I can see the iPad in bluetoothctl, pair it, trust it, and connect to it. My question is in two parts:

1) I want to be able to select the attributes, more specifically for the MAP service. However, running

list-attributes

either during or outside of the connection returns no information.

2) My iPad cannot see the computer like it can see the iPad, either through the Settings --> Bluetooth menu or the CBCentralManager in an app that I'm developing. My computer is set to be discoverable and pairable forever, but it just doesn't find it.

How would I be able to connect to the iPad appropriately, if there even is a way?


Solution

  • Disclaimer to anyone using BlueZ user space tools:

    OP mentioned in the comments that he utilized hcitool. It's best not to use hciconfig nor hcitool as these are in the process of being phased out of BlueZ and have been unmaintained for a very long time. They are prone to errors and the raw calls these programs make are blocking and cause interference with other Bluetooth applications.

    BlueZ publishes some methods in order for users to use its Bluetooth (LE) functionality for applications or tasks: DBus and a lower-level approach. Programs included in the BlueZ user space package include bluetoothctl, which uses DBus for bluetooth related tasks, such as scanning, advertising and GATT. Tools like btmgmt, which can be considered a maintained version of hcitool, use the lower level libraries. BlueZ recommends using the DBus API for applications. Be sure to have compiled the source code and have followed the recommended instructions to use the mentioned tools. Also always check the licensing on mentioned tools and source files as some can not be included in proprietary software.


    DBus-less solution:

    If using bluetoothctl or DBus doesn't work out for you, I would suggest you use btmgmt. It can be found in the /tools folder of the user space source code.

    If you're looking for or wanting to include GATT-related tasks, you can use btgatt-client to act as a GATT Client or btgatt-server to act as a GATT server from that same /tools folder. These do not use DBus, nor the corresponding Bluetooth Daemon (bluetoothd) like bluetoothctl does

    DBus solution:

    What is most likely the cause of you not seeing services using bluetoothctl, however, is that you are not running the aforementioned bluetooth daemon with the -E flag (experimental). Currently, all GATT-related functionality is only usable when running in this experimental mode. (They're working to get it out of experimental-only mode) I think because it's still being developed. If I recall correctly BlueZ can also be configured/installed in this experimental mode, so that no manual actions are required.

    To restart the BlueZ Daemon (bluetoothd) with GATT enabled run:

    sudo service bluetooth stop && bluetoothd -E

    In most cases, when stopping the bluetooth service, your bluetooth controller will power down and bluetoothctl won't respond to user input/freezes on startup. If this is indeed the case, use btmgmt and issue a power on to power the bluetooth controller again.