Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2010 00:27:50 +0100
From:      Wiktor Niesiobedzki <bsd@w.evip.pl>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-usb <freebsd-usb@freebsd.org>
Subject:   Re: kern/141011: [usb] Encrypted root, geli password at boot; enter  key never release
Message-ID:  <2ae8edf31001101527w91928d0s51bf32ca47c52e7d@mail.gmail.com>
In-Reply-To: <201001101923.16236.hselasky@c2i.net>
References:  <201001101640.o0AGe37d002491@freefall.freebsd.org> <201001101923.16236.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
2010/1/10 Hans Petter Selasky <hselasky@c2i.net>:
> On Sunday 10 January 2010 17:40:03 Wiktor Niesiobedzki wrote:
>> The following reply was made to PR kern/141011; it has been noted by GNA=
TS.
>
>>
>> =C2=A0Hello Hans,
>>
>> =C2=A0I've tried to comment out this section in your version of ukbd.c, =
but
>> =C2=A0to no extent. Still some events get discarded somehow. Shall I ena=
ble
>> =C2=A0some usb debug-flags to help getting to the core of the problem?
>
> Hi,
>
> The information we need is inside ukbd.c . Try to add printfs in code ena=
bling
> and disabling the keyboard. Especially in the USB keyboard read character
> function, and try to figure out where the missing characters are going.


Hi,

Nothing new in enabling and disabling the keyboard. The only
intresting thing is, that although I have only one keyboard, the
ukbd_enable is called twice.

What I found somehow helping, is some additional printfs in ukbd_read_char.
Especially in beginning part:
        printf("enter ukbd_read_char\n");
        if (!KBD_IS_ACTIVE(kbd)) {
                printf("kbd is not active - exiting\n");
                return (NOKEY);
        }

        if (sc->sc_flags & UKBD_FLAG_POLLING) {
                if (!mtx_owned(&Giant)) {
                        /* XXX cludge */
                        printf("ukbd_read_char: UKBD_FLAG_POOLING is
set and giant is not owned - recursing and locking giant\n");
                        int retval;
                        mtx_lock(&Giant);
                        retval =3D ukbd_read_char(kbd, wait);
                        mtx_unlock(&Giant);
                        return (retval);
                }
        } else {
                /* XXX the keyboard layer requires Giant */
                if (!mtx_owned(&Giant))
                        printf("ukbd_read_char: UKBD_FLAG_POOLING is
not set and Giant is not owned -> DISCARDING KEY!\n");
                        return (NOKEY);
        }


Then i see this message:
"ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant"

Full message is (for entering one character is something like that):
ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant
enter ukbd_read_char
a (echo from GELI)
enter ukbd_read_char
ukbd_read_char: UKBD_FLAG_POOLING is set and giant is not owned -
recursing and locking giant
enter ukbd_read_char
enter ukbd_read_char

And supriselingly - no characters were lost, when I was typing my passphare=
ses.

As far as I know (and I may know wrong - please correct me here) -
there is some relation between Giant and printfs (something like -
when you printf on console, you have to have a giant) but this is just
my wild guessing (maybe from java - where System.out.println is
synchronized method). Is it possible, that my printf's affected how
Giant is handled within ukbd and thus - I don't see misbehaviour of
ukbd now?

Or was it just my luck now? (I hardly believe that - I usulally got ~8
characters lost for a boot sequence and now noone).


Any hints for now?


Cheers,

Wiktor Niesiobedzki



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