Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

btle.py doesnt work after reboot #72

Closed
shailurie opened this issue Sep 16, 2015 · 5 comments
Closed

btle.py doesnt work after reboot #72

shailurie opened this issue Sep 16, 2015 · 5 comments

Comments

@shailurie
Copy link

I've installed bluez 5.30 (downloaded and built manually).
Then clone and build bluepy.
Then I ran python btle.py XX:YY:...... and it worked perfectly.

However after the first restart is doesnt work anymore.

Connecting to: C4:BE:84:76:F3:14, address type: public
Traceback (most recent call last):
File "btle.py", line 481, in
conn = Peripheral(devAddr, addrType)
File "btle.py", line 193, in init
self.connect(deviceAddr, addrType)
File "btle.py", line 321, in connect
rsp = self._getResp('stat')
File "btle.py", line 278, in _getResp
resp = Peripheral.parseResp(rv)
File "btle.py", line 241, in parseResp
(tag, tval) = item.split('=')
ValueError: need more than 1 value to unpack
Exception ValueError: 'need more than 1 value to unpack' in <bound method Peripheral.del of <main.Peripheral instance at 0x76aef4e0>> ignored

@shailurie
Copy link
Author

It seems like something in the one of the last changes caused the bluepy to stop working after restart.
the workaround which works for me is commenting out the mgmt_debug function (the one above the main function) and the call to the function (in main function).

@IanHarvey
Copy link
Owner

I can't reproduce your exact error, but I've spotted a problem in the debugging output which might be the cause. If you could let me know whether commit 693d455 fixes the problem that would be useful.

Thanks
Ian

@shailurie
Copy link
Author

Cannot compile it (error below) due to "Warnings as errors".
However I can tell you this fix will work because by "disabling" DBG, you "disable" mgmt_debug (which now do nothing) and by that, get a similar code to my workaround above (my 2nd comment).

I wouldn't recommend it as it disables all logs.

Bottom line: comment out line 1398 (DBG in mgmt_debug) and the one above it(to prevent :unused variable 'prefix'), and you're good


Compilation error:
bluepy-helper.c: In function ‘cmd_pair’:
bluepy-helper.c:1180:7: error: unused variable ‘addr’ [-Werror=unused-variable]
bluepy-helper.c: In function ‘cmd_unpair’:
bluepy-helper.c:1230:7: error: unused variable ‘addr’ [-Werror=unused-variable]
bluepy-helper.c: In function ‘mgmt_debug’:
bluepy-helper.c:1396:14: error: unused variable ‘prefix’ [-Werror=unused-variabl
On Sep 24, 2015 2:55 AM, "Ian Harvey" notifications@github.com wrote:

I can't reproduce your exact error, but I've spotted a problem in the
debugging output which might be the cause. If you could let me know whether
commit 693d455
693d455
fixes the problem that would be useful.

Thanks
Ian


Reply to this email directly or view it on GitHub
#72 (comment).

@IanHarvey
Copy link
Owner

The "unused variable" warnings should have been fixed in commit 4611544. I found another possible problem with the debugging output, which was fixed in 79adf50.

Let me know if you still have problems.

Thanks,
Ian

@shailurie
Copy link
Author

As mentioned before, you can comment out the content of mgmt_debug and keep
the debugging. I checked it and it works.
Which bluez version should I use with it? (5.29 - 5.35)

On Wed, Sep 30, 2015 at 2:48 PM, Ian Harvey notifications@github.com
wrote:

The "unused variable" warnings should have been fixed in commit 4611544
4611544.
I found another possible problem with the debugging output, which was fixed
in 79adf50
79adf50
.

Let me know if you still have problems.

Thanks,
Ian


Reply to this email directly or view it on GitHub
#72 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants