[OpenBIOS] [PATCH] PPC: Rework assignment of keyboard devalias.
Blue Swirl
blauwirbel at gmail.com
Sat Dec 1 15:35:11 CET 2012
On Mon, Nov 26, 2012 at 12:13 AM, Mark Cave-Ayland
<mark.cave-ayland at ilande.co.uk> wrote:
> Rather than simply copy the value of input-device, we scan the device
> tree for an entry with a device_type of keyboard and use that. This
> ensures that the keyboard alias always points to a physical keyboard
> device.
Maybe I'm missing something, but other keyboard drivers (escc.c and
pc_kbd.c) just add the keyboard alias themselves, this should be
slightly faster because the scan is avoided. It's also only two lines
of code.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
> ---
> openbios-devel/arch/ppc/qemu/qemu.fs | 36 +++++++++++++++++++++++++++++-----
> 1 file changed, 31 insertions(+), 5 deletions(-)
>
> diff --git a/openbios-devel/arch/ppc/qemu/qemu.fs b/openbios-devel/arch/ppc/qemu/qemu.fs
> index 0d691f7..29c4cf6 100644
> --- a/openbios-devel/arch/ppc/qemu/qemu.fs
> +++ b/openbios-devel/arch/ppc/qemu/qemu.fs
> @@ -46,12 +46,38 @@
> then
> ;
>
> -\ set the keyboard alias to stdin
> +variable keyboard-phandle 0 keyboard-phandle !
> +
> +: (find-keyboard-device) ( phandle -- )
> + recursive
> + >dn.child @
> + begin ?dup while
> + dup dup " device_type" rot get-package-property 0= if
> + drop dup cstrlen
> + " keyboard" strcmp 0= if
> + dup to keyboard-phandle
> + then
> + then
> + (find-keyboard-device)
> + >dn.peer @
> + repeat
> +;
> +
> +\ create the keyboard devalias
> :noname
> - active-package
> - " /aliases" find-device
> - input-device encode-string " keyboard" property
> - active-package!
> + device-tree @ (find-keyboard-device)
> + keyboard-phandle @ if
> + active-package
> + " /aliases" find-device
> + keyboard-phandle @ get-nodename
> + \ dictionary abused for temporary storage
> + here >r
> + " /" r@ 200 + tmpstrcat drop
> + keyboard-phandle @ >dn.parent @ get-package-path
> + r@ 240 + tmpstrcat r> 2drop
> + encode-string " keyboard" property
> + active-package!
> + then
> ; SYSTEM-initializer
>
> \ -------------------------------------------------------------------------
> --
> 1.7.10.4
>
>
> --
> OpenBIOS http://openbios.org/
> Mailinglist: http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
More information about the OpenBIOS
mailing list