site  contact  subhomenews

New keyboard hardware profiling

November 25, 2023 — BarryK

Today I posted about a fix for keyboard layout:

https://bkhome.org/news/202311/trying-to-fix-console-keymap-stuck-on-us.html

After doing that, remembered a problem that someone reported, a long time ago; probably at least a year ago...

They were booting Easy on a USB-stick, on different computers. One computer had a "us" layout keyboard, so they configured Easy for that. But then booted up on a computer with "fr" layout; however, Easy is not aware of the change and still thinks it is "us" layout. This will cause a problem if have to enter a password at bootup, and after bootup an app will have to be run to change the keyboard layout to "fr".

I have posted about hardware profiling support in Easy; scoll down this page:

https://easyos.org/about/how-and-why-easyos-is-different.html

I have now added keyboard hardware detection. It cannot detect if a keyboard layout has changed. It just detects if there is a different keyboard, and if so will ask for keyboard layout at early bootup in the initrd.

When you update to Easy 5.6.4, after bootup you will see these files:

/etc/keymap
/mnt/wkg/sfs/settings/initrd/keymap.LenovoLenovoCalliopeUSBKeyboard

...that last one is just an example. The "LenovoLenovoCalliopeUSBKeyboard" part is the keyboard hardware profile.

If you bootup on a computer with that profile, then that keymap will be used. If the file doesn't exist, then you will be asked for keyboard layout, then the keymap.profile file will get created.

It isn't perfect, as there could be two computers with different layouts but identifying themselves with the same keyboard name. But, it is a big step in the right direction. You should be able to bootup the USB-stick on different computers and the correct keyboard layout will be automatically loaded.

Here are the github commits:

https://github.com/bkauler/woofq/commit/63e51bb67d4ceefe00e00ad6b8d6c38352f5cefd

https://github.com/bkauler/woofq/commit/bfa37b707322a3c1ceed723ccdf8d5c3024a8bda

There is a small downside; if you bootup on a different computer with the same keyboard layout, you are still going to be asked for the layout. But that will be once-only, then it will be remembered. Same if you change the keyboard; say, plug in a USB keyboard on a laptop; the change will cause to ask for layout.       

Tags: easy