This property is now used in input drivers to export product/vendor ID to
clients.

Note that this patch has a minor other change: together with the new
vendor_id, tablet_id is now set on the common struct during ProbeKeys.
Before, the tablet_id was only returned. This choice was for consistency and
should have no functional effect since the first thing we did with the
returned tablet_id was to set it anyway.

Signed-off-by: Peter Hutterer <[email protected]>
---

If anyone happens to know the vendor ID for Fujitsu, that'd be much
appreciated

 src/wcmISDV4.c      |   15 +++++++++++----
 src/wcmUSB.c        |    3 +++
 src/wcmXCommand.c   |   10 +++++++++-
 src/xf86WacomDefs.h |    1 +
 4 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index db0d83e..e199521 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -881,14 +881,15 @@ static int set_keybits_fujitsu(int id, unsigned long 
*keys)
 
 typedef struct {
        const char *pattern; /* sscanf matching pattern to extract ID */
+       const int vendor_id;
        /* set the bits in the given keys array based on the id. return the
         * tablet_id or the closest guess anyway */
        int (*set_bits)(int id, unsigned long* keys);
 } ISDV4ModelDesc;
 
 static ISDV4ModelDesc isdv4_models[] = {
-       { "WACf%x", set_keybits_wacom },
-       { "FUJ%x", set_keybits_fujitsu },
+       { "WACf%x", WACOM_VENDOR_ID, set_keybits_wacom },
+       { "FUJ%x", 0 /* FIXME: */, set_keybits_fujitsu },
        { NULL, 0 }
 };
 
@@ -989,12 +990,18 @@ static int isdv4ProbeKeys(InputInfoPtr pInfo)
        SETBIT(common->wcmKeys, BTN_TOOL_PEN);
        SETBIT(common->wcmKeys, BTN_TOOL_RUBBER);
 
-       if (model && model->set_bits)
-               tablet_id = model->set_bits(id, common->wcmKeys);
+       if (model)
+       {
+               common->vendor_id = model->vendor_id;
+               if (model->set_bits)
+                       tablet_id = model->set_bits(id, common->wcmKeys);
+       }
 
        /* Change to generic protocol to match USB MT format */
        common->wcmProtocolLevel = WCM_PROTOCOL_GENERIC;
 
+       common->tablet_id = tablet_id;
+
        return tablet_id;
 }
 
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index dece422..0ea7737 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1675,6 +1675,9 @@ static int usbProbeKeys(InputInfoPtr pInfo)
                usbGenericTouchscreenQuirks(common->wcmKeys, abs);
        }
 
+       common->vendor_id = wacom_id.vendor;
+       common->tablet_id = wacom_id.product;
+
        return wacom_id.product;
 }
 
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 65854b0..d16ac2b 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -29,6 +29,9 @@
 #ifndef XI_PROP_DEVNODE
 #define XI_PROP_DEVNODE "Device Node"
 #endif
+#ifndef XI_PROP_PRODUCT_ID
+#define XI_PROP_PRODUCT_ID "Device Product ID"
+#endif
 
 static void wcmBindToSerial(InputInfoPtr pInfo, unsigned int serial);
 
@@ -95,6 +98,7 @@ Atom prop_gesture_param;
 Atom prop_hover;
 Atom prop_tooltype;
 Atom prop_btnactions;
+Atom prop_product_id;
 #ifdef DEBUG
 Atom prop_debuglevels;
 #endif
@@ -232,6 +236,10 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
                prop_wheel_buttons = InitWcmAtom(pInfo->dev, 
WACOM_PROP_WHEELBUTTONS, -32, 4, values);
        }
 
+       values[0] = common->vendor_id;
+       values[1] = common->tablet_id;
+       prop_product_id = InitWcmAtom(pInfo->dev, XI_PROP_PRODUCT_ID, 32, 2, 
values);
+
 #ifdef DEBUG
        values[0] = priv->debugLevel;
        values[1] = common->debugLevel;
@@ -608,7 +616,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
 
        DBG(10, priv, "\n");
 
-       if (property == prop_devnode)
+       if (property == prop_devnode || property == prop_product_id)
                return BadValue; /* Read-only */
        else if (property == prop_tablet_area)
        {
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 7b6b80b..f054d2c 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -434,6 +434,7 @@ struct _WacomCommonRec
        dev_t min_maj;               /* minor/major number */
        unsigned char wcmFlags;     /* various flags (handle tilt) */
        int debugLevel;
+       int vendor_id;               /* Vendor ID */
        int tablet_id;               /* USB tablet ID */
        int tablet_type;             /* bitmask of tablet features (WCM_LCD, 
WCM_PEN, etc) */
        int fd;                      /* file descriptor to tablet */
-- 
1.7.5.1


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to