Missing some keys for pt-BR layout

Issue #4 resolved
escobera
created an issue

Hello there,

I have somewhat of a clone of the azio l70 called KG-03 by C3Tech. Your driver worked miracles here. Problem is: this keyboard is sold in brazil and as such has a pt-BR layout.

Theres a picture here https://goo.gl/photos/Uxkma3hs7TmV4YVY7

Most of it is working, problem lies in ']}' and '?/" as well as the '.' on the numpad. This last one I can live without, but being a programer makes me need the other 2.

@Colin Svingen, Maybe I can help here, if you provide me a little guidance as to where should I look/change. My C skills are not good enough to figure that out on my own =/

Comments (21)

  1. escobera reporter

    For reference

    SLASH

    Sep 13 22:59:50 FatesWarning kernel: [  116.663705] Keydown keycode: 6 0 0 0 128 0 0 0 
    Sep 13 22:59:50 FatesWarning kernel: [  116.775869] Keydown keycode: 6 0 0 0 0 0 0 0
    

    BRACKET

    Sep 13 23:00:24 FatesWarning kernel: [  150.769814] Keydown keycode: 5 4 0 0 0 0 0 0 
    Sep 13 23:00:24 FatesWarning kernel: [  150.833919] Keydown keycode: 5 0 0 0 0 0 0 0 
    
  2. Colin Svingen repo owner

    I put the keycodes in the wrong places initially. You might be able to figure out the placement yourself.

    The blocks in az_kbd_keycode are marked with 4, 5 and 6 which correspond to the first digit. Then positions 2 to 8 correspond to the rows in the block (the first row isn't used). The value in the position with the non-zero number corresponds to the column in the row. It moves by base 2, so columns are actually 1, 2, 4, 8, 16, 32, 64, 128.

    For example: 5 4 0 0 0 0 0 0. This would be the 5 block (starts with 5), 2nd row (4 is found in the second position), 3rd column (4 corresponds to the 3rd column). For example: 6 0 0 0 128 0 0 0. This would be the 6 block, 5th row, 8th column.

  3. escobera reporter

    @Colin Svingen I think we're almost there. The keystrokes are being recognized, but the results are different.

    SLASH becomes SEMICOLON and RIGHTBRACE becomes LEFTBRACE

    I tested on XINPUT and they are sending the same keycode.

    on xinput

    LEFTBRACE and RIGHTBRACE

    key press   35 
    key release 35
    key press   35 
    key release 35
    

    and

    SLASH and SEMICOLON

    key release 61 
    key press   61 
    key release 61 
    key press   61 
    

    I tried to debug by printk before input_report_key method but each key shows dozens of codes, didn't know which was the right one.

  4. Colin Svingen repo owner

    @escobera I've been quite busy recently, but I should be able help you now. Are these the new keys I added, or were these keys working before and now they're sending the wrong code? All I changed was

    -/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_RESERVED, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT,   
    +/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_RIGHTBRACE, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, 
    

    and

    -/* 224-231 */   KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
    +/* 224-231 */   KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_SLASH,  
    

    I don't understand why right brace would become left! Maybe play around with those keycodes and see if you can get something working.

  5. escobera reporter

    @Colin Svingen The keys were not working before your change, now they are mirroring other keys. I'll try changing those key codes around and report back with my findings.

    Sorry if my description was faulty, english is not my main language.

  6. escobera reporter

    Got it working!!!

    Don't think this is the right way tough =/

    The keycodes constant names don't reflect the keys that are emitted. This were the changes I made.

    -/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_RIGHTBRACE, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT,   
    +/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, 
    
    -/* 224-231 */   KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_SLASH,  
    +/* 224-231 */   KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RO,
    
  7. Colin Svingen repo owner

    I'm glad you got it working. Yeah, technically this probably isn't the right way. This solution would likely mean that the en-US layout no longer works correctly. The key codes should be constant and the layout should re-write them properly. However, I'm not well versed in how the layouts manipulate the scancodes. I'm going to mark this as closed.

  8. Federico Marcos

    Hi! First of all I would like to say thank you for your great driver.

    I had the same problem, and solved changing (and rebooting pc)

    -/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_RIGHTBRACE, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT,   
    +/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, 
    

    (in my case my keyboard layout is spanish ES , the keyboard is a noga nkb380a)

    that fixed the right brace

    but I have the following issues:

    when I press that key (above the right shift, has the ç and right brace symbols) and (without releasing it) press other key like left bracket, tilde, comma, dot, and some others, the key is pressed and released several times.

    so for example if I press that key (by default it types the ç symbol) and then without releasing it I press and release the "-" minus key, I get the output: çç-ç so the ç key is registered 2 additional times

    what can I do to fix this?

    Also, my "stop" media key, is being registered as the "pause" key keycode=127 how can I change this?

    Thanks in advance!

    additional info: here's the xev output of that action (hold the ç key, press -, release -, release ç)

    KeyPress event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779643, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XmbLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    
    KeyRelease event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779755, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    
    KeyPress event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779755, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XmbLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    
    KeyPress event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779755, (987,318), root:(3251,495),
        state 0x10, keycode 61 (keysym 0x2d, minus), same_screen YES,
        XLookupString gives 1 bytes: (2d) "-"
        XmbLookupString gives 1 bytes: (2d) "-"
        XFilterEvent returns: False
    
    KeyRelease event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779835, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    
    KeyPress event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779835, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XmbLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    
    KeyRelease event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779835, (987,318), root:(3251,495),
        state 0x10, keycode 61 (keysym 0x2d, minus), same_screen YES,
        XLookupString gives 1 bytes: (2d) "-"
        XFilterEvent returns: False
    
    KeyRelease event, serial 37, synthetic NO, window 0x2e00001,
        root 0x272, subw 0x0, time 2779867, (987,318), root:(3251,495),
        state 0x10, keycode 51 (keysym 0xe7, ccedilla), same_screen YES,
        XLookupString gives 2 bytes: (c3 a7) "ç"
        XFilterEvent returns: False
    

    notice the ç key is showing as being released and pressed again in the middle of that process, which i'm not doing. (only at the beginning and end)

  9. Federico Marcos

    Hi, I just fixed that issue, leaving this here in case anyone else finds it. I changed KEY_BACKSLASH in the second column to KEY_RESERVED so, for ES keyboard layouts you need to change

    -/* 72-79 */    KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_RIGHTBRACE, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT,   
    +/* 72-79 */    KEY_RIGHTBRACE, KEY_RESERVED, KEY_BACKSLASH, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_GRAVE, KEY_COMMA, KEY_DOT, 
    

    to make it work. Thanks again for your driver!

  10. Log in to comment