aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsteev <steev@cypher.ubersekret.info>2009-02-05 14:23:38 -0600
committersteev <steev@cypher.ubersekret.info>2009-02-05 14:23:38 -0600
commit8a34b074db1e60dbdd46c64120ab01eb17252b90 (patch)
tree2911bab58cb712c73c9e79b671c427231517a5c2 /hal-config-examples
parentinitialize repository (diff)
downloadgentoo-hal-master.tar.gz
gentoo-hal-master.tar.bz2
gentoo-hal-master.zip
Add patches and examplesHEADmaster
Diffstat (limited to 'hal-config-examples')
-rwxr-xr-xhal-config-examples/migrate-xorg-to-fdi.py69
-rw-r--r--hal-config-examples/use-estonian-layout.fdi12
-rw-r--r--hal-config-examples/use-kbd-driver.fdi17
-rw-r--r--hal-config-examples/use-mouse-driver.fdi16
-rw-r--r--hal-config-examples/use-multiple-layouts-with-kbd.fdi17
-rw-r--r--hal-config-examples/use-multiple-layouts.fdi20
6 files changed, 151 insertions, 0 deletions
diff --git a/hal-config-examples/migrate-xorg-to-fdi.py b/hal-config-examples/migrate-xorg-to-fdi.py
new file mode 100755
index 00000000..5b0ec9c8
--- /dev/null
+++ b/hal-config-examples/migrate-xorg-to-fdi.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8 -*-
+# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
+
+# Very simple script which converts the InputDevice section for keyboards into a
+# FDI rule. Any time a specific model is present, we ignore it and set it to
+# evdev, as that will be the driver used.
+
+import sys
+import xf86config
+from xf86config import XF86SectionMissing
+
+def xkb_model(value):
+ model = ' <!-- Option "XkbModel" "%s" -->' % (value,) + '\n'
+ model += ' <merge key="input.xkb.model" type="string">evdev</merge>'
+
+ return model
+
+def xkb_rules(value):
+ return ' <merge key="input.xkb.rules" type="string">%s</merge>' % (value,)
+
+def xkb_layout(value):
+ return ' <merge key="input.xkb.layout" type="string">%s</merge>' % (value,)
+
+def xkb_options(values):
+ options = ' <merge key="input.xkb.options" type="strlist">%s</merge>' % (values.split(',')[0])
+ for value in values.split(',')[1:]:
+ options += '\n' + ' <append key="input.xkb.options" type="strlist">%s</append>' % (value,)
+
+ return options
+
+def xkb_variant(value):
+ return ' <merge key="input.xkb.variant" type="string">%s</merge>' % (value,)
+
+if __name__ == '__main__':
+ OptionHandlers = {
+ 'XkbModel' : xkb_model,
+ 'XkbRules' : xkb_rules,
+ 'XkbLayout' : xkb_layout,
+ 'XkbOptions' : xkb_options,
+ 'XkbVariant' : xkb_variant,
+ }
+
+ (configuration, path) = xf86config.readConfigFile()
+
+ if not configuration:
+ sys.stderr.write("Failed to read xorg.conf\n")
+ sys.exit(-1)
+
+ try:
+ keyboard = xf86config.getCoreKeyboard(configuration)
+ except XF86SectionMissing:
+ sys.stderr.write("No CoreKeyboard\n")
+ sys.exit(-1)
+
+ rule = '<?xml version="1.0" encoding="utf-8"?>' + '\n'
+ rule += '<deviceinfo version="0.2">' + '\n'
+ rule += ' <match key="info.capabilities" contains="input.keys">' + '\n'
+ for option in keyboard.options:
+ if option.name in OptionHandlers:
+ rule += OptionHandlers[option.name](option.val) + '\n'
+ else:
+ sys.stderr.write('Failed to translate: %s %s\n' % (option.name, option.val))
+ rule += ' </match>' + '\n'
+ rule += '</deviceinfo>' + '\n'
+
+ print rule
+
+# vim: set ts=3 sw=3 et nowrap:
diff --git a/hal-config-examples/use-estonian-layout.fdi b/hal-config-examples/use-estonian-layout.fdi
new file mode 100644
index 00000000..4a3e087b
--- /dev/null
+++ b/hal-config-examples/use-estonian-layout.fdi
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Section "InputDevice"
+ Driver "evdev"
+ Option "XkbLayout" "ee"
+EndSection
+-->
+<deviceinfo version="0.2">
+ <match key="info.capabilities" contains="input.keyboard">
+ <merge key="input.xkb.layout" type="string">ee</merge>
+ </match>
+</deviceinfo>
diff --git a/hal-config-examples/use-kbd-driver.fdi b/hal-config-examples/use-kbd-driver.fdi
new file mode 100644
index 00000000..836e8a32
--- /dev/null
+++ b/hal-config-examples/use-kbd-driver.fdi
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+NOTE: This should only be used if you are unable to get your keyboard to
+work by any other means
+-->
+
+<!--
+Section "InputDevice"
+ Driver "kbd"
+EndSection
+-->
+<deviceinfo version="0.2">
+ <match key="info.capabilities" contains="input.keyboard">
+ <merge key="input.x11_driver" type="string">kbd</merge>
+ </match>
+</deviceinfo>
diff --git a/hal-config-examples/use-mouse-driver.fdi b/hal-config-examples/use-mouse-driver.fdi
new file mode 100644
index 00000000..08ea1d78
--- /dev/null
+++ b/hal-config-examples/use-mouse-driver.fdi
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+NOTE: This should only be used if you are unable to get your mouse to work by
+any other means
+-->
+
+<!--
+Section "InputDevice"
+ Driver "mouse"
+EndSection
+-->
+<deviceinfo version="0.2">
+ <match key="info.capabilities" contains="input.mouse">
+ <merge key="input.x11_driver" type="string">mouse</merge>
+ </match>
+</deviceinfo>
diff --git a/hal-config-examples/use-multiple-layouts-with-kbd.fdi b/hal-config-examples/use-multiple-layouts-with-kbd.fdi
new file mode 100644
index 00000000..2034e907
--- /dev/null
+++ b/hal-config-examples/use-multiple-layouts-with-kbd.fdi
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Section "InputDevice"
+ Driver "kbd"
+
+ Option "XkbModel" "pc105"
+ Option "XkbLayout" "en,fr"
+ Option "XkbOptions" "grp:shift_toggle"
+EndSection
+-->
+<deviceinfo version="0.2">
+ <match key="info.capabilities" contains="input.keyboard">
+ <merge key="input.xkb.model" type="string">pc105</merge>
+ <merge key="input.xkb.layout" type="string">en,fr</merge>
+ <merge key="input.xkb.options" type="strlist">grp:shift_toggle</merge>
+ </match>
+</deviceinfo>
diff --git a/hal-config-examples/use-multiple-layouts.fdi b/hal-config-examples/use-multiple-layouts.fdi
new file mode 100644
index 00000000..e9f289e4
--- /dev/null
+++ b/hal-config-examples/use-multiple-layouts.fdi
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Section "InputDevice"
+ Driver "evdev"
+
+ Option "XkbModel" "evdev"
+ Option "XkbLayout" "gb,pl"
+ Option "XkbVariant" "oss,winkeys"
+ Option "XkbOptions" "grp:caps_toggle,grp_led:caps,compose:ralt"
+EndSection
+-->
+<deviceinfo version="0.2">
+ <match key="info.capabilities" contains="input.keyboard">
+ <merge key="input.xkb.layout" type="string">gb,pl</merge>
+ <merge key="input.xkb.variant" type="string">,winkeys</merge>
+ <merge key="input.xkb.options" type="strlist">grp:caps_toggle</merge>
+ <append key="input.xkb.options" type="strlist">grp_led:caps</append>
+ <append key="input.xkb.options" type="strlist">compose:ralt</append>
+ </match>
+</deviceinfo>