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:
@@ -60,6 +60,13 @@ def test_surrounding_whitespace_is_ignored() -> None:
|
||||
assert parse_line(" 0000000000001781 00 BTN_1 Hauppauge \n") is not None
|
||||
|
||||
|
||||
def test_irservers_lowercase_button_names_are_uppercased() -> None:
|
||||
# Verbatim from irserver's lircd-compatible port on musicdolphin.
|
||||
event = parse_line("b7b2000000000000 00 key_play hauppauge\n")
|
||||
assert event is not None
|
||||
assert event.button == "KEY_PLAY"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- service
|
||||
|
||||
|
||||
@@ -195,6 +202,26 @@ async def test_events_from_another_remote_are_ignored(
|
||||
assert not any(isinstance(event, IntentEvent) for event in seen)
|
||||
|
||||
|
||||
async def test_irservers_lowercase_lines_are_acted_on(
|
||||
lircd: tuple[ScriptedLircd, asyncio.base_events.Server], sim: Simulation
|
||||
) -> None:
|
||||
station, server = lircd
|
||||
port = server.sockets[0].getsockname()[1]
|
||||
seen: list[Event] = []
|
||||
sim.bus.subscribe_all(seen.append)
|
||||
|
||||
# The config still says "Hauppauge" (the default); irserver says "hauppauge".
|
||||
task = await _run_service(sim, _lirc_config(port))
|
||||
try:
|
||||
await station.wait_connected()
|
||||
await station.send("b7b2000000000000 00 key_play hauppauge")
|
||||
await sim.bus.drain()
|
||||
finally:
|
||||
task.cancel()
|
||||
|
||||
assert [type(event) for event in seen if isinstance(event, IntentEvent)] == [PlayRequested]
|
||||
|
||||
|
||||
async def test_transport_buttons_only_act_on_the_first_press(
|
||||
lircd: tuple[ScriptedLircd, asyncio.base_events.Server], sim: Simulation
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user