detecting keyboard layout during boot

Matthias Apitz guru at unixarea.de
Wed May 15 13:53:16 UTC 2013


El día Wednesday, May 15, 2013 a las 03:27:24PM +0200, Polytropon escribió:

> On Wed, 15 May 2013 09:35:54 +0200, Matthias Apitz wrote:
> > 
> > Hello,
> > 
> > I have in /etc/rc.conf a line
> > 
> > keymap="german.iso"
> > 
> > to set the keyboard to German; as the system in question is on an USB
> > key for boot and sometimes used in other laptops with QWERTY layout, I
> > would like to have it adapt itself to the actual layout without changing
> > anything before booting in rc.conf and without asking the user to press
> > a key ... is there some way to detect the actual keyboard layout
> > automagically?
> 
> Basically, it's impossible, but it can be made possible by the
> power of FreeBSD. :-)
> 
> Allow me to explain:
> 
> Depending on where the keyboard is attached, some connections
> (AT 5 pin plug, PS/2 6 pin mini-plug) do not offer any means to
> detect what keyboard is connected (or even _if_ a keyboard is
> connected). This case usually applies to keyboards built into
> laptops. You can see that in "dmesg | grep kbd".
> 
> Example:
> 
> 	% dmesg | grep kbd
> 	kbd1 at kbdmux0
> 	atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
> 	atkbd0: <AT Keyboard> irq 1 on atkbdc0
> 	kbd0 at atkbd0
> 	atkbd0: [GIANT-LOCKED]
> 	atkbd0: [ITHREAD]
> 	ukbd0: <vendor 0x0430 Sun USB Keyboard, class 0/0,
> 		rev 2.00/1.05, addr 5> on usbus1
> 	kbd2 at ukbd0
> 
> You see: The AT keyboard controller is detected, kbd0 is available.
> But there is no actual keyboard connected to that PS/2 port. Instead,
> a Sun USB Type 7 keyboard (german layout) is being used here, as
> kbd2.

Hello,

Here on an laptop/netbook EeePC 900 with English keyboard it says:

# dmesg | fgrep kbd
kbd1 at kbdmux0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0

how do I know that the kb layout is English?

> But as you're asking about USB, there is a way. But this way
> depends on how the manufacturer cooperates. Let's discuss that.

USB was only meant as the boot device.

	matthias

-- 
Sent from my FreeBSD netbook

Matthias Apitz               |  - No system with backdoors like Apple/Android
E-mail: guru at unixarea.de     |  - Never being an iSlave
WWW: http://www.unixarea.de/ |  - No proprietary attachments, no HTML/RTF in E-mail
phone: +49-170-4527211       |  - Respect for open standards


More information about the freebsd-questions mailing list