From ea304cd7d48f2ab0c960ab0ed2a5d062c0e7c9d4 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Thu, 23 Jul 2009 10:09:11 +0000 Subject: [PATCH] - Error checking in the libudev device-id fallback code. --- hplip-device-id.patch | 19 +++++++++++-------- hplip.spec | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hplip-device-id.patch b/hplip-device-id.patch index bf9c57a..ed07ddb 100644 --- a/hplip-device-id.patch +++ b/hplip-device-id.patch @@ -1,6 +1,5 @@ -diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c ---- hplip-3.9.2/io/hpmud/musb.c.device-id 2009-02-20 00:36:44.000000000 +0000 -+++ hplip-3.9.2/io/hpmud/musb.c 2009-07-21 23:43:07.016138839 +0100 +--- hplip-3.9.2/io/hpmud/musb.c 2009-07-21 23:43:07.016138839 +0100 ++++ hplip-3.9.2/io/hpmud/musb.c 2009-07-23 11:04:59.504163043 +0100 @@ -26,6 +26,8 @@ #include "hpmud.h" @@ -10,7 +9,7 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c mud_device_vf __attribute__ ((visibility ("hidden"))) musb_mud_device_vf = { -@@ -1959,6 +1961,137 @@ bugout: +@@ -1959,6 +1961,143 @@ * USB probe devices, walk the USB bus(s) looking for HP products. */ @@ -115,6 +114,9 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c + udev_device_get_parent_with_subsystem_devtype (ddev, + "usb", + "usb_device"); ++ if (!parent_dev) ++ continue; ++ + idVendor = udev_device_get_sysattr_value (parent_dev, + "idVendor"); + if (!idVendor || strcmp (idVendor, "03f0")) @@ -134,6 +136,9 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c + + ieee1284_id = udev_device_get_sysattr_value (ddev, + "ieee1284_id"); ++ if (!ieee1284_id) ++ continue; ++ + strncpy (device_id, ieee1284_id, len); + device_id[len - 1] = '\0'; + } @@ -148,7 +153,7 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c int __attribute__ ((visibility ("hidden"))) musb_probe_devices(char *lst, int lst_size, int *cnt) { struct usb_bus *bus; -@@ -2006,6 +2139,7 @@ int __attribute__ ((visibility ("hidden" +@@ -2006,6 +2145,7 @@ if (model[0]) { @@ -156,7 +161,7 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c snprintf(sz, sizeof(sz), "hp:/usb/%s?serial=%s", model, serial); /* See if device is supported by hplip. */ -@@ -2016,17 +2150,19 @@ int __attribute__ ((visibility ("hidden" +@@ -2016,17 +2156,19 @@ continue; /* ignor, not supported */ } @@ -187,7 +192,6 @@ diff -up hplip-3.9.2/io/hpmud/musb.c.device-id hplip-3.9.2/io/hpmud/musb.c *cnt+=1; } } -diff -up hplip-3.9.2/Makefile.am.device-id hplip-3.9.2/Makefile.am --- hplip-3.9.2/Makefile.am.device-id 2009-02-20 00:36:58.000000000 +0000 +++ hplip-3.9.2/Makefile.am 2009-07-21 23:41:16.262138141 +0100 @@ -218,9 +218,9 @@ libhpmud_la_SOURCES = io/hpmud/hpmud.c i @@ -202,7 +206,6 @@ diff -up hplip-3.9.2/Makefile.am.device-id hplip-3.9.2/Makefile.am endif libhpmud_la_CFLAGS = -DMUDNAME=\"$(MUDNAME)\" -DCONFDIR=\"$(hplip_confdir)\" -diff -up hplip-3.9.2/Makefile.in.device-id hplip-3.9.2/Makefile.in --- hplip-3.9.2/Makefile.in.device-id 2009-02-20 00:37:52.000000000 +0000 +++ hplip-3.9.2/Makefile.in 2009-07-21 23:41:16.272138156 +0100 @@ -3954,8 +3954,8 @@ dist_unrel_DATA = diff --git a/hplip.spec b/hplip.spec index dc2fed7..ccd742a 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.9.2 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -336,6 +336,9 @@ fi exit 0 %changelog +* Thu Jul 23 2009 Tim Waugh 3.9.2-7 +- Error checking in the libudev device-id fallback code. + * Tue Jul 21 2009 Tim Waugh 3.9.2-6 - Fixed device-id reporting.