Skip to content

KeyEvent.scancode is not a scancode? #226

Open

Description

@cjmayo

As far as I can understand EV_KEY code is a key code (mapped from the scancode, reported in an EV_MSC type MSC_SCAN value).

Activity

  1. sezanzeb commented on Jan 4, 2025

    @sezanzeb
    Collaborator

    EV_KEY is the type of event. There is also EV_REL and EV_ABS. Events of the EV_KEY type can have codes like KEY_A, KEY_B, and so on.

  2. cjmayo commented on Jan 6, 2025

    @cjmayo
    Author

    Yes, so KeyEvent.keycode has the string representation like KEY_A, KeyEvent.scancode is the integer for the key code, not the scancode (maybe for an AT keyboard it happens to be the same number???).

  3. sezanzeb commented on Jan 6, 2025

    @sezanzeb
    Collaborator

    Ah, I misunderstood your question (Maybe I should have also read the headline). Looking at the python code, KeyEvent.scancode is indeed the events code, like KEY_A. There is no mapping happening.

    I honestly never worked with EV_MSC events, so I would have to look definitions up to answer further questions.

  4. cjmayo commented on Jan 7, 2025

    @cjmayo
    Author

    I could have worded it better but I was trying not to sound too authoritative on something that had caused me confusion.

    Really I guess I was saying and so then... drop KeyEvent.scancode? It is still possible to use KeyEvent.code which I think would have been less confusing for me. (But then it is a library and maybe people are already using scancode...).

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