dictee icon indicating copy to clipboard operation
dictee copied to clipboard

EXTRA_KEYBOARDS whitelist doesn't bypass EV_REL/EV_ABS exclusion — Logitech Craft keyboard not detected

Open Oranneg-debug opened this issue 5 months ago • 3 comments

Bug: EXTRA_KEYBOARDS whitelist doesn't bypass EV_REL/EV_ABS exclusion — Logitech Craft keyboard not detected

Summary

The DICTEE_PTT_EXTRA_DEVICES whitelist is meant to let users force-include keyboards that get filtered out by the auto-detection. However, the EV_REL/EV_ABS pointer-device check in find_keyboards_evdev() runs before the whitelist is consulted, so whitelisted keyboards that have EV_REL/EV_ABS capabilities (e.g. Logitech Craft with its Crown dial) are still rejected.

Hardware

  • Keyboard: Logitech Craft (wireless, USB receiver)
  • Issue: The Crown dial reports EV_REL (REL_X, REL_Y, REL_HWHEEL, etc.) and EV_ABS alongside 295 EV_KEY keys (full keyboard layout incl. KEY_A, KEY_SPACE, KEY_ENTER)

Symptoms

dictee-ptt crashes on every restart:

[ptt] backend: evdev (grab + uinput)
[ptt] aucun clavier détecté!

Push-to-talk is completely non-functional.

Root cause

In find_keyboards_evdev() (line ~191 of dictee-ptt):

if (EV_KEY in caps and len(caps.get(EV_KEY, [])) > 30
        and EV_REL not in caps and EV_ABS not in caps):   # ← Craft rejected here
    name = dev.name.lower()
    if name in EXCLUDE_KEYBOARDS:
        dev.close()
    elif any(x in name for x in EXTRA_KEYBOARDS):   # ← never reached for Craft
        devs.append(dev)

The EV_REL not in caps and EV_ABS not in caps condition rejects the Craft before the EXTRA_KEYBOARDS whitelist is checked. The whitelist is dead code for any device with pointer axes.

Expected behavior

Devices listed in DICTEE_PTT_EXTRA_DEVICES should bypass the EV_REL/EV_ABS exclusion — the user has explicitly whitelisted them, overriding the auto-detection's safety filter.

Suggested fix

Move the EXTRA_KEYBOARDS check before / outside the EV_REL/EV_ABS guard:

caps = dev.capabilities(verbose=False)
name = dev.name.lower()
is_extra = any(x in name for x in EXTRA_KEYBOARDS)

if is_extra and EV_KEY in caps and len(caps.get(EV_KEY, [])) > 30:
    devs.append(dev)
elif (EV_KEY in caps and len(caps.get(EV_KEY, [])) > 30
        and EV_REL not in caps and EV_ABS not in caps):
    if name in EXCLUDE_KEYBOARDS:
        dev.close()
    elif not any(x in name for x in ("virtual", "uinput", "dotool", "dictee-ptt")):
        devs.append(dev)
    else:
        dev.close()
else:
    dev.close()

Environment

  • dictee-cuda 1.3.6-2
  • Debian 13 (trixie)
  • KDE Plasma 6 (Wayland)
  • Kernel 6.12.94+deb13-amd64
  • Keyboard: Logitech Craft (via unifying receiver)

Workaround

Patching find_keyboards_evdev() as above + setting DICTEE_PTT_EXTRA_DEVICES="logitech craft" in ~/.config/dictee.conf fixes the issue. Push-to-talk works correctly after this.

The same fix should likely be applied to find_keyboards_raw() (the /proc/bus/input/devices fallback) for consistency.

Oranneg-debug avatar Jul 03 '26 11:07 Oranneg-debug

Hi @Oranneg-debug, thanks for the great analysis. The whitelist is indeed checked after the pointer-axes filter, so it could never rescue the Craft.

One heads-up about the patch you're running: it fixes detection, but the virtual keyboard dictee-ptt re-emits through only handles key events. So while the daemon is running, your Crown dial is most likely dead (its scroll events get silently dropped). Easy to miss if you don't use it much.

I pushed a fix that reorders the checks like you suggested, and also makes the re-emission device inherit everything the Craft can send, so the Crown keeps working. Could you test it on your hardware? It's a single file:

sudo cp /usr/bin/dictee-ptt /usr/bin/dictee-ptt.bak
sudo wget -O /usr/bin/dictee-ptt https://raw.githubusercontent.com/rcspam/dictee/fix/issue-23-extra-devices-pointer-axes/dictee-ptt.py
sudo chmod +x /usr/bin/dictee-ptt
systemctl --user restart dictee-ptt

Keep your DICTEE_PTT_EXTRA_DEVICES="logitech craft" line as it is. Three things to check: push-to-talk, normal typing, and the Crown while dictee is running.

As you know, if you need to roll back, you acn use the /usr/bin/dictee-ptt.bak file to replace /usr/bin/dictee-ptt .

If it works on your side I'll merge it for the next release. The Craft will also become selectable from the setup UI (Shortcuts tab, "Detect..." button) instead of showing up greyed out. Thanks again for the detailed report!

Thank you again

rcspam avatar Jul 04 '26 12:07 rcspam

1.3.7-rc4 is out as a pre-release with the whitelist fix: a keyboard listed in DICTEE_PTT_EXTRA_DEVICES, or ticked in the Detect dialog, is now grabbed even with the Crown dial's axes. If you can try it on the Craft:

curl -fsSL https://github.com/rcspam/dictee/releases/download/v1.3.7-rc4/install.sh | bash -s -- --version 1.3.7-rc4

rcspam avatar Oct 26 '26 15:10 rcspam

1.3.7 is out as the final release. The code is the same as rc4, only the version number changed. If you already run rc4, you don't need to do anything. Otherwise, to update:

curl -fsSL https://github.com/rcspam/dictee/releases/download/v1.3.7/install.sh | bash

If something still doesn't work for you, tell me here.

rcspam avatar Oct 27 '26 13:10 rcspam