Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Jan 2012 16:15:45 -0800
From:      Jeremy Chadwick <freebsd@jdc.parodius.com>
To:        Schaich Alonso <alonsoschaich@gmx.de>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Problem with USB keyboard during boot screen
Message-ID:  <20120127001545.GA64476@icarus.home.lan>
In-Reply-To: <201201270035.30878.alonsoschaich@gmx.de>
References:  <4F21CD00.7090306@rpi.edu> <201201270035.30878.alonsoschaich@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 27, 2012 at 12:35:30AM +0100, Schaich Alonso wrote:
> On 2012-01-26 (Thursday) 23:00:32 Garance A Drosihn wrote:
> > Hi.
> > 
> > I recently installed 9.0-release on a brand new PC which has an i3 chip.
> > During the initial install I happened to use a USB keyboard from Apple.
> > I installed freebsd/amd64.  Everything that I tried worked okay with it.
> > 
> > After testing a variety of things, I put the machine in a small rack I
> > have, and hooked up a different USB keyboard to it.  Once the machine
> > has booted all the way up to a "login:" prompt, the newer USB keyboard
> > also works fine.  It's from Logitech, and has illuminated keys (if that
> > makes any difference).
> > 
> > The thing is, the newer keyboard will not work during the initial boot
> > screen.  I see the menu fine, but everything I type using the logitech
> > keyboard is ignored.  If I plug in the Apple keyboard, that works fine
> > during the bootup screen.
> > 
> > Is there something I could configure to make the Logitech keyboard work
> > during that bootup screen?  The thing is that the Apple keyboard has a
> > pretty short USB cable, while the Logitech one has a much longer cable.
> > 
> > When I plug in the Logitech keyboard, I get /var/log/messages of:
> > 
> >    Jan 26 16:54:20 santropez kernel: ugen1.3: <Logitech> at usbus1
> >    Jan 26 16:54:20 santropez kernel: ukbd0: <Logitech Logitech
> > Illuminated Keyboard, class 0/0, rev 2.00/55.01, addr 3> on usbus1
> >    Jan 26 16:54:20 santropez kernel: kbd2 at ukbd0
> >    Jan 26 16:54:20 santropez kernel: uhid0: <Logitech Logitech
> > Illuminated Keyboard, class 0/0, rev 2.00/55.01, addr 3> on usbus1
> > 
> > When I plug in the Apple keyboard, I get messages of:
> > 
> >    Jan 26 16:54:37 santropez kernel: ugen1.4: <Apple, Inc.> at usbus1
> >    Jan 26 16:54:37 santropez kernel: uhub4: <Apple, Inc. Keyboard Hub,
> > class 9/0, rev 2.00/94.15, addr 4> on usbus1
> >    Jan 26 16:54:38 santropez kernel: uhub4: 3 ports with 2 removable,
> > bus powered
> >    Jan 26 16:54:39 santropez kernel: ugen1.5: <Apple, Inc> at usbus1
> >    Jan 26 16:54:39 santropez kernel: ukbd1: <Apple, Inc Apple Keyboard,
> > class 0/0, rev 2.00/0.69, addr 5> on usbus1
> >    Jan 26 16:54:39 santropez kernel: kbd3 at ukbd1
> >    Jan 26 16:54:39 santropez kernel: uhid1: <Apple, Inc Apple Keyboard,
> > class 0/0, rev 2.00/0.69, addr 5> on usbus1
> > 
> > This is not particularly critical to me, but it'd be nice if I could
> > get the logitech one to work during the bootup screen.
> 
> The illuminated keyboard is most probably an usb-2 device, while the 
> nonilluminated one is usb-1. USB-1 is supported by BIOS and USB-2 is not I 
> would guess, and it's also the bios where you could eventually change this 
> (notice that you will probably not be able to enter BIOS with the illuminated 
> keyboard either)

I must disagree with your assessment.

First off, the Logitech keyboard shown is just a keyboard.  There are no
other "features" it provides (aside from illumination, which plays no
role here).

Secondly, the Apple keyboard is a keyboard which also offers USB ports
on it (meaning it has internally a USB hub).  The hub part of the
keyboard may be USB 2.0 class (people are likely to plug USB
flash drives, etc. into the keyboard) than the Logitech.

Thirdly, the protocol (USB 1.0 vs. 1.1 vs. 2.0) plays no role here.
Of course I have no confirmed USB 2.0 keyboards, but what you're saying
really doesn't make any sense.

Fourthly, entering the system BIOS -- assuming this is a PC and not an
Apple computer -- with a USB keyboard is completely and entirely
possible, no matter what "class" of keyboard it is.  Furthermore, you
correlate the lack of keyboard functionality in FreeBSD with "the system
BIOS" -- this is simply not the case.

Many PC BIOSes offer an Enable/Disable feature what it labelled "USB
Legacy" or sometimes "USB Keyboard" (with a separate one for "USB
Mouse").  This feature has zero -- I repeat, ZERO -- relevancy to
FreeBSD once the kernel initialises.

The BIOS feature effectively emulates a PS/2 keyboard via USB, and does
so by tying BIOS INT 10h (I think?  It's been a while) to an internal
piece of code located in the BIOS that then translates the I/O into USB
keyboard class I/O.  Thus, your USB keyboard is able to function in
operating systems like MS-DOS, or in boot loaders like FreeBSD's
BTX/boot0/boot2/loader, or GRUB.

If you were to disable the BIOS option, you would still be able to enter
the BIOS with a USB keyboard, but once the system POSTs you would not be
able to type into a bootloader or legacy OS since the interrupt handler
shim didn't exist.

When the FreeBSD kernel loads, it completely destroys most of the
interrupt handlers, thus it immediately "breaks" this "emulation" layer.
FreeBSD has a USB stack that supports USB keyboards natively -- no need
for the BIOS shim.  The same applies to Windows, Linux, and any other
operating system.  This is just how it works.  Welcome to the atrocity
that is PC architecture in 2012.

Finally, the reason I mention the system matters -- if this is an Apple
system (MacBook, etc.), I believe they use EFI instead of classic x86
BIOS, where things are substantially different.  I cannot speak about
that as I have no experience with EFI.

So, for the OP: can you please answer yes/no to the following questions:

- If you power on the system with the Logitech keyboard attached, can
  you successfully type at the loader prompt ("FreeBSD beastie logo")?

- If you power on the system with the Apple keyboard attached, can you
  successfully type at the loader prompt ("FreeBSD beastie logo")?

- If you power on the system with the Logitech keyboard attached, and
  let the FreeBSD kernel load, can you successfully type at the login:
  prompt?

- If you power on the system with the Apple keyboard attached, and
  let the FreeBSD kernel load, can you successfully type at the login:
  prompt?

Yes/no answers to these 4 questions will provide enough insight to know
where the problem lies.  Please DO NOT hot-swap keyboards during any of
this testing.  Just stick to what I've described please, thanks.

-- 
| Jeremy Chadwick                                 jdc@parodius.com |
| Parodius Networking                     http://www.parodius.com/ |
| UNIX Systems Administrator                 Mountain View, CA, US |
| Making life hard for others since 1977.             PGP 4BD6C0CB |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120127001545.GA64476>