flagist0/pypavlok

Pavlok disconnecting

Opened this issue · 5 comments

I've been able to establish a connection with the pavlok using the gatttool, however once I attempt running primary (or any command):

[][LE]> primary

it disconnects with

Command Failed: Disconnected

Hello Jay!
Do you get any warnings from gatttool?
If you get error like GLib-WARNING: Invalid file descriptor, remove directory /var/lib/bluetooth/<your_bluetooth_adapter_mac> and restart bluetooth service.

Hey Alexander,
No errors, just the notification that I've been disconnected.
https://imgur.com/BfK3fHa

I've looked it up, and the only thing I could find were a few posts related to raspberry pi's.

Well, there are many things to check:

  • Run your script with sudo
  • Try to restart Pavlok pressing zap button for about 15 seconds
  • Try to connect by tablet app if you can
  • Remove /var/lib/bluetooth/ and restart bluetooth
  • Sniff bluetooth traffic with hcidump
  • Check /var/log/messages
  • Check if you have the freshest bluez version

PS: you have nice awesome theme :)

Ran through all of your tips:

Run your script with sudo 
Try to restart Pavlok pressing zap button for about 15 seconds 
Remove /var/lib/bluetooth/ and restart bluetooth 
Check /var/log/messages 

None of the above seemed to have an effect, and var/log/messages had no hits when grepping 'blue'

Check if you have the freshest bluez version 

Running 5.23-2+b1, there is a newer experimental version ---> 5.36-1 Should I try this one?

 Try to connect by tablet app if you can

Don't have a tablet and I'm not sure which app you referred too?

This one might have revealed something however:

Sniff bluetooth traffic with hcidump

https://imgur.com/oCkYRbU

It appears from the dump that shortly after a connection it disconnects due to an authentication failure.

And yeah I love Awesome Window Manager, I believe this is just the standard dark theme that comes with it now. I really dig the dark look, default Terminology (Terminal) settings, and I've got my iceweasel set up with the nightlaunch skin and installed the Styles extension to convert all my important websites to a darker theme also, keeps everything looking the same across the system. (LOL yeah, I waste way too much time tweaking out my setup)

Sorry for delay, was too busy with work.

There are two variants:

  1. Try calling gatttool with security level option (-l medium). With PyPavlok it can be done by passing keyword argument security_level='medium' into constructor (not necessary for this case, but another option debug=True can be beneficial in such cases).
  2. I cannot tell exactly, but as far as I know they added pairing to Pavlok in some newer versions of firmware. I have quite standard firmware version (.28) where you can just send commands without pairing.
    If you got some newer version, it will take some time until I find out how pairing is done and how to update firmware in Pavlok.