- Error checking in the libudev device-id fallback code.

This commit is contained in:
Tim Waugh 2009-07-23 10:09:11 +00:00
parent c9f40bbed6
commit ea304cd7d4
2 changed files with 15 additions and 9 deletions

View File

@ -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 2009-07-21 23:43:07.016138839 +0100
--- 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-23 11:04:59.504163043 +0100
+++ hplip-3.9.2/io/hpmud/musb.c 2009-07-21 23:43:07.016138839 +0100
@@ -26,6 +26,8 @@ @@ -26,6 +26,8 @@
#include "hpmud.h" #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 = 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. * 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, + udev_device_get_parent_with_subsystem_devtype (ddev,
+ "usb", + "usb",
+ "usb_device"); + "usb_device");
+ if (!parent_dev)
+ continue;
+
+ idVendor = udev_device_get_sysattr_value (parent_dev, + idVendor = udev_device_get_sysattr_value (parent_dev,
+ "idVendor"); + "idVendor");
+ if (!idVendor || strcmp (idVendor, "03f0")) + 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 = udev_device_get_sysattr_value (ddev,
+ "ieee1284_id"); + "ieee1284_id");
+ if (!ieee1284_id)
+ continue;
+
+ strncpy (device_id, ieee1284_id, len); + strncpy (device_id, ieee1284_id, len);
+ device_id[len - 1] = '\0'; + 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) int __attribute__ ((visibility ("hidden"))) musb_probe_devices(char *lst, int lst_size, int *cnt)
{ {
struct usb_bus *bus; struct usb_bus *bus;
@@ -2006,6 +2139,7 @@ int __attribute__ ((visibility ("hidden" @@ -2006,6 +2145,7 @@
if (model[0]) 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); snprintf(sz, sizeof(sz), "hp:/usb/%s?serial=%s", model, serial);
/* See if device is supported by hplip. */ /* See if device is supported by hplip. */
@@ -2016,17 +2150,19 @@ int __attribute__ ((visibility ("hidden" @@ -2016,17 +2156,19 @@
continue; /* ignor, not supported */ 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; *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.device-id 2009-02-20 00:36:58.000000000 +0000
+++ hplip-3.9.2/Makefile.am 2009-07-21 23:41:16.262138141 +0100 +++ 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 @@ -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 endif
libhpmud_la_CFLAGS = -DMUDNAME=\"$(MUDNAME)\" -DCONFDIR=\"$(hplip_confdir)\" 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.device-id 2009-02-20 00:37:52.000000000 +0000
+++ hplip-3.9.2/Makefile.in 2009-07-21 23:41:16.272138156 +0100 +++ hplip-3.9.2/Makefile.in 2009-07-21 23:41:16.272138156 +0100
@@ -3954,8 +3954,8 @@ dist_unrel_DATA = @@ -3954,8 +3954,8 @@ dist_unrel_DATA =

View File

@ -1,7 +1,7 @@
Summary: HP Linux Imaging and Printing Project Summary: HP Linux Imaging and Printing Project
Name: hplip Name: hplip
Version: 3.9.2 Version: 3.9.2
Release: 6%{?dist} Release: 7%{?dist}
License: GPLv2+ and MIT License: GPLv2+ and MIT
Group: System Environment/Daemons Group: System Environment/Daemons
Conflicts: system-config-printer < 0.6.132 Conflicts: system-config-printer < 0.6.132
@ -336,6 +336,9 @@ fi
exit 0 exit 0
%changelog %changelog
* Thu Jul 23 2009 Tim Waugh <twaugh@redhat.com> 3.9.2-7
- Error checking in the libudev device-id fallback code.
* Tue Jul 21 2009 Tim Waugh <twaugh@redhat.com> 3.9.2-6 * Tue Jul 21 2009 Tim Waugh <twaugh@redhat.com> 3.9.2-6
- Fixed device-id reporting. - Fixed device-id reporting.