KonradIT / goprowifihack

Unofficial GoPro WiFi API Documentation - HTTP GET requests for commands, status, livestreaming and media query.
Apache License 2.0
2.11k stars 338 forks source link

BLE RECONNECT not working - missing 4 Key values in /var/lib/bluetooth/${HCI_MAC}/${GOPRO_MAC}/info #239

Open habakuk1979 opened 3 years ago

habakuk1979 commented 3 years ago

@KonradIT

hey there back again! working on implementing BLE GoPro Controll in node red right now:

I do have the exact problem you mentioned here:

Make sure the negotiated pairing keys are stored in /var/lib/bluetooth/${HCI_MAC}/${GOPRO_MAC}/info - there should be 4 sections titled: RemoteSignatureKey, LocalSignatureKey, LongTermKey, SlaveLongTermKey. Without these, you technically didn't complete pairing and you would not be able to access the GoPro over BLE until you reset all connections on the GoPro to start the pairing process again.

Where do I find the negotiated paring keys?

habakuk1979 commented 3 years ago

ahh, got it!

one must Enable "LE-mode" of the "bluetooth.service" by adding the "--experimental" switch to the /lib/systemd/system/bluetooth.service

as mentioned in https://learn.adafruit.com/install-bluez-on-the-raspberry-pi/installation

then reset connections @ gopro and pair again

et voilá:

the keys are in the /var/lib/bluetooth/${HCI_MAC}/${GOPRO_MAC}/info!

habakuk1979 commented 3 years ago

@KonradIT

Bit still I cannot reconnect.

back to my old bug: bluetoothctl re-connects for like 1 second but the disconnects again.

cannot achieve stable BLE connection although there are all four keys in the info file AND ble (--experimental) enabled.

what am I doing wrong?

... only sometimes, let's say one out of 20 times, the connection seems to stay up.

if you do ls -l you find out, that the .../info file is root/root priviledged, only!

however, if I bluetoothctl as root I do have the same behaviour, unfortunately.

However, as you described exactly my problem/behaviour being linked to the .../info file I am convinced that I have to fiddle around with this file in order to knock out this issue!

I assume: 1.) still somewhat priviledge problem or 2.) another syntax problem of .../info - plz check: suspect: whats that missing EDIV= and Random= values in the [RemoteSignatureKey] and [LocalSignatureKey] section?


`root@odroid:/var/lib/bluetooth/00:1A:7D:DA:71:13/CE:E7:E6:72:FB:14# sudo nano info [General] Name=GoPro 8539 AddressType=static SupportedTechnologies=BR/EDR;LE; Trusted=true Blocked=false Appearance=0x0080

[RemoteSignatureKey] Key=046AB343E3CBC78B33905511ECBBC928 Counter=0 Authenticated=false

[LocalSignatureKey] Key=8B36D3725C2F37345CF7A536D5E15F39 Counter=0 Authenticated=false

[LongTermKey] Key=B2DA38F2A1FB7909120A98941448E556 Authenticated=0 EncSize=16 EDiv=30427 Rand=5260931391484837295

[SlaveLongTermKey] Key=F52CC4E004174D45E6316C45BB3B047A Authenticated=0 EncSize=16 EDiv=58474 Rand=1481036720455403246`


never mind about the cleartext pwds and keys - they gona be changend another 1000 times anyway :-)

habakuk1979 commented 3 years ago

@KonradIT Which platform in Linux (Flavour) and which kernel were you using doing your bluetooth connection attempts? (uname -a)

I am fairly old on: Ubuntu 18.04 kernel 3.16.85+

this has several reasins (wifi connectivity, cmake of other drivers, ...)

However, I'd appreciate your assinstance in this case please, if possible.

KonradIT commented 3 years ago

I've been using Arch Linux on a recent kernel and Raspbian OS with whatever kernel it ships with.

habakuk1979 commented 3 years ago

@KonradIT ok. do you have any other idea in terms of configuring BLE ("main.conf" or "/lib/systemd/system/bluetooth.service") which can knock out my connection - stability problem?