diff options
author | Danny Kukawka <danny.kukawka@web.de> | 2007-04-01 03:08:17 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2007-04-01 03:08:17 -0400 |
commit | 5f7fc3562838aa8c44cfa3f0227cdac077c0f64f (patch) | |
tree | a52f416c121c4830a590a4421ff5dd114e27c0a9 | |
parent | c003685ace0936d4c813bf1ba422d521c72d4d62 (diff) |
add more cdrom information
On Samstag, 31. März 2007, David Zeuthen wrote:
> On Tue, 2007-03-20 at 20:53 -0400, David Zeuthen wrote:
> > On Mon, 2007-03-12 at 22:48 +0100, Danny Kukawka wrote:
> > > Hi,
> > >
> > > this patch adds more information about CD/DVD device capabilities.
> >
> > Looks good to me (although with s/CDC_MO/CDC_MO_DRIVE/ as you noted in a
> > private mail) if you also include the bits for libhal-storage.[ch].
> > Thanks.
>
> Did we want this for 0.5.9? Thanks.
Attached updated version of the patch including updated libstorage.
-rw-r--r-- | doc/spec/hal-spec-properties.xml | 32 | ||||
-rw-r--r-- | hald/linux/probing/probe-storage.c | 19 | ||||
-rw-r--r-- | hald/linux/probing/probe-volume.c | 11 | ||||
-rw-r--r-- | libhal-storage/libhal-storage.c | 26 | ||||
-rw-r--r-- | libhal-storage/libhal-storage.h | 16 |
5 files changed, 94 insertions, 10 deletions
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml index 40f3b298..6023990a 100644 --- a/doc/spec/hal-spec-properties.xml +++ b/doc/spec/hal-spec-properties.xml @@ -3884,6 +3884,38 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} </row> <row> <entry> + <literal>storage.cdrom.mrw</literal> (bool) + </entry> + <entry></entry> + <entry>Yes</entry> + <entry>TRUE when the optical drive can read MRW (Mount Rainier Rewrite) discs</entry> + </row> + <row> + <entry> + <literal>storage.cdrom.mrw_w</literal> (bool) + </entry> + <entry></entry> + <entry>Yes</entry> + <entry>TRUE when the optical drive can write MRW (Mount Rainier Rewrite) discs</entry> + </row> + <row> + <entry> + <literal>storage.cdrom.mo</literal> (bool) + </entry> + <entry></entry> + <entry>No</entry> + <entry>TRUE when the optical drive is a MO (Magneto Optical) device.</entry> + </row> + <row> + <entry> + <literal>storage.cdrom.support_multisession</literal> (bool) + </entry> + <entry></entry> + <entry>Yes</entry> + <entry>TRUE if the drive can read multisession discs</entry> + </row> + <row> + <entry> <literal>storage.cdrom.support_media_changed</literal> (bool) </entry> <entry></entry> diff --git a/hald/linux/probing/probe-storage.c b/hald/linux/probing/probe-storage.c index c7dd691c..608a7f39 100644 --- a/hald/linux/probing/probe-storage.c +++ b/hald/linux/probing/probe-storage.c @@ -196,6 +196,9 @@ main (int argc, char *argv[]) libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvd", FALSE); libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvdr", FALSE); libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvdrw", FALSE); + libhal_changeset_set_property_bool (cs, "storage.cdrom.mo", FALSE); + libhal_changeset_set_property_bool (cs, "storage.cdrom.mrw", FALSE); + libhal_changeset_set_property_bool (cs, "storage.cdrom.mrw_w", FALSE); if (capabilities & CDC_CD_R) { libhal_changeset_set_property_bool (cs, "storage.cdrom.cdr", TRUE); @@ -229,6 +232,15 @@ main (int argc, char *argv[]) if (capabilities & CDC_DVD_RAM) { libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdram", TRUE); } + if (capabilities & CDC_MO_DRIVE) { + libhal_changeset_set_property_bool (cs, "storage.cdrom.mo", TRUE); + } + if (capabilities & CDC_MRW) { + libhal_changeset_set_property_bool (cs, "storage.cdrom.mrw", TRUE); + } + if (capabilities & CDC_MRW_W) { + libhal_changeset_set_property_bool (cs, "storage.cdrom.mrw_w", TRUE); + } /* while we're at it, check if we support media changed */ if (capabilities & CDC_MEDIA_CHANGED) { @@ -236,7 +248,12 @@ main (int argc, char *argv[]) } else { libhal_changeset_set_property_bool (cs, "storage.cdrom.support_media_changed", FALSE); } - + if (capabilities & CDC_MULTI_SESSION) { + libhal_changeset_set_property_bool (cs, "storage.cdrom.support_multisession", TRUE); + } 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) { diff --git a/hald/linux/probing/probe-volume.c b/hald/linux/probing/probe-volume.c index 489c15ce..d5963db9 100644 --- a/hald/linux/probing/probe-volume.c +++ b/hald/linux/probing/probe-volume.c @@ -463,6 +463,12 @@ main (int argc, char *argv[]) HAL_DEBUG(("get_disc_type returned 0x%02x", type)); if (type != -1) { switch (type) { + case 0x03: /* Magneto-Optical disk with sector erase capability */ + case 0x05: /* Advance Storage – Magneto-Optical */ + libhal_changeset_set_property_string (cs, "volume.disc.type", "mo"); + libhal_changeset_set_property_bool (cs, "volume.disc.is_rewritable", TRUE); + case 0x04: /* Magneto Optical write once */ + libhal_changeset_set_property_string (cs, "volume.disc.type", "mo"); case 0x08: /* CD-ROM */ libhal_changeset_set_property_string (cs, "volume.disc.type", "cd_rom"); break; @@ -484,9 +490,6 @@ main (int argc, char *argv[]) libhal_changeset_set_property_bool (cs, "volume.disc.is_rewritable", TRUE); break; case 0x13: /* DVD-RW Restricted Overwrite */ - libhal_changeset_set_property_string (cs, "volume.disc.type", "dvd_rw"); - libhal_changeset_set_property_bool (cs, "volume.disc.is_rewritable", TRUE); - break; case 0x14: /* DVD-RW Sequential */ libhal_changeset_set_property_string (cs, "volume.disc.type", "dvd_rw"); libhal_changeset_set_property_bool (cs, "volume.disc.is_rewritable", TRUE); @@ -505,8 +508,6 @@ main (int argc, char *argv[]) libhal_changeset_set_property_string (cs, "volume.disc.type", "bd_rom"); break; case 0x41: /* BD-R Sequential */ - libhal_changeset_set_property_string (cs, "volume.disc.type", "bd_r"); - break; case 0x42: /* BD-R Random */ libhal_changeset_set_property_string (cs, "volume.disc.type", "bd_r"); break; diff --git a/libhal-storage/libhal-storage.c b/libhal-storage/libhal-storage.c index 3e324a3c..4da5564a 100644 --- a/libhal-storage/libhal-storage.c +++ b/libhal-storage/libhal-storage.c @@ -296,6 +296,10 @@ libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volu second = "/HD DVD-R"; if (drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW) second = "/HD DVD-RW"; + if (drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_MRW) + second = "/MRW"; + if (drive_cdrom_caps & LIBHAL_DRIVE_CDROM_CAPS_MRWW) + second = "/MRW-W"; if (drive_is_hotpluggable) { snprintf (buf, MAX_STRING_SZ, _("External %s%s Drive"), first, second); @@ -305,6 +309,12 @@ libhal_drive_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *volu name = strdup (buf); } + } else if (drive_type==LIBHAL_DRIVE_TYPE_MO) { + + if (drive_is_hotpluggable) + name = strdup (_("External Magneto Optical Drive")); + else + name = strdup (_("Magneto Optical Drive")); } else if (drive_type==LIBHAL_DRIVE_TYPE_FLOPPY) { /* Floppy Drive handling */ @@ -495,6 +505,13 @@ libhal_volume_policy_compute_display_name (LibHalDrive *drive, LibHalVolume *vol } goto out; + } else if (drive_type==LIBHAL_DRIVE_TYPE_MO) { + if (libhal_volume_get_disc_type (volume) == LIBHAL_VOLUME_DISC_TYPE_MO) { + if (libhal_volume_disc_is_blank (volume)) + name = strdup (_("Blank Magneto Optical")); + else + name = strdup (_("Magneto Optical")); + } } /* Fallback: size of media */ @@ -530,6 +547,7 @@ libhal_drive_policy_compute_icon_name (LibHalDrive *drive, LibHalVolume *volume, case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK: case LIBHAL_DRIVE_TYPE_DISK: case LIBHAL_DRIVE_TYPE_CDROM: + case LIBHAL_DRIVE_TYPE_MO: case LIBHAL_DRIVE_TYPE_FLOPPY: name = libhal_storage_policy_lookup_icon (policy, 0x10000 + drive_type*0x100 + bus); break; @@ -572,6 +590,7 @@ libhal_volume_policy_compute_icon_name (LibHalDrive *drive, LibHalVolume *volume case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK: case LIBHAL_DRIVE_TYPE_DISK: case LIBHAL_DRIVE_TYPE_CDROM: + case LIBHAL_DRIVE_TYPE_MO: case LIBHAL_DRIVE_TYPE_FLOPPY: name = libhal_storage_policy_lookup_icon (policy, 0x20000 + drive_type*0x100 + bus); break; @@ -984,6 +1003,9 @@ libhal_drive_from_udi (LibHalContext *hal_ctx, const char *udi) LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.hddvd", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_HDDVDROM); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.hddvdr", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_HDDVDR); LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.hddvdrw", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW); + LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.mo", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_MO); + LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.mrw", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_MRW); + LIBHAL_PROP_EXTRACT_BOOL_BITFIELD ("storage.cdrom.mrw_w", drive->cdrom_caps, LIBHAL_DRIVE_CDROM_CAPS_MRWW); LIBHAL_PROP_EXTRACT_BOOL ("storage.policy.should_mount", drive->should_mount); LIBHAL_PROP_EXTRACT_STRING ("storage.policy.desired_mount_point", drive->desired_mount_point); @@ -1000,6 +1022,8 @@ libhal_drive_from_udi (LibHalContext *hal_ctx, const char *udi) if (strcmp (drive->type_textual, "cdrom") == 0) { drive->cdrom_caps |= LIBHAL_DRIVE_CDROM_CAPS_CDROM; drive->type = LIBHAL_DRIVE_TYPE_CDROM; + } else if (strcmp (drive->type_textual, "optical") == 0) { + drive->type = LIBHAL_DRIVE_TYPE_MO; } else if (strcmp (drive->type_textual, "floppy") == 0) { drive->type = LIBHAL_DRIVE_TYPE_FLOPPY; } else if (strcmp (drive->type_textual, "disk") == 0) { @@ -1223,6 +1247,8 @@ libhal_volume_from_udi (LibHalContext *hal_ctx, const char *udi) vol->disc_type = LIBHAL_VOLUME_DISC_TYPE_HDDVDR; } else if (strcmp (disc_type_textual, "hddvd_rw") == 0) { vol->disc_type = LIBHAL_VOLUME_DISC_TYPE_HDDVDRW; + } else if (strcmp (disc_type_textual, "mo") == 0) { + vol->disc_type = LIBHAL_VOLUME_DISC_TYPE_MO; } } diff --git a/libhal-storage/libhal-storage.h b/libhal-storage/libhal-storage.h index a78759c4..cc106c6b 100644 --- a/libhal-storage/libhal-storage.h +++ b/libhal-storage/libhal-storage.h @@ -123,7 +123,10 @@ typedef enum { LIBHAL_STORAGE_ICON_DISC_BDRE = 0x3000c, LIBHAL_STORAGE_ICON_DISC_HDDVDROM = 0x3000d, LIBHAL_STORAGE_ICON_DISC_HDDVDR = 0x3000e, - LIBHAL_STORAGE_ICON_DISC_HDDVDRW = 0x3000f + LIBHAL_STORAGE_ICON_DISC_HDDVDRW = 0x3000f, + LIBHAL_STORAGE_ICON_DISC_MRW = 0x30010, + LIBHAL_STORAGE_ICON_DISC_MRWW = 0x30011, + LIBHAL_STORAGE_ICON_DISC_MO = 0x30012 } LibHalStoragePolicyIcon; typedef struct { @@ -166,7 +169,8 @@ typedef enum { LIBHAL_DRIVE_TYPE_PORTABLE_AUDIO_PLAYER = 0x0a, LIBHAL_DRIVE_TYPE_ZIP = 0x0b, LIBHAL_DRIVE_TYPE_JAZ = 0x0c, - LIBHAL_DRIVE_TYPE_FLASHKEY = 0x0d + LIBHAL_DRIVE_TYPE_FLASHKEY = 0x0d, + LIBHAL_DRIVE_TYPE_MO = 0x0e } LibHalDriveType; typedef enum { @@ -186,7 +190,10 @@ typedef enum { LIBHAL_DRIVE_CDROM_CAPS_BDRE = 0x02000, LIBHAL_DRIVE_CDROM_CAPS_HDDVDROM = 0x04000, LIBHAL_DRIVE_CDROM_CAPS_HDDVDR = 0x08000, - LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW = 0x10000 + LIBHAL_DRIVE_CDROM_CAPS_HDDVDRW = 0x10000, + LIBHAL_DRIVE_CDROM_CAPS_MRW = 0x20000, + LIBHAL_DRIVE_CDROM_CAPS_MRWW = 0x40000, + LIBHAL_DRIVE_CDROM_CAPS_MO = 0x80000 } LibHalDriveCdromCaps; LibHalDrive *libhal_drive_from_udi (LibHalContext *hal_ctx, @@ -272,7 +279,8 @@ typedef enum { LIBHAL_VOLUME_DISC_TYPE_BDRE = 0x0c, LIBHAL_VOLUME_DISC_TYPE_HDDVDROM = 0x0d, LIBHAL_VOLUME_DISC_TYPE_HDDVDR = 0x0e, - LIBHAL_VOLUME_DISC_TYPE_HDDVDRW = 0x0f + LIBHAL_VOLUME_DISC_TYPE_HDDVDRW = 0x0f, + LIBHAL_VOLUME_DISC_TYPE_MO = 0x10, } LibHalVolumeDiscType; LibHalVolume *libhal_volume_from_udi (LibHalContext *hal_ctx, |