[Pkg-utopia-commits] r137 - in packages/hal/trunk/debian: . patches

Sjoerd Simons sjoerd@haydn.debian.org
Wed, 08 Dec 2004 07:55:19 -0700


Author: sjoerd
Date: 2004-12-08 07:54:45 -0700 (Wed, 08 Dec 2004)
New Revision: 137

Added:
   packages/hal/trunk/debian/patches/cdrom-media-check.patch
   packages/hal/trunk/debian/patches/fix-ide-fdi.patch
   packages/hal/trunk/debian/patches/ids-search.patch
   packages/hal/trunk/debian/patches/poll-only-cdroms.patch
Modified:
   packages/hal/trunk/debian/changelog
Log:
* Sync patches with ubuntu again



Modified: packages/hal/trunk/debian/changelog
===================================================================
--- packages/hal/trunk/debian/changelog	2004-12-08 14:32:01 UTC (rev 136)
+++ packages/hal/trunk/debian/changelog	2004-12-08 14:54:45 UTC (rev 137)
@@ -1,7 +1,21 @@
 hal (0.4.2-2) UNRELEASED; urgency=low
 
   * debian/patches/fstab-sync-crash.patch
-    + Don't crash on cleaning fstab in certain circumstances (Closes: #284721)
+    + Added. Don't crash on cleaning fstab in certain 
+      circumstances (Closes: #284721)
+  * debian/patches/ids-search.patch
+    + Added. Search for pci.ids and usb.ids runtime, so stuff doesn't break
+      when it's moved around. 
+  * debian/patches/fix-ide-fdi.patch
+    + Added. Correct syntax error in the fdi file
+  * debian/patches/cdrom-media-check.patch
+    + Added. Some CD-ROMs report that they contain a CD even if the tray is 
+      open; probe CDROM_MEDIA_CHANGED twice to check whether there is indeed a 
+      CD inside.Thanks to Michael Hofmann for discovering this and 
+      finding the fix.
+  * debian/patches/poll-only-cdroms.patch:
+    + Added. Instead of trying to work around broken ide pcmcia device just
+      poll cdrom on the ide bus. Patch from David Zeuthen (Closes: #284164)
 
  -- Sjoerd Simons <sjoerd@debian.org>  Thu,  2 Dec 2004 14:18:04 +0100
 

Added: packages/hal/trunk/debian/patches/cdrom-media-check.patch
===================================================================
--- packages/hal/trunk/debian/patches/cdrom-media-check.patch	2004-12-08 14:32:01 UTC (rev 136)
+++ packages/hal/trunk/debian/patches/cdrom-media-check.patch	2004-12-08 14:54:45 UTC (rev 137)
@@ -0,0 +1,31 @@
+--- hal-0.4.2/hald/linux/block_class_device.c
++++ hal-0.4.2.new/hald/linux/block_class_device.c
+@@ -354,7 +354,7 @@
+ 	}
+ 	
+ 	/* while we're at it, check if we support media changed */
+-	if (ioctl (fd, CDROM_MEDIA_CHANGED) >= 0) {
++	if (capabilities & CDC_MEDIA_CHANGED) {
+ 		hal_device_property_set_bool (d, "storage.cdrom.support_media_changed", TRUE);
+ 	} else {
+ 		hal_device_property_set_bool (d, "storage.cdrom.support_media_changed", FALSE);
+@@ -879,7 +879,18 @@
+ 			break;
+ 			
+ 		case CDS_DISC_OK:
+-			got_media = TRUE;
++			HAL_INFO (("CD-ROM drive %s is reported to contain a CD.", device_file));
++
++			/* some CD-ROMs report CDS_DISK_OK even with an open
++			 * tray; if media check has the same value two times in
++			 * a row then this seems to be the case and we must not
++			 * report that there is a media in it. */
++			if (hal_device_property_get_bool (d, "storage.cdrom.support_media_changed") &&
++			    ioctl (fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT) && 
++			    ioctl (fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT)) 
++				HAL_INFO (("CD-ROM drive %s: media checking is broken, assuming no CD is inside.", device_file));
++			else
++			    got_media = TRUE;
+ 			break;
+ 			
+ 		case -1:

Added: packages/hal/trunk/debian/patches/fix-ide-fdi.patch
===================================================================
--- packages/hal/trunk/debian/patches/fix-ide-fdi.patch	2004-12-08 14:32:01 UTC (rev 136)
+++ packages/hal/trunk/debian/patches/fix-ide-fdi.patch	2004-12-08 14:54:45 UTC (rev 137)
@@ -0,0 +1,10 @@
+diff -Nur hal-0.4.2/fdi/20freedesktop/ide-drives.fdi hal-0.4.2.new/fdi/20freedesktop/ide-drives.fdi
+--- hal-0.4.2/fdi/20freedesktop/ide-drives.fdi	2004-12-01 05:22:07.000000000 +0100
++++ hal-0.4.2.new/fdi/20freedesktop/ide-drives.fdi	2004-12-06 14:57:54.374932000 +0100
+@@ -47,5 +47,5 @@
+       </match>
+     </match>
+ 
+-  <device>
++  </device>
+ </deviceinfo>

Added: packages/hal/trunk/debian/patches/ids-search.patch
===================================================================
--- packages/hal/trunk/debian/patches/ids-search.patch	2004-12-08 14:32:01 UTC (rev 136)
+++ packages/hal/trunk/debian/patches/ids-search.patch	2004-12-08 14:54:45 UTC (rev 137)
@@ -0,0 +1,106 @@
+Index: configure.in
+===================================================================
+RCS file: /cvs/hal/hal/configure.in,v
+retrieving revision 1.57
+diff -u -r1.57 configure.in
+--- configure.in	1 Nov 2004 23:19:04 -0000	1.57
++++ configure.in	7 Dec 2004 15:17:08 -0000
+@@ -18,20 +18,6 @@
+ 
+ AC_ARG_WITH(init-scripts,       [  --with-init-scripts=<os> Style of init scripts to install (redhat)])
+ AC_ARG_WITH(pid-file,    [  --with-pid-file=<file>  PID file for HAL daemon])
+-AC_ARG_WITH(hwdata,[  --with-hwdata=<dir>     where PCI and USB IDs are found (auto)])
+-if ! test -z "$with_hwdata" ; then
+-   HWDATA_DIR="$with_hwdata"
+-else
+-   for dir in /usr/share/hwdata /usr/share/misc /usr/share; do
+-      AC_CHECK_FILE($dir/pci.ids,HWDATA_DIR=$dir)
+-   done
+-fi
+-if test -z "$HWDATA_DIR"; then
+-   AC_ERROR(cannot find pci.ids. Use --with-hwdata to specify location)
+-fi
+-AC_SUBST(HWDATA_DIR)
+-AC_DEFINE_UNQUOTED(HWDATA_DIR,"$HWDATA_DIR", [Where PCI and USB IDs are found])
+-
+ 
+ AC_ARG_WITH(hal_user,[  --with-hal-user=<user>  User for running the HAL daemon (haldaemon)])
+ if test -z "$with_hal_user" ; then
+Index: hald/linux/pci_bus_device.c
+===================================================================
+RCS file: /cvs/hal/hal/hald/linux/pci_bus_device.c,v
+retrieving revision 1.9
+diff -u -r1.9 pci_bus_device.c
+--- hald/linux/pci_bus_device.c	14 Oct 2004 19:21:41 -0000	1.9
++++ hald/linux/pci_bus_device.c	7 Dec 2004 15:17:09 -0000
+@@ -283,7 +283,6 @@
+ 
+ 	fp = fopen (path, "r");
+ 	if (fp == NULL) {
+-		HAL_ERROR (("couldn't open PCI database at %s,", path));
+ 		return FALSE;
+ 	}
+ 
+@@ -369,11 +368,24 @@
+ static void
+ pci_device_init (BusDeviceHandler *self)
+ {
++	dbus_bool_t ret = FALSE;
++	int i;
++	char *locations[] = { "/usr/share/hwdata/pci.ids",
++                        "/usr/share/misc/pci.ids",
++                        "/usr/share/pci.ids",
++                        "/var/lib/misc/pci.ids",
++                        NULL
++	};
+ 	/* get all drivers under /sys/bus/pci/drivers */
+ 	drivers_collect ("pci");
+ 
+ 	/* Load /usr/share/hwdata/pci.ids */
+-	pci_ids_load (HWDATA_DIR "/pci.ids");
++	for (i=0 ; locations[i] != NULL && !ret ; i++) {
++		ret = pci_ids_load (locations[i]);
++	}
++	if (!ret) {
++		HAL_ERROR (("couldn't open PCI database"));
++	}
+ }
+ 
+ /** Shutdown function for PCI handling
+Index: hald/linux/usb_bus_device.c
+===================================================================
+RCS file: /cvs/hal/hal/hald/linux/usb_bus_device.c,v
+retrieving revision 1.15
+diff -u -r1.15 usb_bus_device.c
+--- hald/linux/usb_bus_device.c	14 Oct 2004 18:51:12 -0000	1.15
++++ hald/linux/usb_bus_device.c	7 Dec 2004 15:17:09 -0000
+@@ -549,15 +549,26 @@
+ static void
+ usb_device_init ()
+ {
++	dbus_bool_t ret = FALSE;
++	int i;
++	char *locations[] = { "/usr/share/hwdata/usb.ids",
++                        "/usr/share/misc/usb.ids",
++                        "/usr/share/usb.ids",
++                        "/var/lib/misc/usb.ids",
++                        NULL
++	};
+ 
+ 	/* get all drivers under /sys/bus/usb/drivers */
+ 	drivers_collect ("usb");
+ 
+ 	/* Load /usr/share/hwdata/usb.ids */
+-	usb_ids_load (HWDATA_DIR "/usb.ids");
+-
++	for (i=0; locations[i] != NULL && !ret ; i++) {
++		ret = usb_ids_load (locations[i]);
++	}
++	if (!ret) {
++		HAL_ERROR (("couldn't open USB database"));
++	}
+ 	/* Parse /proc/bus/usb/devices */
+-
+ 	usb_proc_parse ();
+ }
+ 

Added: packages/hal/trunk/debian/patches/poll-only-cdroms.patch
===================================================================
--- packages/hal/trunk/debian/patches/poll-only-cdroms.patch	2004-12-08 14:32:01 UTC (rev 136)
+++ packages/hal/trunk/debian/patches/poll-only-cdroms.patch	2004-12-08 14:54:45 UTC (rev 137)
@@ -0,0 +1,100 @@
+Index: hald/linux/block_class_device.c
+===================================================================
+RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
+retrieving revision 1.86.2.2
+diff -u -p -r1.86.2.2 block_class_device.c
+--- hald/linux/block_class_device.c	1 Dec 2004 03:39:01 -0000	1.86.2.2
++++ hald/linux/block_class_device.c	6 Dec 2004 22:38:52 -0000
+@@ -1384,43 +1384,19 @@ block_class_pre_process (ClassDeviceHand
+ 	HAL_INFO (("Bus type is %s!",
+ 		   hal_device_property_get_string (parent, "info.bus")));
+ 
+-	if (strcmp (hal_device_property_get_string (parent, "info.bus"),
+-			    "ide") == 0) {
++	if (strcmp (hal_device_property_get_string (parent, "info.bus"), "ide") == 0) {
+ 		const char *ide_name;
+ 		char *model;
+ 		char *media;
+ 
++		/* Be conservative and don't poll IDE drives at all */
++		hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
+ 
+-		/* blacklist the broken ide-cs driver */
+-		if (physdev != NULL) {
+-			size_t len;
+-			char buf[256];
+-			const char *physdev_sysfs_path;
+-			
+-			snprintf (buf, 256, "%s/devices/ide", sysfs_mount_path);
+-			len = strlen (buf);
+-			
+-			physdev_sysfs_path = hal_device_property_get_string (physdev, "linux.sysfs_path");
+-			
+-			if (strncmp (physdev_sysfs_path, buf, len) == 0) {
+-				hal_device_property_set_bool (stordev, "storage.media_check_enabled", FALSE);
+-			}
+-			
+-			HAL_INFO (("Working around broken ide-cs driver for %s", physdev->udi));
+-		}
+-
+-
+-		ide_name = get_last_element (hal_device_property_get_string
+-					     (d, "linux.sysfs_path"));
+-
++		ide_name = get_last_element (hal_device_property_get_string (d, "linux.sysfs_path"));
+ 		model = read_single_line ("/proc/ide/%s/model", ide_name);
+ 		if (model != NULL) {
+-			hal_device_property_set_string (stordev,
+-							"storage.model",
+-							model);
+-			hal_device_property_set_string (d, 
+-							"info.product",
+-							model);
++			hal_device_property_set_string (stordev, "storage.model", model);
++			hal_device_property_set_string (d, "info.product", model);
+ 		}
+ 
+ 		/* According to the function proc_ide_read_media() in 
+@@ -1429,38 +1405,21 @@ block_class_pre_process (ClassDeviceHand
+ 		 * "UNKNOWN"
+ 		 */
+ 		
+-		/** @todo Given floppy how
+-		 *        do we determine it's LS120?
+-		 */
+-			
+-		media = read_single_line ("/proc/ide/%s/media",
+-					  ide_name);
++		media = read_single_line ("/proc/ide/%s/media", ide_name);
+ 		if (media != NULL) {
+-			hal_device_property_set_string (stordev, 
+-							"storage.drive_type",
+-							media);
++			hal_device_property_set_string (stordev, "storage.drive_type", media);
+ 			
+ 			/* Set for removable media */
+ 			if (strcmp (media, "disk") == 0) {
+ 				/* left blank */
+ 			} else if (strcmp (media, "cdrom") == 0) {
+ 				has_removable_media = TRUE;
++				/* cdroms are the only IDE devices that are safe to poll */
++				hal_device_property_set_bool (d, "storage.media_check_enabled", TRUE);
+ 			} else if (strcmp (media, "floppy") == 0) {
+ 				has_removable_media = TRUE;
+-
+-				/* I've got a LS120 that identifies as a
+-				 * floppy; polling doesn't work so disable
+-				 * media check and automount
+-				 */
+-				hal_device_property_set_bool (
+-					d, "storage.media_check_enabled", FALSE);
+-				hal_device_property_set_bool (
+-					d, "storage.automount_enabled_hint", FALSE);
+-
+ 			} else if (strcmp (media, "tape") == 0) {
+ 				has_removable_media = TRUE;
+-
+-				/* TODO: Someone test with tape drives! */
+ 			}			
+ 		}
+