rpms/hal/devel hal-add-memstick-support.patch, NONE, 1.1 hal.spec, 1.171, 1.172

Matthew Garrett mjg59 at fedoraproject.org
Wed Nov 5 17:32:14 UTC 2008


Author: mjg59

Update of /cvs/pkgs/rpms/hal/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7993

Modified Files:
	hal.spec 
Added Files:
	hal-add-memstick-support.patch 
Log Message:
* Wed Nov 05 2008 Matthew Garrett <mjg at redhat.com> - 0.5.12-11.20081027git
- Add support for the memstick bus


hal-add-memstick-support.patch:

--- NEW FILE hal-add-memstick-support.patch ---
diff -ur hal-0.5.12/hald/linux/blockdev.c hal-0.5.12.hack/hald/linux/blockdev.c
--- hal-0.5.12/hald/linux/blockdev.c	2008-10-23 07:44:41.000000000 +0100
+++ hal-0.5.12.hack/hald/linux/blockdev.c	2008-11-05 15:30:52.000000000 +0000
@@ -1206,6 +1206,12 @@
 					is_hotpluggable = TRUE;
 					hal_device_property_set_string (d, "storage.bus", "mmc");
 					break;
+				} else if (strcmp (bus, "memstick") == 0) {
+					physdev = d_it;
+					physdev_udi = udi_it;
+					is_hotpluggable = TRUE;
+					hal_device_property_set_string (d, "storage.bus", "memstick");
+					break;
 				} else if (strcmp (bus, "ccw") == 0) {
 					physdev = d_it;
 					physdev_udi = udi_it;
@@ -1357,6 +1363,8 @@
 
 		} else if (strcmp (parent_bus, "mmc") == 0) {
 			hal_device_property_set_string (d, "storage.drive_type", "sd_mmc");
+		} else if (strcmp (parent_bus, "memstick") == 0) {
+			hal_device_property_set_string (d, "storage.drive_type", "memstick");
 		} else if (strcmp (parent_bus, "vio") == 0) {
 			char buf[256];
 			const gchar *prop;
diff -ur hal-0.5.12/hald/linux/device.c hal-0.5.12.hack/hald/linux/device.c
--- hal-0.5.12/hald/linux/device.c	2008-11-05 15:31:14.000000000 +0000
+++ hal-0.5.12.hack/hald/linux/device.c	2008-11-05 15:34:26.000000000 +0000
@@ -1694,6 +1694,51 @@
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
+
+static HalDevice *
+memstick_host_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	gint host_num;
+	const gchar *last_elem;
+
+	d = NULL;
+
+	if (parent_dev == NULL || parent_path == NULL) {
+		goto out;
+	}
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+	hal_device_property_set_string (d, "info.category", "memstick_host");
+	hal_device_add_capability (d, "memstick_host");
+
+	hal_device_property_set_string (d, "info.product", "Memory Stick Host Adapter");
+
+	last_elem = hal_util_get_last_element (sysfs_path);
+	sscanf (last_elem, "memstick%d", &host_num);
+	hal_device_property_set_int (d, "memstick_host.host", host_num);
+
+out:
+	return d;
+}
+
+static gboolean
+memstick_host_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+			      "%s_memstick_host",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+	return TRUE;
+}
+
 static HalDevice *
 pci_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
 {
@@ -2582,6 +2627,47 @@
 
 }
 
+static HalDevice *
+memstick_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path)
+{
+	HalDevice *d;
+	const gchar *bus_id;
+
+	if (parent_dev == NULL) {
+		d = NULL;
+		goto out;
+	}
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.subsystem", "memstick");
+	hal_device_property_set_string (d, "info.bus", "memstick");
+	hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	bus_id = hal_util_get_last_element (sysfs_path);
+	
+	hal_util_set_string_from_file (d, "info.product", sysfs_path, "attr_modelname");
+	
+out:
+	return d;
+}
+
+static gboolean
+memstick_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+			      "%s_memstick_card",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+	return TRUE;
+
+}
+
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
@@ -4165,6 +4251,13 @@
 	.remove      = dev_remove
 };
 
+static DevHandler dev_handler_memstick = { 
+	.subsystem   = "memstick",
+	.add         = memstick_add,
+	.compute_udi = memstick_compute_udi,
+	.remove      = dev_remove
+};
+
 static DevHandler dev_handler_ieee1394 = { 
 	.subsystem   = "ieee1394",
 	.add         = ieee1394_add,
@@ -4225,6 +4318,16 @@
 	.remove      = dev_remove
 };
 
+static DevHandler dev_handler_memstick_host =
+{
+	.subsystem    = "memstick_host",
+	.add          = memstick_host_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = memstick_host_compute_udi,
+	.remove       = dev_remove
+};
+
 static DevHandler dev_handler_pci = { 
 	.subsystem   = "pci",
 	.add         = pci_add,
@@ -4461,6 +4564,8 @@
 	&dev_handler_input,
 	&dev_handler_iucv,
 	&dev_handler_mmc,
+	&dev_handler_memstick,
+	&dev_handler_memstick_host,
 	&dev_handler_mmc_host,
 	&dev_handler_net,
 	&dev_handler_of_platform,


Index: hal.spec
===================================================================
RCS file: /cvs/pkgs/rpms/hal/devel/hal.spec,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -r1.171 -r1.172
--- hal.spec	5 Nov 2008 09:36:24 -0000	1.171
+++ hal.spec	5 Nov 2008 17:31:44 -0000	1.172
@@ -28,7 +28,7 @@
 Name: hal
 Version: 0.5.12
 #Release: 5%{?dist}
-Release: 10.%{?alphatag}%{?dist}
+Release: 11.%{?alphatag}%{?dist}
 URL: http://www.freedesktop.org/Software/hal
 #Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
 Source0: http://hal.freedesktop.org/releases/%{name}-%{version}-%{?alphatag}.tar.gz
@@ -41,6 +41,7 @@
 Patch3: hal-add-keys-to-buttons.patch
 Patch4: hal-joystick.patch
 Patch5: hal-remove-bdi-devices.patch
+Patch6: hal-add-memstick-support.patch
 
 License: AFL or GPLv2
 Group: System Environment/Libraries
@@ -140,6 +141,7 @@
 %patch3 -p1 -b .keys
 %patch4 -p1 -b .joystick
 %patch5 -p1 -b .remove-bdi
+%patch6 -p1 -b .memstick
 
 %build
 autoreconf
@@ -287,6 +289,9 @@
 %{_datadir}/gtk-doc/html/libhal-storage/*
 
 %changelog
+* Wed Nov 05 2008 Matthew Garrett <mjg at redhat.com> - 0.5.12-11.20081027git
+- Add support for the memstick bus
+
 * Wed Nov 05 2008 Richard Hughes <rhughes at redhat.com> - 0.5.12-10.20081027git
 - Add a small FDI file to match OLPC devices so we can remap the keyboard.
 




More information about the fedora-extras-commits mailing list