You are not logged in.

#1 2014-07-17 14:36:35

scot14
Member
Registered: 2014-06-02
Posts: 123

[SOLVED] Some HP Chromebook 14 function keys not working as expected

Continuing the discussion from https://bbs.archlinux.org/viewtopic.php?id=173418&p=17 ...

For the purposes of this discussion, let's call the keys along the top of the keyboard on the chromebook CBEscape, CB1, CB2, CB3, CB4, CB5, CB6, CB7, CB8, CB9, CB10, CBPower.

Toshiba Chromebook CB35 keycodes are
console: 59-68 = CB1-CB10
X11: 67-76 = CB1-CB10

HP Chromebook 14 keycodes are
console:  158=CB1, 159=CB2, 173=CB3 and 62-68 = CB4-CB10
X11: CB1=166, CB2=167, CB3=181 and 70-76 = F4-F10

We want the CB1-CB3 keys on the HP Chromebook to act like normal F1-F3 function keys.

Stephen304, will you try using loadkeys to set 158=F1, 159=F2, and 181=F3? I think these are different codes that you used before.

Last edited by scot14 (2014-07-18 20:15:49)

Offline

#2 2014-07-17 14:50:31

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

When you press one of those keys, are any messages added to the journal or to the output of dmesg?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-07-17 16:18:37

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

So actually F5-F7 is even weirder - it shows keymapnotify with no consistent keycodes in xev, but i dont care too much about those keys.

I used loadkeys with the console keycodes in both console and x11 and in both cases nothing changed. In x11, xev showed x86 back / next / refresh still.

Dmesg seems unchanged after these keys are pressed.

Offline

#4 2014-07-17 17:49:10

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

From a console make a file called '~/test.keys' with

alt keycode 158 = Console_1
alt keycode 159 = Console_2
alt keycode 173 = Console_3

and then run 'loadkeys ~/test.keys'.

Does this enable switching between consoles with Alt-Fx key combinations? (Just between consoles, not from X11.)

Offline

#5 2014-07-18 11:58:55

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

scot14 wrote:

From a console make a file called '~/test.keys' with

alt keycode 158 = Console_1
alt keycode 159 = Console_2
alt keycode 173 = Console_3

and then run 'loadkeys ~/test.keys'.

Does this enable switching between consoles with Alt-Fx key combinations? (Just between consoles, not from X11.)

Awesome that worked as expected! Is there any way to make it Ctrl + Alt though? And now I just have to figure out how to make it work in X11.

Offline

#6 2014-07-18 12:09:32

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Does this add the control key?

alt control keycode 158 = Console_1
alt control keycode 159 = Console_2
alt control keycode 173 = Console_3

Offline

#7 2014-07-18 12:17:29

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Woah that works! I tried doing ctrl alt. I can't seem to find any good documentation on what the right modifier names are or how to specify combinations so I've just been stabbing in the dark. Any ideas for how to make it work in X11? Of course I could just switch to tty4 then switch to the desired tty as well if X11 won't cooperate.

Offline

#8 2014-07-18 12:33:07

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Does this change CB1-CB3 into F1-F3 in X11?

xmodmap -e "keysym XF86Back = F1"
xmodmap -e "keysym XF86Forward = F2"
xmodmap -e "keysym XF86Reload = F3"

Offline

#9 2014-07-18 12:43:05

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

scot14 wrote:

Does this change CB1-CB3 into F1-F3 in X11?

xmodmap -e "keysym XF86Back = F1"
xmodmap -e "keysym XF86Forward = F2"
xmodmap -e "keysym XF86Reload = F3"

That changes it to function keys, but it won't switch tty. I did this before and I remember my F4 had a 7th entry (XF86Switch_VT_1), which i couldn't get to add to F1-3 - in other words it seems just being mapped to F1-F3 doesn't do it.

Offline

#10 2014-07-18 12:57:23

sapientidiot
Member
Registered: 2014-07-11
Posts: 12

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

scot14 wrote:

