ukbd attachment and root mount

Jeremy Chadwick koitsu at FreeBSD.org
Wed Nov 12 05:21:26 PST 2008


On Wed, Nov 12, 2008 at 02:49:15PM +0200, Andriy Gapon wrote:
> on 12/11/2008 14:33 Jeremy Chadwick said the following:
> > On Wed, Nov 12, 2008 at 02:20:41PM +0200, Andriy Gapon wrote:
> >> on 12/11/2008 14:14 Jeremy Chadwick said the following:
> >>> On Wed, Nov 12, 2008 at 01:58:58PM +0200, Andriy Gapon wrote:
> >> [snip]
> >>>> 2. if ukbd driver is not attached then I don't see any way USB keyboard
> >>>> would work in non-legacy way
> >>> Regarding #2: at which stage?  boot0/boot2/loader require an AT or PS/2
> >>> keyboard to work.  None of these stages use ukbd(4) or anything -- there
> >>> is no kernel loaded at this point!!  Meaning: if you have a USB keyboard,
> >>> your BIOS will need to have a "USB Legacy" option to cause it to act as
> >>> a PS/2 keyboard, for typing in boot0/boot2/loader to work.
> >>>
> >>> Device hints are for kernel drivers, once the kernel is loaded.
> >> Jeremy,
> >>
> >> I understand all of this.
> >> In subject line and earlier messages I say that I am interested in
> >> mountroot prompt - the prompt where kernel can ask about what device to
> >> use for root filesystem.
> >> Essentially I would like kernel to recognize USB keyboard (and disable
> >> all the legacy stuff if needed) before it prompts for the root device.
> > 
> > I fully understand that fact.  However, I don't see the logic in that
> > statement.  You should be able to remove and add a keyboard at any time
> > and be able to type immediately.  Meaning: I don't see why when the
> > keyboard recognition is performed (e.g. before printing mountroot or
> > after) matters.  It should not.  I think this is a red herring.
> 
> I think that this does matter because keyboard recognition is performed
> after the 'mounting from' log line *only if* root mount is done
> automatically.
> If there is an actual interactive prompt then recognition is not
> performed, at least I do not see any relevant lines on the screen and I
> am stuck at the prompt.
> 
> > I've seen the problem where I have a fully functional USB keyboard in
> > boot0/boot2/loader
> 
> For me it even randomly dies at these stages.
> I reported this in a different thread.
> But this should not be related to kernel behavior.
> 
> >and in multi-user,
> 
> For me this always works.
> 
> > but when booting into single-user
> 
> For me this always works.
> 
> > or when getting a mountroot prompt, the keyboard does not function.
> > When the mountroot prompt is printed (before or after ukbd attached)
> > makes no difference for me in this scenario -- I tested it many times.
> 
> For me ukbd lines are never printed if I get actual interactive
> mountroot prompt.
> 
> > It's very possible that "something" (kbdcontrol?) is getting run only
> > during late stages of multi-user, which makes the keyboard work.  But
> > prior to that "something" being run (but AFTER boot2/loader), the
> > keyboard is not truly usable.
> 
> For me this is not true. My keyboard always works after ukbd lines
> appear on screen.

I've pointed you to evidence where this isn't true, especially when
using the USB4BSD stack.  There is something called "boot legacy
protocol" which USB keyboards have to support to properly be interfaced
with in FreeBSD using the USB4BSD stack; in the case of the Microsoft
Natural Ergo 4000 keyboard, it does not play well with USB4BSD (it DOES
work with the old USB stack, but none of the multimedia keys work, and
worse, the F-Lock key does not work; this is because those keys use
uhid(4) and not ukbd(4)).

Linux has a __20 page Wiki document__ on **just this keyboard**.  That
should give you some idea of how complex the situation with USB
keyboards is in general.

http://www.gentoo-wiki.info/HOWTO_Microsoft_Natural_Ergonomic_Keyboard_4000

> > I hope everyone here is also aware of that fact that not all keyboards
> > are created equal.  Case in point (and this reason is exactly why I
> > am purchasing a native PS/2 keyboard, as USB4BSD doesn't work with
> > all USB keyboards right now):
> 
> For me this is not an option, no PS/2 ports.

I don't know what to say to ***ANY*** of the above, other than this:

No one is doing anything about this problem because there does not
appear to be a 100% reproducible always-screws-up-when-I-do-this
scenario that happens to *every FreeBSD user*.

Until we settle down, stop replying to Emails with one-liner injections,
and compile a list of test scenarios/cases that people can perform, and
get these people to provide both 1) full hardware details, 2) full
kernel configuration files, 3) full loader.conf files, and 4) full
device.hints files, we're not going to get anywhere.

> > http://lists.freebsd.org/pipermail/freebsd-current/2008-November/000219.html
> > 
> > The bottom line:
> > 
> > FreeBSD cannot be reliably used with a USB keyboard in all
> > circumstances.And that is a very sad reality, because 90% of the
> > keyboards you find on the consumer and enterprise market are USB --
> > native PS/2 keyboards are now a scarcity.
> 
> I agree that this is a sad reality but only for boot stages where we
> depend on external entity named BIOS to help us.
> This doesn't have to be a sad reality once kernel takes control.

It's been confirmed by numerous people now, including #bsdports users,
that "USB Legacy" does not work for some individuals.  This is either
because of BIOS bugs, or because the USB keyboards do not support tying
into SMM.  We don't know the true cause.

One thing we do know: we have FreeBSD users stating they cannot type in
boot0/boot2/loader, even with USB Legacy enabled, so going into
single-user after a reboot is impossible.

Another thing we do know: we have FreeBSD users who do not have fully
functional USB keyboards in FreeBSD (some see ukbd attach, others do
not; some are using USB4BSD, others are not).

So, can someone take the time to come up with test scenarios/cases so
that users can perform these tests, list off the exact hardware they
have, and we can see if there is a consistent/common failure between
everyone?

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



More information about the freebsd-usb mailing list