Merge pull request #382 from mchehab/fix_solaar_start_issues

Fix solaar start issues
This commit is contained in:
Peter Wu 2018-01-12 18:11:45 +01:00 committed by GitHub
commit 1a67b33860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 10 deletions

View File

@ -328,13 +328,19 @@ class KeysArray(object):
if self.keyversion == 1:
self.keys[index] = _ReprogrammableKeyInfo(index, ctrl_id_text, ctrl_task_text, flags)
if self.keyversion == 4:
mapped_data = feature_request(self.device, FEATURE.REPROG_CONTROLS_V4, 0x20, key&0xff00, key&0xff)
if mapped_data:
remap_key, remap_flag, remapped = _unpack('!HBH', mapped_data[:5])
# if key not mapped map it to itself for display
if remapped == 0:
remapped = key
remapped_text = special_keys.CONTROL[remapped]
try:
mapped_data = feature_request(self.device, FEATURE.REPROG_CONTROLS_V4, 0x20, key&0xff00, key&0xff)
if mapped_data:
remap_key, remap_flag, remapped = _unpack('!HBH', mapped_data[:5])
# if key not mapped map it to itself for display
if remapped == 0:
remapped = key
except Exception:
remapped = key
remap_key = key
remap_flag = 0
remapped_text = special_keys.CONTROL[remapped]
self.keys[index] = _ReprogrammableKeyInfoV4(index, ctrl_id_text, ctrl_task_text, flags, pos, group, gmask, remapped_text)
return self.keys[index]

View File

@ -222,7 +222,8 @@ class EventsListener(_threading.Thread):
if self._active: # and _threading.current_thread() == self:
# if _log.isEnabledFor(_DEBUG):
# _log.debug("queueing unhandled %s", n)
self._queued_notifications.put(n)
if not self._queued_notifications.full():
self._queued_notifications.put(n)
def __bool__(self):
return bool(self._active and self.receiver)

View File

@ -183,7 +183,9 @@ class ReceiverListener(_listener.EventsListener):
# a device notification
assert n.devnumber > 0 and n.devnumber <= self.receiver.max_devices
already_known = n.devnumber in self.receiver
if not already_known and n.sub_id == 0x41:
if n.sub_id == 0x41:
already_known = False
dev = self.receiver.register_new_device(n.devnumber, n)
else:
dev = self.receiver[n.devnumber]

View File

@ -35,7 +35,16 @@ try:
from gi.repository import Notify
# assumed to be working since the import succeeded
available = True
# available = True
# This is not working on Fedora 26. If fails with:
# ERROR [MainThread] solaar.ui.notify: showing <Notify.Notification object at 0x7f82c2484640 (NotifyNotification at 0x556fa0fc5a40)>
# File "./solaar/lib/solaar/ui/notify.py", line 145, in show
# n.show()
# Error: g-io-error-quark: Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached (24)
available = False
except (ValueError, ImportError):
available = False