setting evdev properties from HAL?
Simon Thum
simon.thum at gmx.de
Sun Jul 5 06:00:32 PDT 2009
Peter Hutterer wrote:
> On Sat, Jul 04, 2009 at 02:32:09PM +0200, Simon Thum wrote:
>> Asbjørn Sannes wrote:
>>> But for "Evdev Axis Calibration" I have not found anything that works ..
>>>
>>> Any hints and suggestions are welcome :)
>> One could probably do a patch which adds property manipulation to
>> config/hal, but it didn't surface yet.
>>
>> I remember to have heard hal can be configured to invoke scripts like
>> yours on device add/remove. Not sure of it, though.
>
> I started that once but I'm being told HAL is on its way out so I decided
> not to finish them. If you want to pick it up - be my guest, patches below.
> Having said that, it is questionable whether they will go upstream if you do
> finish them. There is quite a push away from HAL and adding new HAL-only
> functionality is not the way to go. Especially for things like this that can
> be set at runtime.
What I had in mind wasn't actually hal-only. AFAIK we already merge hal
keys into config. Likely, a udev-based solution would have to offer
something similar anyway. So if we pick up config items which e.g. start
with "Input Property " and then modify props accordingly, that might be
a more sustainable approach.
Thoughts?
Cheers,
Simon
>
> Time is possibly better spent investigating libudev and finding out how to
> automatically port current fdi configurations so they work on a udev-only
> system.
>
> Cheers,
> Peter
>
>>From 74c05685e47586f70e0d7b324a1e29eac44e59b9 Mon Sep 17 00:00:00 2001
> From: Peter Hutterer <peter.hutterer at who-t.net>
> Date: Thu, 26 Mar 2009 14:23:09 +1000
> Subject: [PATCH] config: rename LIBHAL_... defines for better namespacing.
>
> ---
> config/hal.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/config/hal.c b/config/hal.c
> index 36fa839..782fbb5 100644
> --- a/config/hal.c
> +++ b/config/hal.c
> @@ -40,8 +40,8 @@
> #include "os.h"
>
>
> -#define LIBHAL_PROP_KEY "input.x11_options."
> -#define LIBHAL_XKB_PROP_KEY "input.xkb."
> +#define LIBHAL_OPTIONS_KEY "input.x11_options."
> +#define LIBHAL_XKB_OPTIONS_KEY "input.xkb."
>
>
> struct config_hal_info {
> @@ -273,7 +273,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
> if (psi_key){
>
> /* normal options first (input.x11_options.<propname>) */
> - if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
> + if (!strncasecmp(psi_key, LIBHAL_OPTIONS_KEY, sizeof(LIBHAL_OPTIONS_KEY)-1)){
> char* tmp;
>
> /* only support strings for all values */
> @@ -319,7 +319,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
> } else
> {
> /* all others */
> - add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
> + add_option(&options, psi_key + sizeof(LIBHAL_OPTIONS_KEY)-1, tmp_val);
> xfree(tmp_val);
> }
> } else
> @@ -335,15 +335,15 @@ device_added(LibHalContext *hal_ctx, const char *udi)
> xkb_opts.options = strdup(tmp_val);
> }
> }
> - } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
> + } else if (!strncasecmp(psi_key, LIBHAL_XKB_OPTIONS_KEY, sizeof(LIBHAL_XKB_OPTIONS_KEY)-1)){
> char* tmp;
>
> /* only support strings for all values */
> tmp_val = get_prop_string(hal_ctx, udi, psi_key);
>
> - if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) {
> + if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_OPTIONS_KEY)) {
>
> - tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
> + tmp = &psi_key[sizeof(LIBHAL_XKB_OPTIONS_KEY) - 1];
>
> if (!strcasecmp(tmp, "layout"))
> {
> @@ -371,9 +371,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
> {
> /* server 1.4 had xkb options as strlist */
> tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
> - if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY))
> + if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_OPTIONS_KEY))
> {
> - tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
> + tmp = &psi_key[sizeof(LIBHAL_XKB_OPTIONS_KEY) - 1];
> if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
> xkb_opts.options = strdup(tmp_val);
> }
More information about the xorg
mailing list