summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2009-01-16 04:48:31 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2009-01-16 04:48:31 +0000
commit3c841de8eb8a0d1bdb8bb1b19fff34ea96e72761 (patch)
treed65ab2fc561cbee730331640f84670e564cf62fe
parentFix detection of media on FreeBSD. There are still some issues with brasero, (diff)
Add two additional properties to disc media so that applications can
determine when media is available and that media's capacity. Reported by: Alexander Logvinov <freebsd@akavia.ru>
Notes
Notes: svn path=/head/; revision=226234
-rw-r--r--sysutils/hal/Makefile2
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c39
2 files changed, 40 insertions, 1 deletions
diff --git a/sysutils/hal/Makefile b/sysutils/hal/Makefile
index 07168189bcca..1acc47eee67a 100644
--- a/sysutils/hal/Makefile
+++ b/sysutils/hal/Makefile
@@ -8,7 +8,7 @@
PORTNAME= hal
DISTVERSION= 0.5.11
-PORTREVISION= 10
+PORTREVISION= 11
CATEGORIES= sysutils
MASTER_SITES= http://hal.freedesktop.org/releases/
diff --git a/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c b/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c
new file mode 100644
index 000000000000..d67ce03bff30
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c
@@ -0,0 +1,39 @@
+--- hald/freebsd/probing/probe-storage.c.orig 2009-01-12 16:07:59.000000000 -0500
++++ hald/freebsd/probing/probe-storage.c 2009-01-12 16:20:20.000000000 -0500
+@@ -31,6 +31,8 @@
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/types.h>
++#include <sys/ioctl.h>
++#include <sys/disk.h>
+ #include <netinet/in.h>
+ #include <glib.h>
+ #include <libvolume_id.h>
+@@ -211,7 +213,26 @@ main (int argc, char **argv)
+ goto end;
+
+ if (hfp_cdrom_test_unit_ready(cdrom))
+- ret = 2; /* has media */
++ {
++ int fd;
++ off_t size;
++
++ libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.removable.media_available", TRUE, &hfp_error);
++ fd = open(device_file, O_RDONLY | O_NONBLOCK);
++ if (fd > -1)
++ {
++ if (ioctl (fd, DIOCGMEDIASIZE, &size) == 0)
++ {
++ libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "storage.removable.media_size", size, &hfp_error);
++ }
++ close(fd);
++ }
++ ret = 2; /* has media */
++ }
++ else
++ {
++ libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.removable.media_available", FALSE, &hfp_error);
++ }
+
+ hfp_cdrom_free(cdrom);
+ }