Fix crash with WACf* serial devices (if not inputattach'd) (#819191)

This commit is contained in:
Peter Hutterer 2012-05-08 14:02:20 +10:00
parent 4f8c4d0d8d
commit d8b5169eac
3 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From ee783c532efef4300360d0d84936650ab0091ef2 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 8 May 2012 13:55:17 +1000
Subject: [PATCH] lib: fix an error message
Leftover error message from when this was serial-only code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
libwacom/libwacom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 821e3ee..359e945 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -229,7 +229,7 @@ get_device_info (const char *path,
g_assert (product_str);
if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
- libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unimplemented serial bus");
+ libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
g_object_unref(parent);
goto bail;
}
--
1.7.10.1

View File

@ -0,0 +1,45 @@
From bbaec8323f2a6930c851d7ffe8461ce6a5280f4f Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 8 May 2012 13:57:00 +1000
Subject: [PATCH] lib: serial devices may end up with a NULL product_str
If not inputattached, the product_str is NULL and udev doesn't provide a way
to query it. Assume it as 0 instead of crashing.
https://bugzilla.redhat.com/show_bug.cgi?id=819191
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
libwacom/libwacom.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 359e945..482baa5 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -227,11 +227,17 @@ get_device_info (const char *path,
g_object_unref (old_parent);
}
- g_assert (product_str);
- if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
- libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
- g_object_unref(parent);
- goto bail;
+ if (product_str) {
+ if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
+ libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
+ g_object_unref(parent);
+ goto bail;
+ }
+ } else {
+ g_assert(*bus == WBUSTYPE_SERIAL);
+
+ *vendor_id = 0;
+ *product_id = 0;
}
if (parent)
g_object_unref (parent);
--
1.7.10.1

View File

@ -1,6 +1,6 @@
Name: libwacom
Version: 0.5
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Tablet Information Client Library
Requires: %{name}-data
@ -14,6 +14,8 @@ Source1: libwacom.rules
Patch01: 0001-data-add-generic-eraser-to-Bamboo-Pen-Touch.patch
Patch02: 0001-lib-Fix-generic-stylus-missing-an-eraser.patch
Patch03: 0001-tools-add-missing-linker-flags-for-list-local-device.patch
Patch04: 0001-lib-fix-an-error-message.patch
Patch05: 0001-lib-serial-devices-may-end-up-with-a-NULL-product_st.patch
BuildRequires: autoconf automake libtool doxygen
BuildRequires: glib2-devel libgudev1-devel
@ -43,6 +45,8 @@ Tablet information client library library data files.
%patch01 -p1
%patch02 -p1
%patch03 -p1
%patch04 -p1
%patch05 -p1
%build
autoreconf --force -v --install || exit 1
@ -84,6 +88,9 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_datadir}/libwacom/*.stylus
%changelog
* Tue May 08 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.5-3
- Fix crash with WACf* serial devices (if not inputattach'd) (#819191)
* Thu May 03 2012 Peter Hutterer <peter.hutterer@redhat.com> 0.5-2
- Fix gnome-control-center crash for Bamboo Pen & Touch
- Generic styli needs to have erasers, default to two tools.