IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.6k stars 490 forks source link

Fix bug in readline handling if multiple lines available #355

Closed Daniel-Christian-CardinalPeak closed 4 years ago

Daniel-Christian-CardinalPeak commented 5 years ago

See https://github.com/IanHarvey/bluepy/issues/354

bluepy may read multiple lines from the helper, but readline only returns the first one. Subsequent calls to poll() will delay (and possibly return None) because there is no way to know that additional lines are ready to return.

This uses a very simple loop to queue an entry every time readline returns a line. The queue lets you easily check for ready lines, as well as supporting get() with a timeout.

csonsino commented 5 years ago

This PR fixes a bad behavior that I'm seeing where notifications come in delayed- I'm expecting 2 notifications but I only get 1. Then next time I'm expecting 2 notifications, I get the 1 previously missing one and 1 new one (the expected 2nd new one is now delayed until next time). +1 from me

axlthorell commented 4 years ago

How do I install this patch on a Hass.io system?