Skip to content

EventCodeIterator doesn't handle all keys #114

Description

@LunNova

EventCodeIterator skips some event codes. One example of this is the Thrustmaster Solaris Base, which has EV_KEY 300, 301, and 302 as keys.

evtest output:

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x44f product 0x422 version 0x111
Input device name: "Thrustmaster Solaris Base"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
... (snipped)
    Event code 298 (BTN_BASE5)
    Event code 299 (BTN_BASE6)
    Event code 300 (?)
    Event code 301 (?)
    Event code 302 (?)
    Event code 303 (BTN_DEAD)
    Event code 704 (BTN_TRIGGER_HAPPY1)
    Event code 705 (BTN_TRIGGER_HAPPY2)
... (snipped)

It's not possible to use EventCodeIterator to find these supported codes, which are mapped to real physical buttons.

If I try to store the supported event codes in a file to later create a virtual device to replay inputs I will inadvertently created a different device with missing event codes.

This is caused by int_to_ev_key returning None for unknown codes. It's possible to ignore the iterator and manually scan for these codes by constructing an EV_UNK that has type = 1 and code = 300 and passing that to has_event_code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions