From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: To: linux-bluetooth@vger.kernel.org From: Joe Glancy Subject: DBUS API error "Not paired" when attempting to read GATT characteristic Message-ID: <5728C5DA.7000703@gmail.com> Date: Tue, 3 May 2016 16:38:02 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hello all. I was wondering whether someone could possibly help shine some light on an issue I'm having. Here's the setup: - Ubuntu 16.04 w/Bluez 5.37 (from the official repos, experimental mode enabled) - BBC micro:bit - "hciconfig -a hci0": hci0: Type: BR/EDR Bus: USB BD Address: XX:XX:XX:XX:XX:XX ACL MTU: 1022:8 SCO MTU: 183:5 UP RUNNING PSCAN RX bytes:718 acl:0 sco:0 events:54 errors:0 TX bytes:3731 acl:0 sco:0 commands:54 errors:0 Features: 0xff 0xfe 0x0d 0xfe 0xd8 0x7f 0x7b 0x8f Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF Link mode: SLAVE ACCEPT Name: 'Io' Class: 0x4c010c Service Classes: Rendering, Capturing, Telephony Device Class: Computer, Laptop HCI Version: 4.1 (0x7) Revision: 0x3101 LMP Version: 4.1 (0x7) Subversion: 0x1 Manufacturer: Atheros Communications, Inc. (69) What I am trying to do: - Read some bytes from a characteristic on the micro:bit through BlueZ's DBUS API using a Python script and the dbus module The error I am getting: - "org.bluez.Error.NotPermitted: Not paired" I have paired the micro:bit both from the normal Ubuntu Bluetooth settings menu, and I have also paired it with the bluetoothctl tool, each on separate occasions. Both reported that the pair was successful (no pin was required however, compared to when I pair the micro:bit to my phone I do need the pin), however when I tried running my script (which does not check whether the device is paired or connected: this is performed by the user, and I can verify that both the Ubuntu settings and bluetoothctl reported it as both paired and connected), I get the afore mentioned error ("org.bluez.Error.NotPermitted: Not paired"). Is this, therefore, an error with my program (I have spent hours checking it and cannot find any errors)? Or a possible bug with BlueZ? There are very few resources online for this kind of thing so I ended up resorting to the Bluetooth mailing list - please notify me if this is the wrong kind of stuff to be asking. The micro:bit is the only LE device which has ever connected to this (laptop) computer, and the characteristic (and its service) which I am reading from do both exist as DBUS objects. My grasp of the DBUS system is rather rudimentary, and so far has just been gained from BlueZ examples. I have checked using the DBUS API to make sure that the device is both paired and connected - both said yes, but, as previously said I get an error (more specifically, an exception is thrown when I try to call ".ReadValue()"). Is this my doing, or an issue with something out of my control? Any help will be appreciated :)