libwacom is the only entity that knows whether a device is reversible. Export
this info through udev so we can make use of it in libinput.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
I'd prefer to have this in hwdb but as long as we only have one setting
adding it to the rule should do.

 tools/generate-udev-rules.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/generate-udev-rules.c b/tools/generate-udev-rules.c
index ff95e60..1a3802d 100644
--- a/tools/generate-udev-rules.c
+++ b/tools/generate-udev-rules.c
@@ -58,7 +58,8 @@ static void print_udev_entry_for_match (WacomDevice *device, 
const WacomMatch *m
        WacomBusType type       = libwacom_match_get_bustype (match);
        int          vendor     = libwacom_match_get_vendor_id (match);
        int          product    = libwacom_match_get_product_id (match);
-       char         *matchstr;
+       char         *matchstr,
+                    *reversible = NULL;
 
        if (bus_type_filter != type)
                return;
@@ -79,9 +80,14 @@ static void print_udev_entry_for_match (WacomDevice *device, 
const WacomMatch *m
                        return;
        }
 
+       if (libwacom_is_reversible (device))
+               reversible = ", ENV{TABLET_IS_REVERSIBLE}=\"1\"";
+       else
+               reversible = "";
+
        printf ("# %s\n", libwacom_get_name (device));
        /* unset joystick, set tablet */
-       printf ("%s ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
ENV{ID_INPUT_TABLET}=\"1\"\n", matchstr);
+       printf ("%s ENV{ID_INPUT}=\"1\", ENV{ID_INPUT_JOYSTICK}=\"\", 
ENV{ID_INPUT_TABLET}=\"1\"%s\n", matchstr, reversible);
 
        if (libwacom_has_touch (device))
                printf( "ATTRS{name}==\"* Finger\", %s 
ENV{ID_INPUT_TOUCHPAD}=\"1\"\n", matchstr);
-- 
2.1.0


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to