Subject: Re: port-macppc/14733 macppc USB console attachment broken
To: Lennart Augustsson <lennart@augustsson.net>
From: gabriel rosenkoetter <gr@eclipsed.net>
List: port-macppc
Date: 11/28/2001 11:43:03
--rQ2U398070+RC21q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 27, 2001 at 11:03:03AM +0100, Lennart Augustsson wrote:
> I don't think this will help.  The code I was talking about runs
> very early during the boot process and doesn't care what you
> write in the config file.

Hrm. I thought about it a few minutes more, and I bet you're right,
this won't fix console for ddb or post-shutdown issues.

Actually *looking* at machdep.c now, I wonder why we don't just
check both `usb-kbd-ihandles and `usb-kbd-ihandle at the same time,
with the fore-knowledge that one of them is going to break. We never
get to the "Assume USB keyboard anyway" bit, as `adb-kbd-ihandle
always says yes, even when there's no keyboard plugged in. (Even
when there's no adb port? Not sure, and I don't have any adb-less
macs to check.) That is, something like this around line 950 of
src/sys/arch/macppc/macppc/machdep.c:

#if NUKBD > 0
	{
    int usb_kbd_flag =3D OF_call_method("`usb-kbd-ihandles", stdin, 0, 1, &=
ukbds);
		if (usb_kbd_flag =3D=3D -1)
      usb_kbd_flags =3D OF_call_method("`usb-kbd-ihandle", stdin, 0, 1, &uk=
bds);
    if (usb_kbd_flag !=3D -1) && ukbds !=3D NULL && ukbds->ihandle !=3D 0 &&
        OF_instance_to_package(ukbds->ihandle) !=3D -1) {
	    printf("console keyboard type: USB\n");
      ukbd_cnattach();
      goto kbd_found;
    }
  }
#endif

Am I missing something vital about how something in here behaves? Will
calling an OF method that doesn't exist completely break things? (It
would seem not, since we're calling `usb-kbd-ihandles on machines
without it with only the ill effect that their usb keyboards don't
get noticed...)

I'm well aware that the above is grotty, but it seems (to me! with
little background knowledge of how machdep.c behaves under macppc!)
like it ought to work... unless -1 isn't what we get from
OF_call_method() when the call didn't exist, but it sure seems like
it should be (just glancing at src/sys/arch/powerpc/powerpc/openfirm.c,
which, I presume is where macppc is getting this function too).

Thoughts?

--=20
       ~ g r @ eclipsed.net

--rQ2U398070+RC21q
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjwFFBcACgkQ9ehacAz5CRoD9ACfQtHmSTqnoTaum1x/xHLNE/JO
JDAAoJdXZL1P9Kn261uXwS8BWBFv/wrf
=3FwO
-----END PGP SIGNATURE-----

--rQ2U398070+RC21q--