diff -Nur -x '*.orig' -x '*~' ubuntu/hald/linux/blockdev.c ubuntu.new/hald/linux/blockdev.c --- ubuntu/hald/linux/blockdev.c 2008-03-17 22:25:13.000000000 +0100 +++ ubuntu.new/hald/linux/blockdev.c 2008-03-21 12:14:59.000000000 +0100 @@ -1180,6 +1180,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; @@ -1323,6 +1329,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 -Nur -x '*.orig' -x '*~' ubuntu/hald/linux/device.c ubuntu.new/hald/linux/device.c --- ubuntu/hald/linux/device.c 2008-03-21 12:14:11.000000000 +0100 +++ ubuntu.new/hald/linux/device.c 2008-03-21 12:15:20.000000000 +0100 @@ -1533,6 +1533,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) { @@ -2297,6 +2342,49 @@ } +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"); + hal_util_set_string_from_file (d, "memstick.class", sysfs_path, "class"); + hal_util_set_string_from_file (d, "memstick.category", sysfs_path, "category"); + +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 * @@ -3964,6 +4052,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, @@ -4035,6 +4133,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, @@ -4158,6 +4263,7 @@ &dev_handler_pcmcia, &dev_handler_scsi, &dev_handler_mmc, + &dev_handler_memstick, &dev_handler_sdio, &dev_handler_ieee1394, &dev_handler_xen, @@ -4179,6 +4285,7 @@ &dev_handler_tape, &dev_handler_tape390, &dev_handler_mmc_host, + &dev_handler_memstick_host, &dev_handler_backlight, &dev_handler_firewire, &dev_handler_power_supply,