Does this change CB1-CB3 into F1-F3 in X11?

xmodmap -e "keysym XF86Back = F1"
xmodmap -e "keysym XF86Forward = F2"
xmodmap -e "keysym XF86Reload = F3"

Thanks guys, this post was super helpful, I was using xbindkeys and xvkbd to set F1-10 in X11, but xmodmap is probably better.  It still doesn't allow for switching from X to VCs but at least google/hp left the F4 key alone so its only a minor annoyance.

Is there some way to get the console changes made with loadkeys to be applied automatically on boot?

Offline

#11 2014-07-18 12:59:38

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

sapientidiot wrote:

Thanks guys, this post was super helpful, I was using xbindkeys and xvkbd to set F1-10 in X11, but xmodmap is probably better.  It still doesn't allow for switching from X to VCs but at least google/hp left the F4 key alone so its only a minor annoyance.

Is there some way to get the console changes made with loadkeys to be applied automatically on boot?

Glad this discussion was helpful! I was just looking at how to make it apply on boot, but the loadkeys wiki page references a /etc/vconsole.conf file which I don't have.

P.S. I've done a lot on the HP CB 14 archwiki page, so I'm adding this info as we figure it out.

Last edited by Stephen304 (2014-07-18 13:00:13)

Offline

#12 2014-07-18 13:16:43

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Here is some code simplification:

echo "alt keycode 158 = Console_1" | loadkeys -q
echo "alt keycode 159 = Console_2" | loadkeys -q
echo "alt keycode 173 = Console_3" | loadkeys -q

Offline

#13 2014-07-18 13:21:09

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

What does this do?

xmodmap -e "keysym XF86Back = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1"
xmodmap -e "keysym XF86Forward = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2"
xmodmap -e "keysym XF86Reload = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3"

Offline

#14 2014-07-18 13:21:45

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

I think you have to sudo those, so I don't think putting it in bashrc will work

~snip~

Actually it just makes them regular F1-F3, no terminal switching.

Last edited by Stephen304 (2014-07-18 13:28:50)

Offline

#15 2014-07-18 13:34:09

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Are you talking about the console script? Try this:

echo "alt keycode 158 = Console_1" | sudo loadkeys -q
echo "alt keycode 159 = Console_2" | sudo loadkeys -q
echo "alt keycode 173 = Console_3" | sudo loadkeys -q

Offline

#16 2014-07-18 13:46:13

sapientidiot
Member
Registered: 2014-07-11
Posts: 12

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

No need to use sudo, I just added xmodmap to my .xinitrc and used this configuration to get all the F keys working and change the search key into Mod4.
Just save this file as ~/.Xmodmap

http://pastie.org/9402663

then add this to your .xinitrc

 xmodmap ~/.Xmodmap &

Also if you want to have search+arrows do pgup/dwn home/end like in chromeOS use this for ~/.xbindkeysrc and add xbindkeys to .xinitrc also:

http://pastie.org/9402667

Offline

#17 2014-07-18 13:53:27

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

sapientidiot wrote:

No need to use sudo, I just added xmodmap to my .xinitrc and used this configuration to get all the F keys working ...

When you press Ctrl-Alt-F2, does the screen change to a VT?

Offline

#18 2014-07-18 13:55:22

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Woah we're getting all confused here.

sapientidiot wrote:

No need to use sudo, I just added xmodmap to my .xinitrc and used this configuration to get all the F keys working and change the search key into Mod4.
Just save this file as ~/.Xmodmap
(...)

When I said sudo I was talking about the loadkeys for console.

scot14 wrote:

Are you talking about the console script? Try this:

echo "alt keycode 158 = Console_1" | sudo loadkeys -q
echo "alt keycode 159 = Console_2" | sudo loadkeys -q
echo "alt keycode 173 = Console_3" | sudo loadkeys -q

I was talking about xmodmap, that's the one you asked what it did for me. After snip I was talking about the second post you made. I responded in the same order to your post.

The console fix works great besides needing to run loadkeys as sudo:

