On Thu, 2014-09-11 at 14:07 -0400, Benjamin Tissoires wrote: > PRODUCT attribute is set correctly for the input device, whether the > device is USB or Bluetooth. We can use a common path for those two. > uinput devices have their PRODUCT attribute set according to the > registered device, so they work too. > > This change allows libwacom to properly detect the actual PID of the > tablet connected through the wireless receiver when the following kernel > patch (or its sucessor) will be merged in 3.18: > https://patchwork.kernel.org/patch/4889811/ > > Signed-off-by: Benjamin Tissoires <benjamin.tissoi...@redhat.com> > --- > > Hi, > > so this is the second part of the kernel patch that can be found at > https://patchwork.kernel.org/patch/4889811/ > > There should not be any impact except for the wireless users. > PRODUCT is set by the input device, so theorically, the serial ones should > also > have it (I can not test this with my current setup). > > Cheers, > Benjamin > > libwacom/libwacom.c | 130 > +++++++++++++++++++++++++--------------------------- > 1 file changed, 62 insertions(+), 68 deletions(-) > > diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c > index 2a99c95..0257fbe 100644 > --- a/libwacom/libwacom.c > +++ b/libwacom/libwacom.c > @@ -88,6 +88,57 @@ get_uinput_subsystem (GUdevDevice *device) > return bus_str ? g_strdup (bus_str) : NULL; > } > > +static gboolean > +get_bus_vid_pid (GUdevDevice *device, > + WacomBusType *bus, > + int *vendor_id, > + int *product_id, > + WacomError *error) > +{ > + GUdevDevice *parent; > + const char *product_str; > + int garbage; > + int bus_id = -1; > + gboolean retval = FALSE; > + > + /* Parse that: > + * E: PRODUCT=5/56a/81/100 > + * into: > + * vendor 0x56a > + * product 0x81 */ <snip> > + if (!product_str || > + (sscanf (product_str, "%u/%x/%x/%d", &bus_id, vendor_id, > product_id, &garbage) != 4)) { > + libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to > parse model identification"); > + goto bail; > + }
I'd use g_strsplit() on the PRODUCT string, and parse each item separately with strtol/strtoul. ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel