97
const char *type_version;
99
102
dbus_error_init (&error);
101
switch (vid->usage_id) {
102
case VOLUME_ID_FILESYSTEM:
103
usage = "filesystem";
105
case VOLUME_ID_OTHER:
111
case VOLUME_ID_CRYPTO:
114
case VOLUME_ID_UNUSED:
115
libhal_changeset_set_property_string (cs, "info.product", "Volume (unused)");
104
if (!volume_id_get_usage(vid, &usage))
122
106
libhal_changeset_set_property_string (cs, "volume.fsusage", usage);
123
107
HAL_DEBUG (("volume.fsusage = '%s'", usage));
125
if (!libhal_changeset_set_property_string (cs, "volume.fstype", vid->type))
109
if (!volume_id_get_type(vid, &type))
111
if (!libhal_changeset_set_property_string (cs, "volume.fstype", type))
126
112
libhal_changeset_set_property_string (cs, "volume.fstype", "");
128
HAL_DEBUG(("volume.fstype = '%s'", vid->type));
130
if (vid->type_version[0] != '\0') {
131
libhal_changeset_set_property_string (cs, "volume.fsversion", vid->type_version);
132
HAL_DEBUG(("volume.fsversion = '%s'", vid->type_version));
135
libhal_changeset_set_property_string (cs, "volume.uuid", vid->uuid);
136
HAL_DEBUG(("volume.uuid = '%s'", vid->uuid));
138
if(vid->label != NULL && vid->label[0] != '\0') {
113
HAL_DEBUG(("volume.fstype = '%s'", type));
115
if (!volume_id_get_type_version(vid, &type_version))
117
libhal_changeset_set_property_string (cs, "volume.fsversion", type_version);
118
HAL_DEBUG(("volume.fsversion = '%s'", type_version));
120
if (!volume_id_get_uuid(vid, &uuid))
122
libhal_changeset_set_property_string (cs, "volume.uuid", uuid);
123
HAL_DEBUG(("volume.uuid = '%s'", uuid));
125
if (!volume_id_get_label(vid, &label))
128
if (label[0] != '\0') {
139
131
/* we need to be sure for a utf8 valid label, because dbus accept only utf8 valid strings */
140
volume_label = strdup_valid_utf8 (vid->label);
132
volume_label = strdup_valid_utf8 (label);
141
133
if( volume_label != NULL ) {
142
134
libhal_changeset_set_property_string (cs, "volume.label", volume_label);
143
135
HAL_DEBUG(("volume.label = '%s'", volume_label));
145
if (strlen(volume_label) > 0) {
137
if (volume_label[0] != '\0') {
146
138
libhal_changeset_set_property_string (cs, "info.product", volume_label);
147
139
g_free(volume_label);
155
if (vid->type != NULL) {
156
snprintf (buf, sizeof (buf), "Volume (%s)", vid->type);
147
if (type[0] != '\0') {
148
snprintf (buf, sizeof (buf), "Volume (%s)", type);
158
150
snprintf (buf, sizeof (buf), "Volume (unknown)");
161
152
libhal_changeset_set_property_string (cs, "info.product", buf);
190
181
/* set defaults */
191
182
libhal_changeset_set_property_bool (cs, "volume.disc.is_videodvd", FALSE);
183
libhal_changeset_set_property_bool (cs, "volume.disc.is_blurayvideo", FALSE);
192
184
libhal_changeset_set_property_bool (cs, "volume.disc.is_vcd", FALSE);
193
185
libhal_changeset_set_property_bool (cs, "volume.disc.is_svcd", FALSE);
264
256
HAL_DEBUG(("Disc in %s is a Video DVD", device_file));
259
else if (!strcmp (dirname, "BDMV"))
261
libhal_changeset_set_property_bool (cs, "volume.disc.is_blurayvideo", TRUE);
262
HAL_DEBUG(("Disc in %s is a Blu-ray video disc", device_file));
267
265
else if (!strcmp (dirname, "VCD"))
269
267
libhal_changeset_set_property_bool (cs, "volume.disc.is_vcd", TRUE);
623
621
if (vid != NULL) {
625
623
HAL_INFO (("invoking volume_id_probe_all, offset=%d, size=%d", vol_probe_offset, vol_size));
626
vid_ret = volume_id_probe_all (vid, vol_probe_offset , vol_size);
624
vid_ret = volume_id_probe_all (vid, vol_probe_offset, vol_size);
627
625
HAL_INFO (("volume_id_probe_all returned %d", vid_ret));
629
627
if (vid_ret != 0 && is_disc && vol_probe_offset != 0) {
644
642
libhal_changeset_set_property_string (cs, "info.product", "Volume");
647
/* VOLUME_ID_UNUSED means vol_id didn't detect anything that it knows about
648
* if it's a disc.. look whether it's a partition table (some Apple discs
645
/* If we didn't detect anything, look whether it's a partition table (some Apple discs
649
646
* uses Apple Partition Map) and look at partitions
651
648
* (kind of a hack - ugh - we ought to export all these as fakevolumes... but
652
649
* this is good enough for now... the only discs I know of that does this
653
650
* is in fact Apple's install disc.)
655
if (vid->usage_id == VOLUME_ID_UNUSED && is_disc) {
652
if (vid_ret != 0 && is_disc) {
656
653
PartitionTable *p;
657
654
p = part_table_load_from_disk (stordev_dev_file);