You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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???).
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.
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...).
Activity
sezanzeb commentedon Jan 4, 2025
EV_KEYis the type of event. There is alsoEV_RELandEV_ABS. Events of theEV_KEYtype can have codes likeKEY_A,KEY_B, and so on.cjmayo commentedon Jan 6, 2025
Yes, so
KeyEvent.keycodehas the string representation likeKEY_A,KeyEvent.scancodeis the integer for the key code, not the scancode (maybe for an AT keyboard it happens to be the same number???).sezanzeb commentedon Jan 6, 2025
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.
cjmayo commentedon Jan 7, 2025
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 useKeyEvent.codewhich I think would have been less confusing for me. (But then it is a library and maybe people are already using scancode...).