Skip to content

Arrow keys does not work in linux framebuffer #2309

Closed

Description

@pickfire

When I press an arrow key in linux framebuffer (Ctrl+Alt+F2), something like OA and OD will show up and it does not return to the previous command, left and right keys does not work too.

I want to use arrow keys, does anyone know how to fix that?

uname -a:

Linux alarmpi 4.1.5-1-ARCH #1 SMP PREEMPT Wed Aug 12 19:02:34 MDT 2015 armv7l GNU/Linux

fish --version:

fish, version 2.2.0-220-g0682c0f

Activity

  1. faho commented on Aug 17, 2015

    @faho
    Member

    What's your keymap (in /etc/vconsole.conf)?

  2. pickfire commented on Aug 17, 2015

    @pickfire
    ContributorAuthor

    I cannot find /etc/vconsole.conf.

  3. faho commented on Aug 17, 2015

    @faho
    Member

    You're running archlinux arm, aren't you? In that case you probably have systemd, so the output of localectl (specifically the "VC Keymap") would be useful. If you haven't set it, you should probably create a /etc/vconsole.conf (or use localectl to do it for you - note to self: add completion for localectl). See the archwiki article.

  4. faho commented on Aug 17, 2015

    @faho
    Member

    I've added localectl completions in cb5d36d, so you should have an easier time with setting the keymap.

  5. pickfire commented on Aug 17, 2015

    @pickfire
    ContributorAuthor

    localectl set-locale <TAB> still does not work. How do I use tab completion for that?

  6. pickfire commented on Aug 17, 2015

    @pickfire
    ContributorAuthor

    I have set VC Keymap to unicode. It still doesn't work even if it is set to uk or us.

       System Locale: LANG=en_US.UTF-8
           VC Keymap: unicode
          X11 Layout: n/a
    
  7. faho commented on Aug 17, 2015

    @faho
    Member

    localectl set-locale still does not work. How do I use tab completion for that?

    Well, you'd need to get the completion script from current git HEAD and drop it in ~/.config/fish/completions.

  8. pickfire commented on Aug 17, 2015

    @pickfire
    ContributorAuthor

    Well now my localectl shows:

       System Locale: LANG=en_US.UTF-8
           VC Keymap: unicode
          X11 Layout: us
           X11 Model: pc104
         X11 Variant: ,qwerty
         X11 Options: terminate:ctrl_alt_bksp
    

    It still doesn't work in framebuffer.

  9. faho commented on Aug 17, 2015

    @faho
    Member

    Please reboot your system - if I don't after changing keymaps, I also have some keys not working.

  10. pickfire commented on Aug 17, 2015

    @pickfire
    ContributorAuthor

    It still has the same problem after reboot.

  11. faho commented on Aug 17, 2015

    @faho
    Member

    That's weird. Does it also have issues with other vc keymaps (after reboot, of course)? I'm guessing "unicode" is a fallback-thing. Why not choose the country-code of your keyboard layout?

  12. pickfire commented on Aug 18, 2015

    @pickfire
    ContributorAuthor

    It still have the same result after reboot even after I set localectl to:

       System Locale: LANG=en_US.UTF-8
           VC Keymap: us
          X11 Layout: us
           X11 Model: pc105
         X11 Variant: ,qwerty
         X11 Options: terminate:ctrl_alt_bksp
    
  13. faho commented on Aug 30, 2015

    @faho
    Member

    So, according to sheldon in #2330, it seems like, in bash, pressing ctrl-v and then a key will print its character sequence (we should get that function as well). Please try that with the affected keys.

  14. pickfire commented on Aug 31, 2015

    @pickfire
    ContributorAuthor

    Using bash in framebuffer:

    Up    : ^[OA
    Down  : ^[OB
    Right : ^[OC
    Left  : ^[OD
    
  15. faho commented on Aug 31, 2015

    @faho
    Member

    Then try the following:

    bind \e0A up-or-search
    bind \e0B down-or-search
    bind \e0C forward-char
    bind \e0D backward-char

    or

    bind ^[0A up-or-search
    # and so on

    (Add it to the fish_user_key_bindings function if you want to have it in config)

    This is kinda weird since these for me send "^[[A", "^[[B" and so on (in a VT of course).

  16. 17 remaining items

  17. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    Every one of the following fixed it:

    printf '\033[?1h\033=' >/dev/tty
    tput smkx
    bind "[P" delete-char
    

    But I think that we shouldn't only use fish-specific command.

    If you execute tput smkx and then press CTRL-v delete in bash, what does it output?

    I doesn't know why, but it seems that I can't press k in bash. Only ^v k works and it shows k only.

  18. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    In bash, it shows ^[[3~. And delete works by default in zsh.

  19. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    I have updated the last two coment.

    It seems that after I run zsh and close it. fish seems to have delete work.

  20. faho commented on Sep 1, 2015

    @faho
    Member

    printf '\033[?1h\033=' >/dev/tty
    tput smkx
    bind "[P" delete-char

    Thanks. I'd rather not balloon all our key bindings with all escape codes for all terminals, so I'd appreciate a solution where we can just execute something like tput smkx when needed (or at least not harmful). How do we detect that it's needed? Can it be harmful (i.e. make some keys not work)?

    BTW: Does this improve the original situation with the VT - if you build without a21e44c and instead execute tput smkx do the arrows output more normal codes?

  21. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    BTW: Does this improve the original situation with the VT - if you build without a21e44c and instead execute tput smkx do the arrows output more normal codes?

    No, it just display the same weird codes.

    Thanks. I'd rather not balloon all our key bindings with all escape codes for all terminals (and I dislike that "st" behaves this way when nearly everything else seems to work better), so I'd appreciate a solution where we can just execute something like tput smkx when needed (or at least not harmful). How do we detect that it's needed? Can it be harmful (i.e. make some keys not work)?

    I thought you said that there is some terminal specific ...?

  22. faho commented on Sep 1, 2015

    @faho
    Member

    I thought you said that there is some terminal specific ...?

    Yes, there are some terminal-specific codes in our bindings, but I don't really like adding too many more. Of course we could make it more palatable by grouping things like

    for k in \eOC \e\[C # right-arrow
        bind $argv $k forward-char
    end

    (and I might end up doing that anyway)

    If it was only delete and only in st and then we'd be done I'd just add it, but I expect it to be more, even in st - what about shift-delete?

    Ideally terminfo would just have that info so we get it via bind -k - this would also improve the situation for users who create their own bindings and switch terminals. Detecting the terminal and then doing tput smkx (which really seems like a magic "do the right thing and not your stupid default" command to me) would also solve this, but I have no clue how to do that - "$TERM" is not going to help since everyone sets that to "xterm-256color" because too many programs expect it to be.

  23. faho commented on Sep 1, 2015

    @faho
    Member

    I've just installed st, and here's a list of key combinations that don't work and what they print:

    • delete: "[P"
    • shift-delete: "[2K"
    • ctrl-delete: "[M"
    • insert: "[4h" (shift-insert inserts from the clipboard)
    • ctrl-insert: "[L"
    • shift-up: "[1;2A" (and B/C/D for the other arrows)
    • ctrl-up: "[1;5A"

    all of these seem to be fixed (i.e. set to standard codes) via tput smkx, and $TERM is set to "st-256color".

  24. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    I understand what you mean, bind everything...

    If it was only delete and only in st and then we'd be done I'd just add it, but I expect it to be more, even in st - what about shift-delete?

    What is shift-delete for?

    Ideally terminfo would just have that info so we get it via bind -k - this would also improve the situation for users who create their own bindings and switch terminals. Detecting the terminal and then doing tput smkx (which really seems like a magic "do the right thing and not your stupid default" command to me) would also solve this, but I have no clue how to do that - "$TERM" is not going to help since everyone sets that to "xterm-256color" because too many programs expect it to be.

    Yeah, there is terminfo for st. By default, st uses st-256color and I uses that anyway as it did not broke anything.

    I haven't tried shift-delete, ctrl-delete, insert, ctrl-insert, shift-up, ctrl-up as I never uses them, the most visible is delete. Maybe I could patch st for delete to work.

    all of these seem to be fixed via tput smkx, and $TERM is set to "st-256color".

    What about printf '\033[?1h\033=' >/dev/tty?

  25. faho commented on Sep 1, 2015

    @faho
    Member

    What is shift-delete for?

    Currently nothing - the point though is that this outputs something different in st than elsewhere.

    Yeah, there is terminfo for st.

    But it gives info for the smkx mode:

    kdch1=\E[3~

    It seems like st expects everyone to send it that - now it'd be nice to know why.

    What about printf '\033[?1h\033=' >/dev/tty?

    Same thing, except the former uses the terminfo database. st has smkx=\E[?1h\E=.

    @zanchey: You seem to know your way around this stuff. Anything we can do? Anything I got wrong?

  26. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    It seems like st expects everyone to send it that - now it'd be nice to know why.

    Should I ask in the mailing list about it?

  27. faho commented on Sep 1, 2015

    @faho
    Member

    Let's check the archives first.

  28. faho commented on Sep 1, 2015

    @faho
    Member

    Why not discuss this in #2139, actually? You opened it to track this, after all.

  29. pickfire commented on Sep 1, 2015

    @pickfire
    ContributorAuthor

    Sorry, I forgot about that. The case for linux framebuffer is solved.

  30. added a commit that references this issue on Sep 8, 2015
    a8800e4
  31. locked as resolved and limited conversation to collaborators on Apr 18, 2020
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions