IR remote: accept irserver's lowercase button and remote names
irserver (musicdolphin's IRTrans daemon) serves lircd's network protocol on port 8765, but sends "key_play hauppauge" where lircd sends "KEY_PLAY Hauppauge", so every press was dropped. Uppercase button names when parsing and compare the remote name case-insensitively. irserver also always reports repeat 00, so a held transport button is not debounced there; volume ramps as intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,15 @@ A line looks like::
|
||||
that is ``<code> <repeat, hex> <button name> <remote name>``. ``repeat`` is ``00`` for
|
||||
the first press and increments while the button is held - lircd has no separate
|
||||
key-up event, just repeats stopping.
|
||||
|
||||
irserver (the IRTrans daemon, which serves this protocol on its own port 8765) sends
|
||||
the same shape but lowercases the button and remote names and always reports repeat
|
||||
``00``::
|
||||
|
||||
b7b2000000000000 00 key_play hauppauge
|
||||
|
||||
Button names are therefore uppercased here, so the rest of the code sees lircd's
|
||||
spelling either way.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -34,4 +43,4 @@ def parse_line(line: str) -> LircButtonEvent | None:
|
||||
repeat = int(repeat_hex, 16)
|
||||
except ValueError:
|
||||
return None
|
||||
return LircButtonEvent(code=code, repeat=repeat, button=button, remote=remote)
|
||||
return LircButtonEvent(code=code, repeat=repeat, button=button.upper(), remote=remote)
|
||||
|
||||
@@ -99,7 +99,7 @@ class LircService:
|
||||
if not raw:
|
||||
return
|
||||
event = parse_line(raw.decode(errors="replace"))
|
||||
if event is None or event.remote != self.config.remote_name:
|
||||
if event is None or event.remote.casefold() != self.config.remote_name.casefold():
|
||||
continue
|
||||
self._handle(event)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user