diff options
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | doc/spec/hal-spec-properties.xml | 8 | ||||
-rw-r--r-- | hald/linux2/probing/linux_dvd_rw_utils.c | 56 | ||||
-rw-r--r-- | hald/linux2/probing/linux_dvd_rw_utils.h | 6 | ||||
-rw-r--r-- | hald/linux2/probing/probe-storage.c | 30 | ||||
-rw-r--r-- | libhal-storage/libhal-storage.c | 4 | ||||
-rw-r--r-- | libhal-storage/libhal-storage.h | 33 |
7 files changed, 88 insertions, 63 deletions
@@ -1,5 +1,19 @@ 2006-05-09 Danny Kukawka <danny.kukawka@web.de> + * doc/spec/hal-spec.xml.in: added property for DVD+RW DL to spec + * hald/linux2/probing/linux_dvd_rw_utils.c, + hald/linux2/probing/linux_dvd_rw_utils.h: (get_dvd_r_rw_profile): + reworked detection of device capabilities to get correct DVD-RW info + and added DVD+RW DL detection. + * hald/linux2/probing/probe-storage.c: (main): fixed mapping of + return value of get_dvd_r_rw_profile() related to changes + * libhal-storage/libhal-storage.c: + (libhal_drive_policy_compute_display_name), + (libhal_drive_from_udi): + * libhal-storage/libhal-storage.h: added property DVD+RW DL + +2006-05-09 Danny Kukawka <danny.kukawka@web.de> + * hald/linux2/blockdev.c: (blockdev_refresh_mount_state): Skip stat nfs mounts. This should solve blocked hald (and failing aplications which use hal) if there are nfs share mounts with 'stale nfs handle'. diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml index 5a8e550e..7b86a174 100644 --- a/doc/spec/hal-spec-properties.xml +++ b/doc/spec/hal-spec-properties.xml @@ -3056,6 +3056,14 @@ </row> <row> <entry> + <literal>storage.cdrom.dvdplusrwdl</literal> (bool) + </entry> + <entry></entry> + <entry>Yes</entry> + <entry>TRUE when the optical drive can blank and write to DVD+RW Dual-Layer discs</entry> + </row> + <row> + <entry> <literal>storage.cdrom.dvdplusrdl</literal> (bool) </entry> <entry></entry> diff --git a/hald/linux2/probing/linux_dvd_rw_utils.c b/hald/linux2/probing/linux_dvd_rw_utils.c index bd4b725d..a75a0912 100644 --- a/hald/linux2/probing/linux_dvd_rw_utils.c +++ b/hald/linux2/probing/linux_dvd_rw_utils.c @@ -182,8 +182,7 @@ int get_dvd_r_rw_profile (int fd) { ScsiCommand *cmd; - int retval = -1; - int dvd_plusr_dl = -1; + int retval = 0; unsigned char page[20]; unsigned char *list; int i, len; @@ -224,38 +223,39 @@ get_dvd_r_rw_profile (int fd) for (i = 12; i < list[11]; i += 4) { int profile = (list[i] << 8 | list[i + 1]); - /* 0x1B: DVD+R == 0 - * 0x1A: DVD+RW == 1 - * 0x2B: DVD+R DL == 3 */ - if (profile == 0x1B) { - if (retval == 1) - retval = 2; - else - retval = 0; - } else if (profile == 0x1A) { - if (retval == 0) - retval = 2; - else - retval = 1; - } else if (profile == 0x2B) { - /* DVD+R DL*/ - dvd_plusr_dl = 1; + /* 0x13: DVD-RW Restricted Overwrite + * 0x14: DVD-RW Sequential + * 0x1B: DVD+R + * 0x1A: DVD+RW + * 0x2A: DVD+RW DL + * 0x2B: DVD+R DL + */ + + switch (profile) { + case 0x13: + case 0x14: + retval |= DRIVE_CDROM_CAPS_DVDRW; + break; + case 0x1B: + retval |= DRIVE_CDROM_CAPS_DVDPLUSR; + break; + case 0x1A: + retval |= DRIVE_CDROM_CAPS_DVDPLUSRW; + break; + case 0x2A: + retval |= DRIVE_CDROM_CAPS_DVDPLUSRWDL; + break; + case 0x2B: + retval |= DRIVE_CDROM_CAPS_DVDPLUSRDL; + break; + default: + break; } } scsi_command_free (cmd); free (list); - /* to do: - * - check if DVD+R DL always implied also DVD+R and DVD+RW. - * If so, we don't need this code. */ - if (dvd_plusr_dl == 1) { - if(retval == 2 || retval == 1 ) - retval = 4; - else - retval = 3; - } - return retval; } diff --git a/hald/linux2/probing/linux_dvd_rw_utils.h b/hald/linux2/probing/linux_dvd_rw_utils.h index dd5c5e25..5b6105a5 100644 --- a/hald/linux2/probing/linux_dvd_rw_utils.h +++ b/hald/linux2/probing/linux_dvd_rw_utils.h @@ -11,6 +11,12 @@ #include <glib.h> +#define DRIVE_CDROM_CAPS_DVDRW 1 +#define DRIVE_CDROM_CAPS_DVDPLUSR 2 +#define DRIVE_CDROM_CAPS_DVDPLUSRW 4 +#define DRIVE_CDROM_CAPS_DVDPLUSRWDL 8 +#define DRIVE_CDROM_CAPS_DVDPLUSRDL 16 + int get_dvd_r_rw_profile (int fd); int get_read_write_speed (int fd, int *read_speed, int *write_speed, char **write_speeds); int get_disc_capacity_for_type (int fd, int type, guint64 *capacity); diff --git a/hald/linux2/probing/probe-storage.c b/hald/linux2/probing/probe-storage.c index e5636ba0..edab0e35 100644 --- a/hald/linux2/probing/probe-storage.c +++ b/hald/linux2/probing/probe-storage.c @@ -194,6 +194,7 @@ main (int argc, char *argv[]) libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdram", FALSE, &error); libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusr", FALSE, &error); libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrw", FALSE, &error); + libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrwdl", FALSE, &error); libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrdl", FALSE, &error); libhal_device_set_property_bool (ctx, udi, "storage.cdrom.bd", FALSE, &error); libhal_device_set_property_bool (ctx, udi, "storage.cdrom.bdr", FALSE, &error); @@ -212,28 +213,21 @@ main (int argc, char *argv[]) if (capabilities & CDC_DVD) { int profile; - /** @todo FIXME BUG XXX: need to check for dvdrw, Blue-ray and HD DVD - * (prolly need to rewrite much of the linux_dvdrw_utils.c file) - */ - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvd", TRUE, &error); - + profile = get_dvd_r_rw_profile (fd); - if (profile == 2) { - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusr", TRUE, &error); - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrw", TRUE, &error); - } else if (profile == 0) { + dbg ("get_dvd_r_rw_profile returned: %d", profile); + + if (profile & DRIVE_CDROM_CAPS_DVDRW) + libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdrw", TRUE, &error); + if (profile & DRIVE_CDROM_CAPS_DVDPLUSR) libhal_device_set_property_bool(ctx, udi, "storage.cdrom.dvdplusr", TRUE, &error); - } else if (profile == 1) { + if (profile & DRIVE_CDROM_CAPS_DVDPLUSRW) libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrw", TRUE, &error); - } else if (profile == 3) { - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusr", TRUE, &error); - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrdl", TRUE, &error); - } else if (profile == 4) { - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusr", TRUE, &error); - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrw", TRUE, &error); - libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrdl", TRUE, &error); - } + if (profile & DRIVE_CDROM_CAPS_DVDPLUSRWDL) + libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrwdl", TRUE, &error); + if (profile & DRIVE_CDROM_CAPS_DVDPLUSRDL) + libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdplusrdl", TRUE, &error); } if (capabilities & CDC_DVD_R) { libhal_device_set_property_bool (ctx, udi, "storage.cdrom.dvdr", TRUE, &error); diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c index 1ebf0ff8..1d16faea 100644 --- a/libhal-storage/libhal-storage.c +++ b/libhal-storage/libhal-storage.c @@ -278,7 +278,8 @@ libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volu } if ((drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDRW) && (drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW)) { - if(drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL) + if(drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL || + drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL) second = "/DVD±RW DL"; else second = "/DVD±RW"; @@ -932,6 +933,7 @@ libhal_drive_from_udi (LibHalContext *hal_ctx, const char *udi) LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvd", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDROM); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdplusr", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdplusrw", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW); + LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdplusrwdl", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdplusrdl", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdr", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDR); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.dvdrw", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_DVDRW); diff --git a/libhal-storage/libhal-storage.h b/libhal-storage/libhal-storage.h index eb43abd5..7ffacc38 100644 --- a/libhal-storage/libhal-storage.h +++ b/libhal-storage/libhal-storage.h @@ -167,22 +167,23 @@ typedef enum { } LibHalDriveType; typedef enum { - LIBHAL_DRIVE_CDROM_CAPS_CDROM = 0x0001, - LIBHAL_DRIVE_CDROM_CAPS_CDR = 0x0002, - LIBHAL_DRIVE_CDROM_CAPS_CDRW = 0x0004, - LIBHAL_DRIVE_CDROM_CAPS_DVDRAM = 0x0008, - LIBHAL_DRIVE_CDROM_CAPS_DVDROM = 0x0010, - LIBHAL_DRIVE_CDROM_CAPS_DVDR = 0x0020, - LIBHAL_DRIVE_CDROM_CAPS_DVDRW = 0x0040, - LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR = 0x0080, - LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW = 0x0100, - LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL = 0x0200, - LIBHAL_DRIVE_CDROM_CAPS_BDROM = 0x0400, - LIBHAL_DRIVE_CDROM_CAPS_BDR = 0x0800, - LIBHAL_DRIVE_CDROM_CAPS_BDRE = 0x1000, - LIBHAL_DRIVE_CDROM_CAPS_HDDVDROM = 0x2000, - LIBHAL_DRIVE_CDROM_CAPS_HDDVDR = 0x4000, - LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW = 0x8000 + LIBHAL_DRIVE_CDROM_CAPS_CDROM = 0x00001, + LIBHAL_DRIVE_CDROM_CAPS_CDR = 0x00002, + LIBHAL_DRIVE_CDROM_CAPS_CDRW = 0x00004, + LIBHAL_DRIVE_CDROM_CAPS_DVDRAM = 0x00008, + LIBHAL_DRIVE_CDROM_CAPS_DVDROM = 0x00010, + LIBHAL_DRIVE_CDROM_CAPS_DVDR = 0x00020, + LIBHAL_DRIVE_CDROM_CAPS_DVDRW = 0x00040, + LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSR = 0x00080, + LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRW = 0x00100, + LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRDL = 0x00200, + LIBHAL_DRIVE_CDROM_CAPS_DVDPLUSRWDL = 0x00400, + LIBHAL_DRIVE_CDROM_CAPS_BDROM = 0x00800, + LIBHAL_DRIVE_CDROM_CAPS_BDR = 0x01000, + LIBHAL_DRIVE_CDROM_CAPS_BDRE = 0x02000, + LIBHAL_DRIVE_CDROM_CAPS_HDDVDROM = 0x04000, + LIBHAL_DRIVE_CDROM_CAPS_HDDVDR = 0x08000, + LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW = 0x10000 } LibHalDriveCdromCaps; LibHalDrive *libhal_drive_from_udi (LibHalContext *hal_ctx, |