summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2007-10-11 16:12:00 -0400
committerDavid Zeuthen <davidz@redhat.com>2007-10-11 16:12:00 -0400
commit32d1f52a2e6c08d83723fe9d11417eeefb90768f (patch)
tree1769b63af2d9f0763a37b6d2da96aa14da922fbd
parenta268049eb5caabbe97f6f8d34e8a095b00e340f4 (diff)
add bluray support
On Wed, 2007-10-10 at 16:35 +0200, Danny Kukawka wrote: > On Mittwoch, 10. Oktober 2007, Bastien Nocera wrote: > > Heya, > > > > I posted an untested patch, with the values taken from the latest dvd > > +rw-tools version: > > http://bugs.freedesktop.org/show_bug.cgi?id=12767 > > > > I'd appreciate comments, and actual testing. Note that the spec isn't > > updated, and that the Blu-ray video disc detection probably doesn't > > work, as they're usually UDF, not ISO9660. > > Some comments: > * the patch didn't compile ('}' missing in probe-volume.c:264) Told you it was untested :) > * I would prevent mix LIBHAL_STORAGE_ICON_DISC_* with > DRIVE_CDROM_CAPS_* in probe-storage.c Thinko, good catch. > * in get_disc_capacity_dvdr_from_type() im miss code for 0x42 (BR-R RRM) not > sure if they should get handled like 0x41 (BD-R SRM) 0x42 isn't supported by dvd+rw-tools, so I don't know if the capacity calculation works in the same way. Maybe adding a comment to that effect would be useful. > I have added a new version of the patch with this stuff fixed and also add > some more support for HD DVD* discs (didn't add code to > get_disc_capacity_dvdr_from_type() atm). Looks good.
-rw-r--r--hald/linux/probing/linux_dvd_rw_utils.c36
-rw-r--r--hald/linux/probing/linux_dvd_rw_utils.h7
-rw-r--r--hald/linux/probing/probe-storage.c12
-rw-r--r--hald/linux/probing/probe-volume.c7
-rw-r--r--hald/solaris/probing/probe-volume.c2
5 files changed, 62 insertions, 2 deletions
diff --git a/hald/linux/probing/linux_dvd_rw_utils.c b/hald/linux/probing/linux_dvd_rw_utils.c
index 7431f1b6..3760a997 100644
--- a/hald/linux/probing/linux_dvd_rw_utils.c
+++ b/hald/linux/probing/linux_dvd_rw_utils.c
@@ -237,6 +237,13 @@ get_dvd_r_rw_profile (int fd)
* 0x1A: DVD+RW
* 0x2A: DVD+RW DL
* 0x2B: DVD+R DL
+ * 0x40: BD-ROM
+ * 0x41: BD-R SRM
+ * 0x42: BR-R RRM
+ * 0x43: BD-RE
+ * 0x50: HD DVD-ROM
+ * 0x51: HD DVD-R
+ * 0x52: HD DVD-Rewritable
*/
switch (profile) {
@@ -256,6 +263,25 @@ get_dvd_r_rw_profile (int fd)
case 0x2B:
retval |= DRIVE_CDROM_CAPS_DVDPLUSRDL;
break;
+ case 0x40:
+ retval |= DRIVE_CDROM_CAPS_BDROM;
+ break;
+ case 0x41:
+ case 0x42:
+ retval |= DRIVE_CDROM_CAPS_BDR;
+ break;
+ case 0x43:
+ retval |= DRIVE_CDROM_CAPS_BDRE;
+ break;
+ case 0x50:
+ retval |= DRIVE_CDROM_CAPS_HDDVDROM;
+ break;
+ case 0x51:
+ retval |= DRIVE_CDROM_CAPS_HDDVDR;
+ break;
+ case 0x52:
+ retval |= DRIVE_CDROM_CAPS_HDDVDRW;
+ break;
default:
break;
}
@@ -672,6 +698,7 @@ get_disc_capacity_dvdr_from_type (int fd,
case 0x11: /* DVD-R */
case 0x1B: /* DVD+R */
case 0x2B: /* DVD+R Double Layer */
+ case 0x41: /* BD-R SRM */
/* READ TRACK INFORMATION */
scsi_command_init (cmd, 0, 0x52);
@@ -697,6 +724,13 @@ get_disc_capacity_dvdr_from_type (int fd,
retval = 0;
break;
+ case 0x43: /* BD-RE */
+ /* Pull the formatted capacity */
+ blocks = formats [4 + 0] << 24;
+ blocks |= formats [4 + 1] << 16;
+ blocks |= formats [4 + 2] << 8;
+ blocks |= formats [4 + 3];
+ break;
default:
blocks = 0;
break;
@@ -739,6 +773,8 @@ get_disc_capacity_for_type (int fd,
case 0x2B:
case 0x1A:
case 0x12:
+ case 0x41:
+ case 0x43:
retval = get_disc_capacity_dvdr_from_type (fd, type, size);
break;
default:
diff --git a/hald/linux/probing/linux_dvd_rw_utils.h b/hald/linux/probing/linux_dvd_rw_utils.h
index 5b6105a5..6f943b18 100644
--- a/hald/linux/probing/linux_dvd_rw_utils.h
+++ b/hald/linux/probing/linux_dvd_rw_utils.h
@@ -16,7 +16,14 @@
#define DRIVE_CDROM_CAPS_DVDPLUSRW 4
#define DRIVE_CDROM_CAPS_DVDPLUSRWDL 8
#define DRIVE_CDROM_CAPS_DVDPLUSRDL 16
+#define DRIVE_CDROM_CAPS_BDROM 32
+#define DRIVE_CDROM_CAPS_BDR 64
+#define DRIVE_CDROM_CAPS_BDRE 128
+#define DRIVE_CDROM_CAPS_HDDVDROM 256
+#define DRIVE_CDROM_CAPS_HDDVDR 512
+#define DRIVE_CDROM_CAPS_HDDVDRW 1024
+
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/linux/probing/probe-storage.c b/hald/linux/probing/probe-storage.c
index b47971cd..f13d0154 100644
--- a/hald/linux/probing/probe-storage.c
+++ b/hald/linux/probing/probe-storage.c
@@ -227,6 +227,18 @@ main (int argc, char *argv[])
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);
+ if (profile & DRIVE_CDROM_CAPS_BDROM)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.bd", TRUE);
+ if (profile & DRIVE_CDROM_CAPS_BDR)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.bdr", TRUE);
+ if (profile & DRIVE_CDROM_CAPS_BDRE)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.bdre", TRUE);
+ if (profile & DRIVE_CDROM_CAPS_HDDVDROM)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvd", TRUE);
+ if (profile & DRIVE_CDROM_CAPS_HDDVDR)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvdr", TRUE);
+ if (profile & DRIVE_CDROM_CAPS_HDDVDRW)
+ libhal_changeset_set_property_bool (cs, "storage.cdrom.hddvdrw", TRUE);
}
if (capabilities & CDC_DVD_R) {
libhal_changeset_set_property_bool (cs, "storage.cdrom.dvdr", TRUE);
diff --git a/hald/linux/probing/probe-volume.c b/hald/linux/probing/probe-volume.c
index de300478..61eb96af 100644
--- a/hald/linux/probing/probe-volume.c
+++ b/hald/linux/probing/probe-volume.c
@@ -180,6 +180,7 @@ advanced_disc_detect (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
/* set defaults */
libhal_changeset_set_property_bool (cs, "volume.disc.is_videodvd", FALSE);
+ libhal_changeset_set_property_bool (cs, "volume.disc.is_blurayvideo", FALSE);
libhal_changeset_set_property_bool (cs, "volume.disc.is_vcd", FALSE);
libhal_changeset_set_property_bool (cs, "volume.disc.is_svcd", FALSE);
@@ -255,6 +256,12 @@ advanced_disc_detect (LibHalContext *ctx, const char *udi, LibHalChangeSet *cs,
HAL_DEBUG(("Disc in %s is a Video DVD", device_file));
break;
}
+ else if (!strcmp (dirname, "BDMV"))
+ {
+ libhal_changeset_set_property_bool (cs, "volume.disc.is_blurayvideo", TRUE);
+ HAL_DEBUG(("Disc in %s is a Blu-ray video disc", device_file));
+ break;
+ }
else if (!strcmp (dirname, "VCD"))
{
libhal_changeset_set_property_bool (cs, "volume.disc.is_vcd", TRUE);
diff --git a/hald/solaris/probing/probe-volume.c b/hald/solaris/probing/probe-volume.c
index 621022e0..91b0dcae 100644
--- a/hald/solaris/probing/probe-volume.c
+++ b/hald/solaris/probing/probe-volume.c
@@ -279,8 +279,6 @@ probe_disc (int fd, LibHalContext *ctx, const char *udi, dbus_bool_t *should_pro
disc_type = "bd_rom";
break;
case 0x41: /* BD-R Sequential */
- disc_type = "bd_r";
- break;
case 0x42: /* BD-R Random */
disc_type = "bd_r";
break;