Re: setting evdev properties from HAL?

2009-07-05 Thread Simon Thum
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.hutte...@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);
  }

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: setting evdev properties from HAL?

2009-07-05 Thread Peter Hutterer
On Sun, Jul 05, 2009 at 03:00:32PM +0200, Simon Thum wrote:
 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.

So, thinking about the whole problem again: the whole reason for properties
is that they are run-time configurable and not just available at server
startup. 

So - yes - we could add more logic to the server to parse the options at
device init time. We need to ensure this configuration and parsing happens
with a pure HAL configuration, a xorg.conf and libudev.
Which means we have one more API to maintain (that is possibly not even
going to be used that much). And this API has some overlap with the Options
parsing stuff from the config file. So we're left with two independent
parsing APIs, users possibly mixing both of them into their configurations,
making support quite interesting. For example, if you can set the same
option through properties and through a traditional Options flag, it comes
down to the driver implementation which one has precedence.

I think we should just encourage the development of client applications that
provide user-configurable property setting mechanisms instead.

Cheers,
  Peter
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: setting evdev properties from HAL?

2009-07-04 Thread Simon Thum
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.

___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: setting evdev properties from HAL?

2009-07-04 Thread Peter Hutterer
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.

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.hutte...@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);
 }
-- 
1.6.0.6


From 96bbf362cb7a9c624189b6c53c4578a3496abddd Mon Sep 17 00:00:00 2001
From: Peter Hutterer peter.hutte...@who-t.net
Date: Thu, 26 Mar 2009 14:23:47 +1000
Subject: [PATCH] config: allow device labelling through hal keys.

Supports hal keys in the following format:
append key=input.x11_property.abc type=strlist123/append
append key=input.x11_property.abc type=strlist456/append
append key=input.x11_property.foo type=strlistbar/append

The above results in two properties being added to the input device:
  abc - 123, 456
  foo - bar

Where both abc and foo are properties that contain lists of Atoms (and
123, 456 and bar are Atoms created on-the-fly).

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 config/hal.c |   90 

setting evdev properties from HAL?

2009-07-01 Thread Asbjørn Sannes
hi,

I'm trying to make an fdi file that will do the equivalent of (which
works great):
xinput set-int-prop ITM Inc USB Touch Panel Evdev Axis Inversion 8 1 1
xinput set-int-prop ITM Inc USB Touch Panel Evdev Axes Swap 8 1
xinput set-int-prop ITM Inc USB Touch Panel Evdev Axis Calibration
32 263 3850 152 3914

For Evdev Axis Inversion I have found I can do:
merge key=input.x11_options.InvertX type=stringtrue/merge
merge key=input.x11_options.InvertY type=stringtrue/merge

and for Evdev Axes Swap I can do:
merge key=input.x11_options.SwapAxes type=stringtrue/merge

But for Evdev Axis Calibration I have not found anything that works ..

Any hints and suggestions are welcome :)

I am currently running Xorg 1.6.1, evdev 2.2.2 and hal 0.5.12rc1 (and
gentoo -r6).

--
Asbjorn Sannes


___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg


Re: setting evdev properties from HAL?

2009-07-01 Thread Dan Nicholson
2009/7/1 Asbjørn Sannes a...@sannes.org:
 hi,

 I'm trying to make an fdi file that will do the equivalent of (which
 works great):
 xinput set-int-prop ITM Inc USB Touch Panel Evdev Axis Inversion 8 1 1
 xinput set-int-prop ITM Inc USB Touch Panel Evdev Axes Swap 8 1
 xinput set-int-prop ITM Inc USB Touch Panel Evdev Axis Calibration
 32 263 3850 152 3914

 For Evdev Axis Inversion I have found I can do:
 merge key=input.x11_options.InvertX type=stringtrue/merge
 merge key=input.x11_options.InvertY type=stringtrue/merge

 and for Evdev Axes Swap I can do:
 merge key=input.x11_options.SwapAxes type=stringtrue/merge

 But for Evdev Axis Calibration I have not found anything that works ..

 Any hints and suggestions are welcome :)

 I am currently running Xorg 1.6.1, evdev 2.2.2 and hal 0.5.12rc1 (and
 gentoo -r6).

Unfortunately, I doesn't seem that the calibration property has an
equivalent xorg.conf option since it's intended for runtime
calibration.

--
Dan
___
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg