From 0aa4b27ada9f506776c1476b4cb421b569e217fa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: May 06 2009 20:25:09 +0000 Subject: read pnp ids from hwdata, if available --- diff --git a/gnome-desktop.spec b/gnome-desktop.spec index 35e4311..ff93231 100644 --- a/gnome-desktop.spec +++ b/gnome-desktop.spec @@ -12,13 +12,15 @@ Summary: Package containing code shared among gnome-panel, gnome-session, nautilus, etc Name: gnome-desktop Version: 2.26.1 -Release: 4%{?dist} +Release: 5%{?dist} URL: http://www.gnome.org Source0: http://download.gnome.org/sources/gnome-desktop/2.26/%{name}-%{version}.tar.bz2 # fixed upstream Patch0: give-me-back-my-rotations.patch # fixed upstream Patch1: you-never-find-a-haystack-in-a-needle.patch +# http://bugzilla.gnome.org/show_bug.cgi?id=581621 +Patch2: pnpids.patch License: GPLv2+ and LGPLv2+ Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -78,6 +80,7 @@ libgnomedesktop. %setup -q %patch0 -p1 -b .rotations %patch1 -p1 -b .unknown-monitors +%patch2 -p1 -b .pnpids.patch %build %configure --with-gnome-distributor="Red Hat, Inc" --disable-scrollkeeper @@ -123,6 +126,9 @@ rm -rf $RPM_BUILD_ROOT %doc %{_datadir}/gtk-doc/html/gnome-desktop/ %changelog +* Wed May 6 2009 Matthias Clasen - 2.26.1-5 +- Read vendor names from hwdata, when available + * Wed Apr 29 2009 Matthias Clasen - 2.26.1-4 - Remove debug spew diff --git a/pnpids.patch b/pnpids.patch new file mode 100644 index 0000000..3f35365 --- /dev/null +++ b/pnpids.patch @@ -0,0 +1,62 @@ +--- gnome-desktop-2.26.1/libgnome-desktop/display-name.c 2009-05-06 16:19:08.498375080 -0400 ++++ hacked/libgnome-desktop/display-name.c 2009-05-06 16:17:08.483375623 -0400 +@@ -182,15 +182,58 @@ + { "???", "Unknown" }, + }; + ++static GHashTable *hwdata = NULL; ++ ++#define PNP_IDS "/usr/share/hwdata/pnp.ids" ++ ++static void ++read_hwdata (void) ++{ ++ gchar *contents; ++ gchar **lines; ++ gchar *line; ++ gchar *code, *name; ++ gint i; ++ ++ if (hwdata) ++ return; ++ ++ hwdata = g_hash_table_new (g_str_hash, g_str_equal); ++ ++ if (g_file_get_contents (PNP_IDS, &contents, NULL, NULL)) { ++ lines = g_strsplit (contents, "\n", -1); ++ for (i = 0; lines[i]; i++) { ++ line = lines[i]; ++ if (line[3] == '\t') { ++ code = line; ++ line[3] = '\0'; ++ name = line + 4; ++ g_hash_table_insert (hwdata, code, name); ++ } ++ } ++ g_free (lines); ++ } ++ g_free (contents); ++} ++ ++ + static const char * + find_vendor (const char *code) + { + int i; ++ const char *vendor_name; ++ ++ read_hwdata (); ++ ++ vendor_name = g_hash_table_lookup (hwdata, code); ++ ++ if (vendor_name) ++ return vendor_name; + + for (i = 0; i < sizeof (vendors) / sizeof (vendors[0]); ++i) + { + const Vendor *v = &(vendors[i]); +- ++ + if (strcmp (v->vendor_id, code) == 0) + return v->vendor_name; + }