alt control keycode 158 = Console_1
alt control keycode 159 = Console_2
alt control keycode 173 = Console_3

and the second console one works as well as long as it's run as root

echo "alt keycode 158 = Console_1" | sudo loadkeys -q
echo "alt keycode 159 = Console_2" | sudo loadkeys -q
echo "alt keycode 173 = Console_3" | sudo loadkeys -q

but the xmodmap only makes them regular F keys:

xmodmap -e "keysym XF86Back = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1"
xmodmap -e "keysym XF86Forward = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2"
xmodmap -e "keysym XF86Reload = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3"

Last edited by Stephen304 (2014-07-18 14:06:51)

Offline

#19 2014-07-18 14:10:09

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Now I'm with you. Also, xmodmap can be stateful, so I'm not sure about some of our tests. Looking at that now.

Regarding the console script, can you put them in /etc/rc.local and then use the systemd rc.local service? Or make some other systemd unit for them?

Offline

#20 2014-07-18 14:15:28

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Also, you could make sudo run loadkeys without a password. Run visudo, and add this line to the end:

{username} ALL = (root) NOPASSWD: /usr/bin/loadkeys

where {username} is the username running the command from bashrc.

Offline

#21 2014-07-18 14:17:48

sapientidiot
Member
Registered: 2014-07-11
Posts: 12

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Yep, my mistake... loadkeys requires sudo.

I think the proper way to fix this (on boot) is by loading a custom keymap with /etc/vconsole.conf. I'm not sure exactly what changes need to be made though, just rebooted from my first attempt and although "localectl list-keymaps" lists my new keymap, the changes i made didn't seem to do the trick. I'll keep tinkering with it and see what i can do.

Offline

#22 2014-07-18 14:22:35

sapientidiot
Member
Registered: 2014-07-11
Posts: 12

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

I'm wondering if both keymaps (console and X11) could be fixed with vconsole.conf because:

 
sapient@QonoS ~ % localectl status          
   System Locale: n/a

       VC Keymap: chromebook-falco
      X11 Layout: n/a

Leads me to think that it can. Although they may still need to be seperate keymaps.

Last edited by sapientidiot (2014-07-18 14:22:58)

Offline

#23 2014-07-18 14:29:40

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

sapientidiot wrote:

I'm wondering if both keymaps (console and X11) could be fixed with vconsole.conf because:

 
sapient@QonoS ~ % localectl status          
   System Locale: n/a

       VC Keymap: chromebook-falco
      X11 Layout: n/a

Leads me to think that it can. Although they may still need to be seperate keymaps.

On Toshiba Chromebook, where the function keys work as expected without changes, here is part of the output:

   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105

Offline

#24 2014-07-18 14:31:52

Stephen304
Member
Registered: 2014-07-04
Posts: 30

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

scot14 wrote:

Now I'm with you. Also, xmodmap can be stateful, so I'm not sure about some of our tests. Looking at that now.

Regarding the console script, can you put them in /etc/rc.local and then use the systemd rc.local service? Or make some other systemd unit for them?

Yeah I actually noticed - the snip was because I typed a bunch about the errors I was getting when I ran the xmodmap commands then I realized I forgot to reboot.

I got the console fix to run on boot - I put custom.map in root (not sure where would be a better place): /custom.map

Then created /etc/vconsole.conf

KEYMAP=/custom.map

And after reboot, I can switch tty with no problems

Keymap status before:

System Locale: LANG=en_US.UTF-8
VC Keymap: n/a
X11 Keymap: n/a

Keymap status after:

System Locale: LANG=en_US.UTF-8
VC Keymap: /custom.map
X11 Keymap: n/a

Last edited by Stephen304 (2014-07-18 14:36:54)

Offline

#25 2014-07-18 14:33:44

scot14
Member
Registered: 2014-06-02
Posts: 123

Re: [SOLVED] Some HP Chromebook 14 function keys not working as expected

Offline

Board footer

Powered by FluxBB