disable poll ticking

It was necessary to periodically check if the peripherals are still
online -- suspend/resume may cause Solaar to (wrongfully) remember the
status of devices after a resume.

Now that is handled by the optional upower module -- the hard way -- by
restarting all listeners on resume.
This commit is contained in:
Daniel Pavel 2013-06-23 18:15:19 +02:00
parent d5374b9f51
commit cec892ce88
2 changed files with 5 additions and 3 deletions

View File

@ -102,11 +102,13 @@ class _ThreadedHandle(object):
# Ideally this should be rather long (10s ?), but the read is blocking
# and this means that when the thread is signalled to stop, it would take
# a while for it to acknowledge it.
_EVENT_READ_TIMEOUT = 0.5
# Forcibly closing the file handle on another thread does _not_ interrupt the
# read on Linux systems.
_EVENT_READ_TIMEOUT = 0.4 # in seconds
# After this many reads that did not produce a packet, call the tick() method.
# This only happens if tick_period is enabled (>0) for the Listener instance.
_IDLE_READS = (5 / 0.5) # wait at least 5 seconds between ticks
_IDLE_READS = 1 + int(5 // _EVENT_READ_TIMEOUT) # wait at least 5 seconds between ticks
class EventsListener(_threading.Thread):

View File

@ -47,7 +47,7 @@ class ReceiverListener(_listener.EventsListener):
def __init__(self, receiver, status_changed_callback):
super(ReceiverListener, self).__init__(receiver, self._notifications_handler)
# no reason to enable polling yet
self.tick_period = _POLL_TICK
# self.tick_period = _POLL_TICK
self._last_tick = 0
assert status_changed_callback