Date: Wed, 15 May 2013 15:27:24 +0200 From: Polytropon <freebsd@edvax.de> To: Matthias Apitz <guru@unixarea.de> Cc: freebsd-questions@freebsd.org Subject: Re: detecting keyboard layout during boot Message-ID: <20130515152724.1ef31a58.freebsd@edvax.de> In-Reply-To: <20130515073554.GA1098@tiny.Sisis.de> References: <20130515073554.GA1098@tiny.Sisis.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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. But as you're asking about USB, there is a way. But this way depends on how the manufacturer cooperates. Let's discuss that. As you know, every USB device is characterized by two specific USB numbers: vendor ID and product ID. In some cases, the product ID is different regarding the language layout, but you need to test that individually, no standard seems to exist. Then, you can use the devd.conf file to select per this ID and load the correct keyboard layout. This is done in the "rc.conf stage". Prior to this stage, the "kernel stage", you can hardcode layouts in the kernel config. Last time I checked this stopped working, I have been told that the use of kbdmux is the reason for this observation. Example: options ATKBD_DFLT_KEYMAP makeoptions ATKBD_DFLT_KEYMAP=german.iso options UKBD_DFLT_KEYMAP makeoptions UKBD_DFLT_KEYMAP=german.iso Those options would enable a german keyboard layout even in SUM. Even adding a font for proper display has been possible: options SC_DFLT_FONT makeoptions SC_DFLT_FONT=iso Not sure if this is still supported. Using Umlauts and Eszett is discouraged in filenames, and the blind knowledge of the US keyboard layout is quite standard among sysadmins. :-) As a summery: No soup for you! ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130515152724.1ef31a58.freebsd>