[OpenBIOS] [PATCH] PPC: Rework assignment of keyboard devalias.
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Mon Nov 26 01:13:33 CET 2012
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.
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
More information about the OpenBIOS
mailing list