hal: Branch 'master'
Danny Kukawka
dkukawka at kemper.freedesktop.org
Tue Aug 28 10:10:30 PDT 2007
hald/linux/probing/probe-storage.c | 93 ++++++++++++++++++-------------------
1 file changed, 47 insertions(+), 46 deletions(-)
New commits:
diff-tree 02d4acb9dc2c535475a942f48abfa156d84b93c8 (from 2948fca27b08642a03d9bee4c1659f72a79ae2f0)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Tue Aug 28 19:10:11 2007 +0200
fix detection of storage.cdrom.*_speed* values (fd.o 10399)
The attached patch fixes the in fd.o #10399 reorted problem that the
following properties get never updated on media changes:
* storage.cdrom.read_speed (int)
* storage.cdrom.write_speed (int)
* storage.cdrom.write_speeds (strlist)
HAL update now also these properties on media changes to provide always
up-to-date values.
diff --git a/hald/linux/probing/probe-storage.c b/hald/linux/probing/probe-storage.c
index 458c5ff..b47971c 100644
--- a/hald/linux/probing/probe-storage.c
+++ b/hald/linux/probing/probe-storage.c
@@ -154,27 +154,27 @@ main (int argc, char *argv[])
HAL_DEBUG (("Doing probe-storage for %s (bus %s) (drive_type %s) (udi=%s) (--only-check-for-fs==%d)",
device_file, bus, drive_type, udi, only_check_for_fs));
- if (!only_check_for_fs) {
- /* Get properties for CD-ROM drive */
- if (strcmp (drive_type, "cdrom") == 0) {
- int capabilities;
- int read_speed, write_speed;
- char *write_speeds;
-
- HAL_DEBUG (("Doing open (\"%s\", O_RDONLY | O_NONBLOCK)", device_file));
- fd = open (device_file, O_RDONLY | O_NONBLOCK);
- if (fd < 0) {
- HAL_ERROR (("Cannot open %s: %s", device_file, strerror (errno)));
- goto out;
- }
- HAL_DEBUG (("Returned from open(2)"));
+ /* Get properties for CD-ROM drive */
+ if (strcmp (drive_type, "cdrom") == 0) {
+ int capabilities;
+ int read_speed, write_speed;
+ char *write_speeds;
+
+ HAL_DEBUG (("Doing open (\"%s\", O_RDONLY | O_NONBLOCK)", device_file));
+ fd = open (device_file, O_RDONLY | O_NONBLOCK);
+ if (fd < 0) {
+ HAL_ERROR (("Cannot open %s: %s", device_file, strerror (errno)));
+ goto out;
+ }
+ HAL_DEBUG (("Returned from open(2)"));
- if (ioctl (fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS) < 0) {
- HAL_ERROR (("Error: CDROM_SET_OPTIONS failed: %s\n", strerror(errno)));
- close (fd);
- goto out;
- }
-
+ if (ioctl (fd, CDROM_SET_OPTIONS, CDO_USE_FFLAGS) < 0) {
+ HAL_ERROR (("Error: CDROM_SET_OPTIONS failed: %s\n", strerror(errno)));
+ close (fd);
+ goto out;
+ }
+
+ if (!only_check_for_fs) {
capabilities = ioctl (fd, CDROM_GET_CAPABILITY, 0);
if (capabilities < 0) {
close (fd);
@@ -220,13 +220,13 @@ main (int argc, char *argv[])
if (profile & DRIVE_CDROM_CAPS_DVDRW)
libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdrw", TRUE);
if (profile & DRIVE_CDROM_CAPS_DVDPLUSR)
- libhal_changeset_set_property_bool(cs, "storage.cdrom.dvdplusr", TRUE);
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdplusr", TRUE);
if (profile & DRIVE_CDROM_CAPS_DVDPLUSRW)
libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdplusrw", TRUE);
if (profile & DRIVE_CDROM_CAPS_DVDPLUSRWDL)
libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdplusrwdl", TRUE);
if (profile & DRIVE_CDROM_CAPS_DVDPLUSRDL)
- libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdplusrdl", TRUE);
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdplusrdl", TRUE);
}
if (capabilities & CDC_DVD_R) {
libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdr", TRUE);
@@ -255,36 +255,37 @@ main (int argc, char *argv[])
} else {
libhal_changeset_set_property_bool (cs, "storage.cdrom.support_multisession", FALSE);
}
-
- if (get_read_write_speed(fd, &read_speed, &write_speed, &write_speeds) >= 0) {
- libhal_changeset_set_property_int (cs, "storage.cdrom.read_speed", read_speed);
- if (write_speed > 0) {
- libhal_changeset_set_property_int (
- cs, "storage.cdrom.write_speed", write_speed);
-
- if (write_speeds != NULL)
- {
- gchar **wspeeds;
- wspeeds = g_strsplit_set (write_speeds, ",", -1);
- libhal_changeset_set_property_strlist (cs,
- "storage.cdrom.write_speeds",
- (const char **) wspeeds);
- g_strfreev (wspeeds);
- free (write_speeds);
- }
- } else {
- gchar *wspeeds[1] = {NULL};
- libhal_changeset_set_property_int (cs, "storage.cdrom.write_speed", 0);
+
+ }
+
+ if (get_read_write_speed(fd, &read_speed, &write_speed, &write_speeds) >= 0) {
+ libhal_changeset_set_property_int (cs, "storage.cdrom.read_speed", read_speed);
+
+ if (write_speed > 0) {
+ libhal_changeset_set_property_int (cs, "storage.cdrom.write_speed", write_speed);
+
+ if (write_speeds != NULL)
+ {
+ gchar **wspeeds;
+
+ wspeeds = g_strsplit_set (write_speeds, ",", -1);
libhal_changeset_set_property_strlist (cs, "storage.cdrom.write_speeds",
(const char **) wspeeds);
+ g_strfreev (wspeeds);
+ free (write_speeds);
+
}
+ } else {
+ gchar *wspeeds[1] = {NULL};
+ libhal_changeset_set_property_int (cs, "storage.cdrom.write_speed", 0);
+ libhal_changeset_set_property_strlist (cs, "storage.cdrom.write_speeds",
+ (const char **) wspeeds);
}
-
- close (fd);
}
- } /* !only_check_for_fs */
-
+ close (fd);
+ }
+
ret = 0;
/* Also return 2 if we're a cdrom and we got a disc */
More information about the hal-commit
mailing list