aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/hal
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2009-01-16 12:48:31 +0800
committermarcus <marcus@FreeBSD.org>2009-01-16 12:48:31 +0800
commit3e17dff0fdd4148c2c6b3e57b28b74965b3ceabd (patch)
treecd363cd0545e3a797345248fa7ebbdbe5a9229bf /sysutils/hal
parente37f5a3eafb465331595d336bd70fc80a57810b0 (diff)
downloadfreebsd-ports-gnome-3e17dff0fdd4148c2c6b3e57b28b74965b3ceabd.tar.gz
freebsd-ports-gnome-3e17dff0fdd4148c2c6b3e57b28b74965b3ceabd.tar.zst
freebsd-ports-gnome-3e17dff0fdd4148c2c6b3e57b28b74965b3ceabd.zip
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>
Diffstat (limited to 'sysutils/hal')
-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);
+ }