summaryrefslogtreecommitdiff
path: root/hald/linux2
diff options
context:
space:
mode:
Diffstat (limited to 'hald/linux2')
-rw-r--r--hald/linux2/probing/linux_dvd_rw_utils.c56
-rw-r--r--hald/linux2/probing/linux_dvd_rw_utils.h6
-rw-r--r--hald/linux2/probing/probe-storage.c30
3 files changed, 46 insertions, 46 deletions
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);