diff options
author | Brian Bidulock | 2015-07-10 20:56:39 -0600 |
---|---|---|
committer | Brian Bidulock | 2015-07-10 20:56:39 -0600 |
commit | f199a6c623ea3107d3b0ecc6e369b86f19d30f63 (patch) | |
tree | 443c64c94a9b26424ccbbfc1327816abc07d4965 | |
download | aur-f199a6c623ea3107d3b0ecc6e369b86f19d30f63.tar.gz |
initial version
-rw-r--r-- | .SRCINFO | 40 | ||||
-rw-r--r-- | PKGBUILD | 103 | ||||
-rw-r--r-- | badvok-compile-fix.patch | 12 | ||||
-rw-r--r-- | hal-glib-2.3-compile-fix.patch | 156 | ||||
-rw-r--r-- | hal-libudev-events.patch | 346 | ||||
-rw-r--r-- | hal.install | 24 | ||||
-rw-r--r-- | hal.patch | 603 | ||||
-rw-r--r-- | hal.service | 14 | ||||
-rw-r--r-- | hald | 54 | ||||
-rw-r--r-- | udev-update.patch | 55 |
10 files changed, 1407 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..cdfd887f41f4 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,40 @@ +pkgbase = hal + pkgdesc = Hardware Abstraction Layer + pkgver = 0.5.14 + pkgrel = 23 + url = http://www.freedesktop.org/wiki/Software/hal + install = hal.install + arch = i686 + arch = x86_64 + license = GPL + license = custom + makedepends = gperf + depends = dbus-glib>=0.82 + depends = libusb-compat + depends = hal-info>=0.20090716 + depends = dmidecode + depends = v4l-utils + depends = pciutils + optdepends = acpid>=2.0 + optdepends = pm-utils>=1.2.5 + options = !libtool + options = !makeflags + source = http://hal.freedesktop.org/releases/hal-0.5.14.tar.gz + source = hald + source = hal.service + source = hal.patch + source = udev-update.patch + source = hal-glib-2.3-compile-fix.patch + source = hal-libudev-events.patch + source = badvok-compile-fix.patch + md5sums = e9163df591a6f38f59fdbfe33e73bf20 + md5sums = 4cdfc673ad65ddb51919f5a757f62145 + md5sums = ca4a7932fe7e8acbfa17245b62cc3b9b + md5sums = 185dd5d6ffc703ec8395b4eb3a1ae498 + md5sums = 68209ba62b2a19537bfa459fdef70ed3 + md5sums = c126a66766118f83a171511832d1b619 + md5sums = d115a2f1793121b08dd58527c1530d0b + md5sums = 7acfdd590c98272930ddfd37f1c7f5a3 + +pkgname = hal + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ed15eeef0094 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,103 @@ +# Maintainer: Brian Bidulock <bidulock@openss7.org> +# Contributor: David Roheim <david.roheim@gmail.com> +# Contributor: Rohit Manokaran <rohit000@live.com> +# Contributor: James An <james@jamesan.ca> +# Contributor: Rohit Manokaran <rohitmanokaran@yahoo.com> +# Contributor: Pawel "l0ner" Soltys <pwslts@gmail.com> +# Contributor: Jan de Groot <jgc@archlinux.org> +# Contributor: Link Dupont <link@subpop.net> +# Contributor: Calvin Morisson <mutantturkey@gmail.com> +# Contributor: deusstultus <deusstultus@gmail.com> + +pkgname=hal +pkgver=0.5.14 +pkgrel=23 +pkgdesc="Hardware Abstraction Layer" +arch=(i686 x86_64) +license=('GPL' 'custom') +url="http://www.freedesktop.org/wiki/Software/hal" +depends=('dbus-glib>=0.82' 'libusb-compat' 'hal-info>=0.20090716' 'dmidecode' 'v4l-utils' 'pciutils') +optdepends=('acpid>=2.0' 'pm-utils>=1.2.5') +makedepends=('gperf') +options=('!libtool' '!makeflags') +install=hal.install +source=(http://hal.freedesktop.org/releases/${pkgname}-${pkgver}.tar.gz + hald + hal.service + hal.patch + udev-update.patch + hal-glib-2.3-compile-fix.patch + hal-libudev-events.patch + badvok-compile-fix.patch) + +md5sums=('e9163df591a6f38f59fdbfe33e73bf20' + '4cdfc673ad65ddb51919f5a757f62145' + 'ca4a7932fe7e8acbfa17245b62cc3b9b' + '9285ba215509584baaa9e1b573c89416' + '68209ba62b2a19537bfa459fdef70ed3' + 'c126a66766118f83a171511832d1b619' + 'd115a2f1793121b08dd58527c1530d0b' + '7acfdd590c98272930ddfd37f1c7f5a3') + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + patch -Np0 -d ${srcdir} -i ${srcdir}/hal.patch + + patch -Np1 -i ${srcdir}/hal-libudev-events.patch + patch -Np1 -i ${srcdir}/hal-glib-2.3-compile-fix.patch + patch -Np1 -i ${srcdir}/udev-update.patch + patch -Np1 -i ${srcdir}/badvok-compile-fix.patch + + # fix trialing space + sed -i 's/failed; [\] /failed; \\/' policy/Makefile.am + + # fix subdir-objects mess in automake 1.14 + sed -i 's/AM_INIT_AUTOMAKE[(]\[gnu 1.9\][)]/AM_INIT_AUTOMAKE([subdir-objects])/' configure.in + + libtoolize --force + aclocal + autoupdate # required to fix obsolete macros + autoconf + automake --add-missing --warnings=all + + ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \ + --libexecdir=/usr/lib/hal --with-udev-prefix=/etc \ + --enable-static=no --disable-acpi-ibm \ + --disable-docbook-docs --disable-console-kit \ + --disable-policy-kit --disable-acl-management \ + --enable-umount-helper --disable-smbios \ + --with-hal-user=hal --with-hal-group=hal \ + --with-pid-file=/var/run/hald.pid \ + --sbindir=/usr/bin --disable-gtk-doc + make + +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="${pkgdir}" install + + install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING" + + # These empty directories are required by hal to successfuly create its fdi-cache + install -m755 -d "${pkgdir}/etc/hal/fdi/"{policy,preprobe,information} + + # udev-sockets support has been removed from udev. hal-libudev-events.patch fixes hal to get events from libudev + rm -r "${pkgdir}/etc/udev" + + # move umount.hal from non-standard /sbin to /usr/bin + if test -e "${pkgdir}/sbin/umount.hal"; then + install -m755 -d "${pkgdir}/usr/bin" + mv "${pkgdir}/sbin/umount.hal" "${pkgdir}/usr/bin/umount.hal" + rmdir "${pkgdir}/sbin" + fi + + # create systemd service files + install -Dm644 ../hal.service "${pkgdir}/usr/lib/systemd/system/hal.service" + + # These dirs dont appear to be used. If they are needed we need to add systemd tmpfile to create them + rm -r "${pkgdir}/var/run" + + # Change ownership from hal:hal to root [namcap error] + chown root:root "${pkgdir}/var/cache/hald" +} diff --git a/badvok-compile-fix.patch b/badvok-compile-fix.patch new file mode 100644 index 000000000000..83ed2de97ab8 --- /dev/null +++ b/badvok-compile-fix.patch @@ -0,0 +1,12 @@ +diff -ru hal-0.5.14-original/hald/linux/addons/addon-storage.c hal-0.5.14/hald/linux/addons/addon-storage.c +--- hal-0.5.14-original/hald/linux/addons/addon-storage.c 2013-01-06 01:15:17.195955506 -0800 ++++ hal-0.5.14/hald/linux/addons/addon-storage.c 2013-01-06 01:16:43.835764036 -0800 +@@ -32,6 +32,7 @@ + #include <linux/cdrom.h> + #include <linux/fs.h> + #include <mntent.h> ++#include <sys/types.h> + #include <scsi/sg.h> + #include <stdint.h> + #include <stdio.h> + diff --git a/hal-glib-2.3-compile-fix.patch b/hal-glib-2.3-compile-fix.patch new file mode 100644 index 000000000000..461144f5b771 --- /dev/null +++ b/hal-glib-2.3-compile-fix.patch @@ -0,0 +1,156 @@ +diff -ru hal-0.5.14/hald/linux/addons/addon-acpi-buttons-toshiba.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-acpi-buttons-toshiba.c +--- hal-0.5.14/hald/linux/addons/addon-acpi-buttons-toshiba.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-acpi-buttons-toshiba.c 2012-05-26 18:17:41.516400197 -0700 +@@ -40,7 +40,7 @@ + #include <string.h> + #include <unistd.h> + +-#include <glib/gmain.h> ++#include <glib.h> + + #include "libhal/libhal.h" + #include "../../logger.h" +diff -ru hal-0.5.14/hald/linux/addons/addon-cpufreq.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-cpufreq.c +--- hal-0.5.14/hald/linux/addons/addon-cpufreq.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-cpufreq.c 2012-05-26 18:16:04.626395657 -0700 +@@ -32,7 +32,6 @@ + #include <unistd.h> + #include <signal.h> + #include <getopt.h> +-#include <glib/gprintf.h> + + #include "addon-cpufreq.h" + #include "addon-cpufreq-userspace.h" +diff -ru hal-0.5.14/hald/linux/addons/addon-dell-backlight.cpp hal-glib-2.3-compile-fix/hald/linux/addons/addon-dell-backlight.cpp +--- hal-0.5.14/hald/linux/addons/addon-dell-backlight.cpp 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-dell-backlight.cpp 2012-05-26 18:17:16.816399038 -0700 +@@ -29,7 +29,7 @@ + + #include <string.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-generic-backlight.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-generic-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-generic-backlight.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-generic-backlight.c 2012-05-26 18:16:51.779731200 -0700 +@@ -35,7 +35,7 @@ + #include <sys/stat.h> + #include <unistd.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-imac-backlight.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-imac-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-imac-backlight.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-imac-backlight.c 2012-05-26 18:16:58.686398190 -0700 +@@ -29,7 +29,7 @@ + #include <stdlib.h> + #include <sys/io.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-input.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-input.c +--- hal-0.5.14/hald/linux/addons/addon-input.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-input.c 2012-05-26 18:17:10.783065423 -0700 +@@ -41,8 +41,7 @@ + #else + #include <linux/input.h> + #endif +-#include <glib/gmain.h> +-#include <glib/gprintf.h> ++#include <glib.h> + #include <dbus/dbus-glib-lowlevel.h> + + #include "libhal/libhal.h" +diff -ru hal-0.5.14/hald/linux/addons/addon-ipw-killswitch.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-ipw-killswitch.c +--- hal-0.5.14/hald/linux/addons/addon-ipw-killswitch.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-ipw-killswitch.c 2012-05-26 18:16:44.186397511 -0700 +@@ -36,8 +36,6 @@ + #include <unistd.h> + + #include <glib.h> +-#include <glib/gmain.h> +-#include <glib/gstdio.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-leds.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-leds.c +--- hal-0.5.14/hald/linux/addons/addon-leds.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-leds.c 2012-05-26 18:17:59.099734354 -0700 +@@ -36,8 +36,6 @@ + #include <unistd.h> + + #include <glib.h> +-#include <glib/gmain.h> +-#include <glib/gstdio.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-macbookpro-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-macbookpro-backlight.c 2012-05-26 18:18:05.539734654 -0700 +@@ -39,7 +39,7 @@ + #include <pci/pci.h> + #include <unistd.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-omap-backlight.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-omap-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-omap-backlight.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-omap-backlight.c 2012-05-26 18:17:34.836399884 -0700 +@@ -41,7 +41,7 @@ + #include <fcntl.h> + #include <unistd.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-rfkill-killswitch.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-rfkill-killswitch.c +--- hal-0.5.14/hald/linux/addons/addon-rfkill-killswitch.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-rfkill-killswitch.c 2012-05-26 18:16:36.813063830 -0700 +@@ -36,8 +36,6 @@ + #include <unistd.h> + + #include <glib.h> +-#include <glib/gmain.h> +-#include <glib/gstdio.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-storage.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-storage.c +--- hal-0.5.14/hald/linux/addons/addon-storage.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-storage.c 2012-05-26 18:16:25.149729952 -0700 +@@ -39,7 +39,7 @@ + #include <string.h> + #include <sys/ioctl.h> + #include <unistd.h> +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + +diff -ru hal-0.5.14/hald/linux/addons/addon-usb-csr.c hal-glib-2.3-compile-fix/hald/linux/addons/addon-usb-csr.c +--- hal-0.5.14/hald/linux/addons/addon-usb-csr.c 2009-08-24 05:42:30.000000000 -0700 ++++ hal-glib-2.3-compile-fix/hald/linux/addons/addon-usb-csr.c 2012-05-26 18:17:22.746399317 -0700 +@@ -29,7 +29,7 @@ + #include <string.h> + #include <usb.h> + +-#include <glib/gmain.h> ++#include <glib.h> + #include <dbus/dbus-glib.h> + #include <dbus/dbus-glib-lowlevel.h> + diff --git a/hal-libudev-events.patch b/hal-libudev-events.patch new file mode 100644 index 000000000000..abd13db77af6 --- /dev/null +++ b/hal-libudev-events.patch @@ -0,0 +1,346 @@ +diff -ru hal-0.5.14/configure.in hal-libudev-events/configure.in +--- hal-0.5.14/configure.in 2012-06-17 17:05:38.346983427 -0700 ++++ hal-libudev-events/configure.in 2012-06-17 12:30:53.406613390 -0700 +@@ -14,6 +14,7 @@ + + glib_module="glib-2.0 >= 2.10.0 gobject-2.0 > 2.10.0 dbus-glib-1 >= 0.61" + dbus_module="dbus-1 >= 0.61" ++udev_module="libudev >= 185" + blkid_module="blkid >= 2.15" + volume_id_module="libvolume_id >= 0.77" + polkit_module="polkit >= 0.5" +@@ -693,6 +694,11 @@ + AC_SUBST(DBUS_CFLAGS) + AC_SUBST(DBUS_LIBS) + ++# D-Bus libs ++PKG_CHECK_MODULES(UDEV, [$udev_module]) ++AC_SUBST(UDEV_CFLAGS) ++AC_SUBST(UDEV_LIBS) ++ + # glib libs + PKG_CHECK_MODULES(GLIB, [$glib_module]) + AC_SUBST(GLIB_CFLAGS) +Only in hal-libudev-events: .configure.in.swp +diff -ru hal-0.5.14/hald/linux/osspec.c hal-libudev-events/hald/linux/osspec.c +--- hal-0.5.14/hald/linux/osspec.c 2012-06-17 17:05:38.343650094 -0700 ++++ hal-libudev-events/hald/linux/osspec.c 2012-06-17 16:57:08.250305305 -0700 +@@ -44,6 +44,7 @@ + #include <sys/un.h> + #include <sys/utsname.h> + #include <unistd.h> ++#include <libudev.h> + + #include <dbus/dbus.h> + #include <dbus/dbus-glib.h> +@@ -69,158 +70,97 @@ + + static gboolean hald_done_synthesizing_coldplug = FALSE; + +-static gboolean +-hald_udev_data (GIOChannel *source, GIOCondition condition, gpointer user_data) ++static long long get_ll_dev_prop(struct udev_device *device, const char *property) + { +- int fd; +- int retval; +- struct msghdr smsg; +- struct cmsghdr *cmsg; +- struct iovec iov; +- struct ucred *cred; +- char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; ++ long long result = 0; ++ const char * propVal = udev_device_get_property_value(device, property); + +- char buf[4096]; +- size_t bufpos = 0; +- const char *action = NULL; +- HotplugEvent *hotplug_event; ++ if(propVal != NULL) { ++ result = strtoull(propVal, NULL, 10); ++ HAL_INFO(("Property: %s Value: %lli", property, result)); ++ } ++ return result; ++} + +- memset(buf, 0x00, sizeof (buf)); ++static void copy_dev_prop(struct udev_device *device, char * dst, size_t dst_size, const char *property) ++{ ++ const char * propVal = udev_device_get_property_value(device, property); + +- fd = g_io_channel_unix_get_fd (source); ++ if(propVal != NULL) { ++ g_strlcpy (dst, propVal, dst_size); ++ HAL_INFO(("Property: %s Value: %s", property, dst)); ++ } ++} + +- iov.iov_base = &buf; +- iov.iov_len = sizeof (buf); ++static void copy_dev_prop_formatted(struct udev_device *device, char * format, char * dst, size_t dst_size, const char *property) ++{ ++ const char * propVal = udev_device_get_property_value(device, property); + +- memset(&smsg, 0x00, sizeof (struct msghdr)); +- smsg.msg_iov = &iov; +- smsg.msg_iovlen = 1; +- smsg.msg_control = cred_msg; +- smsg.msg_controllen = sizeof (cred_msg); +- +- retval = recvmsg (fd, &smsg, 0); +- if (retval < 0) { +- if (errno != EINTR) +- HAL_INFO (("Unable to receive message, errno=%d", errno)); +- goto out; ++ if(propVal != NULL) { ++ g_snprintf (dst, dst_size, format, propVal); ++ HAL_INFO(("Property: %s Value: %s", property, dst)); + } +- cmsg = CMSG_FIRSTHDR (&smsg); +- cred = (struct ucred *) CMSG_DATA (cmsg); ++} + +- if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { +- HAL_INFO (("No sender credentials received, message ignored")); +- goto out; +- } ++static gboolean ++hald_udev_data (GIOChannel *source, GIOCondition condition, gpointer user_data) ++{ ++ struct udev_monitor *udev_monitor = (struct udev_monitor *) user_data; ++ struct udev_device *device; + +- if (cred->uid != 0) { +- HAL_INFO (("Sender uid=%i, message ignored", cred->uid)); +- goto out; +- } ++ char *tmp, *tmp1; ++ ++ const char *action = NULL; ++ HotplugEvent *hotplug_event; + +- if (!strstr(buf, "@/")) { +- HAL_INFO (("invalid message format")); ++ device = udev_monitor_receive_device(udev_monitor); ++ ++ if (!device) { ++ HAL_ERROR (("Unable to receive message from udev device")); + goto out; + } + + hotplug_event = g_slice_new0 (HotplugEvent); + hotplug_event->type = HOTPLUG_EVENT_SYSFS; + +- while (bufpos < sizeof (buf)) { +- size_t keylen; +- char *key; +- char *str, *dstr; +- +- key = &buf[bufpos]; +- keylen = strlen(key); +- if (keylen == 0) +- break; +- bufpos += keylen + 1; +- +- if (strncmp(key, "ACTION=", 7) == 0) +- action = &key[7]; +- else if (strncmp(key, "DEVPATH=", 8) == 0) { +- +- /* md devices are handled via looking at /proc/mdstat */ +- if (g_str_has_prefix (key + 8, "/block/md")) { +- HAL_INFO (("skipping md event for %s", key + 8)); +- goto invalid; +- } +- +- g_snprintf (hotplug_event->sysfs.sysfs_path, sizeof (hotplug_event->sysfs.sysfs_path), +- "/sys%s", &key[8]); +- } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { +- +- /* md devices are handled via looking at /proc/mdstat */ +- if (g_str_has_prefix (key + 12, "/block/md")) { +- HAL_INFO (("skipping md event for %s", key + 8)); +- goto invalid; +- } +- +- g_snprintf (hotplug_event->sysfs.sysfs_path_old, sizeof (hotplug_event->sysfs.sysfs_path_old), +- "/sys%s", &key[12]); +- } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) +- g_strlcpy (hotplug_event->sysfs.subsystem, &key[10], sizeof (hotplug_event->sysfs.subsystem)); +- else if (strncmp(key, "DEVNAME=", 8) == 0) +- g_strlcpy (hotplug_event->sysfs.device_file, &key[8], sizeof (hotplug_event->sysfs.device_file)); +- else if (strncmp(key, "SEQNUM=", 7) == 0) +- hotplug_event->sysfs.seqnum = strtoull(&key[7], NULL, 10); +- else if (strncmp(key, "IFINDEX=", 8) == 0) +- hotplug_event->sysfs.net_ifindex = strtoul(&key[8], NULL, 10); +- else if (strncmp(key, "ID_VENDOR=", 10) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[10])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.vendor, str, sizeof(hotplug_event->sysfs.vendor)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_MODEL=", 9) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[9])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.model, str, sizeof(hotplug_event->sysfs.model)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_REVISION=", 12) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[12])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.revision, str, sizeof(hotplug_event->sysfs.revision)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_SERIAL=", 10) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[10])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.serial, str, sizeof(hotplug_event->sysfs.serial)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_FS_USAGE=", 12) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[12])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.fsusage, str, sizeof(hotplug_event->sysfs.fsusage)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_FS_TYPE=", 11) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[11])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.fstype, str, sizeof(hotplug_event->sysfs.fstype)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_FS_VERSION=", 14) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[14])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.fsversion, str, sizeof(hotplug_event->sysfs.fsversion)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_FS_UUID=", 11) == 0) { +- if ((str = hal_util_strdup_valid_utf8(&key[11])) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.fsuuid, str, sizeof(hotplug_event->sysfs.fsuuid)); +- g_free (str); +- } +- } else if (strncmp(key, "ID_FS_LABEL_ENC=", 16) == 0) { +- dstr = g_malloc0 (keylen - 15); +- hal_util_decode_escape (&key[16], dstr, sizeof(hotplug_event->sysfs.fslabel)); +- +- if ((str = hal_util_strdup_valid_utf8(dstr)) != NULL ) { +- g_strlcpy (hotplug_event->sysfs.fslabel, str, sizeof(hotplug_event->sysfs.fslabel)); +- g_free (str); +- } +- g_free (dstr); +- } else if (strncmp(key, "DM_UDEV_DISABLE_OTHER_RULES_FLAG=", 33) == 0) { +- if (strtoul(&key[33], NULL, 10) == 1) { +- HAL_INFO (("ignoring device requested by DM udev rules")); +- goto invalid; +- } ++ action = udev_device_get_action(device); ++ ++ copy_dev_prop_formatted(device, "/sys%s", hotplug_event->sysfs.sysfs_path, sizeof(hotplug_event->sysfs.sysfs_path), "DEVPATH"); ++ copy_dev_prop(device, hotplug_event->sysfs.subsystem, sizeof(hotplug_event->sysfs.subsystem), "SUBSYSTEM"); ++ copy_dev_prop(device, hotplug_event->sysfs.device_file, sizeof(hotplug_event->sysfs.device_file), "DEVNAME"); ++ ++ hotplug_event->sysfs.seqnum = get_ll_dev_prop(device, "SEQNUM"); ++ hotplug_event->sysfs.net_ifindex = get_ll_dev_prop(device, "IFINDEX"); ++ ++ copy_dev_prop_formatted(device, "/sys%s", hotplug_event->sysfs.sysfs_path_old, sizeof(hotplug_event->sysfs.sysfs_path_old), "DEVPATH_OLD"); ++ copy_dev_prop(device, hotplug_event->sysfs.vendor, sizeof(hotplug_event->sysfs.vendor), "ID_VENDOR"); ++ copy_dev_prop(device, hotplug_event->sysfs.model, sizeof(hotplug_event->sysfs.model), "ID_MODEL"); ++ copy_dev_prop(device, hotplug_event->sysfs.revision, sizeof(hotplug_event->sysfs.revision), "ID_REVISION"); ++ copy_dev_prop(device, hotplug_event->sysfs.serial, sizeof(hotplug_event->sysfs.serial), "ID_SERIAL"); ++ copy_dev_prop(device, hotplug_event->sysfs.fsusage, sizeof(hotplug_event->sysfs.fsusage), "ID_FS_USAGE"); ++ copy_dev_prop(device, hotplug_event->sysfs.fstype, sizeof(hotplug_event->sysfs.fstype), "ID_FS_TYPE"); ++ copy_dev_prop(device, hotplug_event->sysfs.fsversion, sizeof(hotplug_event->sysfs.fsversion), "ID_FS_VERSION"); ++ copy_dev_prop(device, hotplug_event->sysfs.fsuuid, sizeof(hotplug_event->sysfs.fsuuid), "ID_FS_UUID"); ++ copy_dev_prop(device, hotplug_event->sysfs.fslabel, sizeof(hotplug_event->sysfs.fslabel), "ID_FS_LABEL_ENC"); ++ ++ /* md devices are handled via looking at /proc/mdstat */ ++ if (g_str_has_prefix (hotplug_event->sysfs.sysfs_path, "/sys/block/md")) { ++ HAL_INFO (("skipping md event for %s", hotplug_event->sysfs.sysfs_path)); ++ goto invalid; ++ } ++ if (g_str_has_prefix (hotplug_event->sysfs.sysfs_path_old, "/sys/block/md")) { ++ HAL_INFO (("skipping md event for %s", hotplug_event->sysfs.sysfs_path_old)); ++ goto invalid; ++ } ++ ++ if(hotplug_event->sysfs.fslabel != NULL) { ++ tmp = g_malloc(sizeof(hotplug_event->sysfs.fslabel)); ++ hal_util_decode_escape (hotplug_event->sysfs.fslabel, tmp, sizeof(hotplug_event->sysfs.fslabel)); ++ if ((tmp1 = hal_util_strdup_valid_utf8(tmp)) != NULL ) { ++ g_strlcpy (hotplug_event->sysfs.fslabel, tmp1, sizeof(hotplug_event->sysfs.fslabel)); ++ g_free (tmp1); + } ++ g_free(tmp); + } + + if (!action) { +@@ -291,6 +231,7 @@ + g_slice_free (HotplugEvent, hotplug_event); + + out: ++ udev_device_unref(device); + return TRUE; + } + +@@ -406,9 +347,9 @@ + void + osspec_init (void) + { ++ struct udev * udev; ++ struct udev_monitor * udev_monitor; + int udev_socket; +- struct sockaddr_un saddr; +- socklen_t addrlen; + const int on = 1; + GIOChannel *udev_channel; + GIOChannel *mounts_channel; +@@ -419,28 +360,35 @@ + + hal_device_store_index_property (hald_get_gdl (), "linux.sysfs_path"); + +- memset(&saddr, 0x00, sizeof(saddr)); +- saddr.sun_family = AF_LOCAL; +- /* use abstract namespace for socket path */ +- strcpy(&saddr.sun_path[1], "/org/freedesktop/hal/udev_event"); +- addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; ++ udev = udev_new(); ++ ++ if(!udev) { ++ DIE (("Could not create udev")); ++ } ++ ++ udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); ++ ++ if(!udev_monitor || udev_monitor_enable_receiving(udev_monitor)) { ++ DIE (("Could not create udev monitor")); ++ } ++ ++ udev_socket = udev_monitor_get_fd(udev_monitor); + +- udev_socket = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_socket == -1) { + DIE (("Couldn't open socket")); + } + +- if (bind(udev_socket, (struct sockaddr *) &saddr, addrlen) < 0) { +- fprintf (stderr, "Error binding udev_event socket: %s\n", strerror(errno)); +- exit (1); +- } + /* enable receiving of the sender credentials */ + setsockopt(udev_socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + + udev_channel = g_io_channel_unix_new (udev_socket); +- g_io_add_watch (udev_channel, G_IO_IN, hald_udev_data, NULL); ++ g_io_add_watch (udev_channel, G_IO_IN, hald_udev_data, udev_monitor); + g_io_channel_unref (udev_channel); + ++ /*udev_monitor_unref(udev_monitor); ++ udev_unref(udev);*/ ++ ++ + /* watch /proc/mounts for mount tree changes + * kernel 2.6.15 vfs throws a POLLERR event for every change + */diff -ru hal-0.5.14/hald/Makefile.am hal-libudev-events/hald/Makefile.am +--- hal-0.5.14/hald/Makefile.am 2012-06-17 17:05:38.346983427 -0700 ++++ hal-libudev-events/hald/Makefile.am 2012-06-17 12:41:57.566628300 -0700 +@@ -74,7 +74,7 @@ + hald_SOURCES += ck-tracker.h ck-tracker.c + endif + +-hald_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @POLKIT_LIBS@ -lm @HALD_OS_LIBS@ $(top_builddir)/hald/$(HALD_BACKEND)/libhald_$(HALD_BACKEND).la ++hald_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @POLKIT_LIBS@ -lm @HALD_OS_LIBS@ $(top_builddir)/hald/$(HALD_BACKEND)/libhald_$(HALD_BACKEND).la @UDEV_LIBS@ + + #### Init scripts fun + SCRIPT_IN_FILES=haldaemon.in diff --git a/hal.install b/hal.install new file mode 100644 index 000000000000..d6afee384cbd --- /dev/null +++ b/hal.install @@ -0,0 +1,24 @@ +post_install() { + getent group hal >/dev/null || usr/sbin/groupadd -g 82 hal + getent group optical >/dev/null || usr/sbin/groupadd -g 93 optical + getent group floppy >/dev/null || usr/sbin/groupadd -g 94 floppy + getent group storage >/dev/null || usr/sbin/groupadd -g 95 storage + getent passwd hal >/dev/null || usr/sbin/useradd -c 'HAL daemon' -u 82 -g hal -G optical,floppy,storage -d '/' -s /bin/false hal + usr/bin/passwd -l hal &>/dev/null +} + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + post_install $1 +} + +# arg 1: the old package version +post_remove() { + if getent passwd hal &>/dev/null; then + usr/sbin/userdel hal + fi + if getent group hal &>/dev/null; then + usr/sbin/groupdel hal + fi +} diff --git a/hal.patch b/hal.patch new file mode 100644 index 000000000000..300b48f03f4d --- /dev/null +++ b/hal.patch @@ -0,0 +1,603 @@ +diff -u -r hal-0.5.14/configure.in src/hal-0.5.14/configure.in +--- hal-0.5.14/configure.in 2009-08-24 14:42:29.000000000 +0200 ++++ src/hal-0.5.14/configure.in 2011-12-19 20:39:54.000000000 +0100 +@@ -479,9 +479,6 @@ + fi + AM_CONDITIONAL([HAVE_LIBPCI], [test "x$USE_LIBPCI" = "xyes"]) + +-USE_LIBUSB20=no +-USE_LIBUSB=no +-LIBUSB20_LIBS="" + AC_ARG_WITH([backend], + AS_HELP_STRING([--with-backend=<name>], + [backend to use (linux/solaris/freebsd/dummy)]), +@@ -510,21 +507,25 @@ + AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compiling for Solaris]) + AC_SUBST(HALD_BACKEND) + if test "x$HALD_BACKEND" = "xfreebsd"; then +- AC_CHECK_LIB([usb20], [libusb20_dev_get_info], [USE_LIBUSB20=yes], [USE_LIBUSB20=no]) +-fi +-if test "x$USE_LIBUSB20" = "xno"; then +- AC_CHECK_LIB([usb], [libusb20_dev_get_info], [USE_LIBUSB=yes], [USE_LIBUSB=no]) +-fi +-AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_LIBUSB20" = "xyes"]) +-AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_LIBUSB" = "xyes"]) +-if test "x$USE_LIBUSB20" = "xyes"; then +- AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libusb20]) +- LIBUSB20_LIBS="-lusb20" +-elif test "x$USE_LIBUSB" = "xyes"; then +- AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libsub20]) +- LIBUSB20_LIBS="-lusb" ++ USE_BSDLIBUSB20=no ++ USE_BSDLIBUSB=no ++ LIBUSB20_LIBS="" ++ AC_CHECK_LIB([usb20], [libusb20_dev_get_info], [USE_BSDLIBUSB20=yes], [USE_BSDLIBUSB20=no]) ++ if test "x$USE_BSDLIBUSB20" = "xno"; then ++ AC_CHECK_LIB([usb], [libusb20_dev_get_info], [USE_BSDLIBUSB=yes], [USE_BSDLIBUSB=no]) ++ fi ++ AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_BSDLIBUSB20" = "xyes" -o "x$USE_BSDLIBUSB" = "xyes"]) ++ if test "x$USE_BSDLIBUSB20" = "xyes"; then ++ AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libusb20]) ++ LIBUSB20_LIBS="-lusb20" ++ elif test "x$USE_BSDLIBUSB" = "xyes"; then ++ AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libsub20]) ++ LIBUSB20_LIBS="-lusb" ++ fi ++ AC_SUBST(LIBUSB20_LIBS) ++else ++ AM_CONDITIONAL([HAVE_LIBUSB20], [false]) + fi +-AC_SUBST(LIBUSB20_LIBS) + + dnl DBUS API is subject to changes + AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, [], [DBUS API is subject to change]) +diff -u -r hal-0.5.14/fdi/policy/10osvendor/10-x11-input.fdi src/hal-0.5.14/fdi/policy/10osvendor/10-x11-input.fdi +--- hal-0.5.14/fdi/policy/10osvendor/10-x11-input.fdi 2009-06-26 09:28:39.000000000 +0200 ++++ src/hal-0.5.14/fdi/policy/10osvendor/10-x11-input.fdi 2011-12-19 20:39:54.000000000 +0100 +@@ -2,6 +2,12 @@ + <deviceinfo version="0.2"> + <device> + ++ <!-- This KVMS has abs x/y and buttons. It only has inputInfo.joystick ++ set by hal and doesn't get picked up by default --> ++ <match key="input.product" contains="American Megatrends Inc. Virtual Keyboard and Mouse"> ++ <merge key="input.x11_driver" type="string">evdev</merge> ++ </match> ++ + <!-- KVM emulates a USB graphics tablet which works in absolute coordinate mode --> + <match key="input.product" contains="QEMU USB Tablet"> + <merge key="input.x11_driver" type="string">evdev</merge> +@@ -16,6 +22,14 @@ + </match> + </match> + ++ <match key="info.capabilities" contains="input.touchpad"> ++ <merge key="input.x11_driver" type="string">mouse</merge> ++ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" ++ string="Linux"> ++ <merge key="input.x11_driver" type="string">evdev</merge> ++ </match> ++ </match> ++ + <match key="info.capabilities" contains="input.tablet"> + <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" + string="Linux"> +@@ -32,5 +46,18 @@ + <merge key="input.x11_driver" type="string">evdev</merge> + </match> + </match> ++ ++ <!-- http://bugs.freedesktop.org/show_bug.cgi?id=22442 ++ Posts accel data through ABS_X/ABS_Y, makes X unusable --> ++ <match key="info.product" contains="ThinkPad HDAPS accelerometer data"> ++ <remove key="input.x11_driver" /> ++ </match> ++ ++ <!-- https://bugzilla.redhat.com/show_bug.cgi?id=523914 ++ Mouse does not move in PV Xen guest --> ++ <match key="info.product" contains="Xen Virtual Pointer"> ++ <merge key="input.x11_options.IgnoreAbsoluteAxes" type="string">false</merge> ++ <merge key="input.x11_options.IgnoreRelativeAxes" type="string">false</merge> ++ </match> + </device> + </deviceinfo> +diff -u -r hal-0.5.14/fdi/policy/10osvendor/20-storage-methods.fdi src/hal-0.5.14/fdi/policy/10osvendor/20-storage-methods.fdi +--- hal-0.5.14/fdi/policy/10osvendor/20-storage-methods.fdi 2009-11-05 15:09:01.000000000 +0100 ++++ src/hal-0.5.14/fdi/policy/10osvendor/20-storage-methods.fdi 2011-12-19 20:39:54.000000000 +0100 +@@ -99,6 +99,11 @@ + </match> + </match> + ++ <!-- Hide partitions marked as Compaq Diagnostics --> ++ <match key="volume.partition.type" string="0x12"> ++ <merge key="volume.ignore" type="bool">true</merge> ++ </match> ++ + <!-- EFI firmware partitions --> + <match key="volume.fstype" string="vfat"> + <match key="volume.label" string="EFI"> +diff -u -r hal-0.5.14/hal.conf.in src/hal-0.5.14/hal.conf.in +--- hal-0.5.14/hal.conf.in 2009-02-04 23:07:23.000000000 +0100 ++++ src/hal-0.5.14/hal.conf.in 2011-12-19 20:39:54.000000000 +0100 +@@ -25,7 +25,41 @@ + send_interface="org.freedesktop.Hal.Device"/> + <allow send_destination="org.freedesktop.Hal" + send_interface="org.freedesktop.Hal.Manager"/> ++ </policy> + ++ <!-- Only allow users at the local console to manipulate devices --> ++ <policy at_console="true"> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.CPUFreq"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.DockStation"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.KillSwitch"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.KeyboardBacklight"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.LaptopPanel"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.Leds"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.LightSensor"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.Storage"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.Storage.Removable"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.SystemPowerManagement"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.Volume"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.Volume.Crypto"/> ++ <allow send_destination="org.freedesktop.Hal" ++ send_interface="org.freedesktop.Hal.Device.WakeOnLan"/> ++ ++ </policy> ++ ++ <!-- well,...and root too --> ++ <policy user="root"> + <allow send_destination="org.freedesktop.Hal" + send_interface="org.freedesktop.Hal.Device.CPUFreq"/> + <allow send_destination="org.freedesktop.Hal" +diff -u -r hal-0.5.14/hald/linux/addons/addon-imac-backlight.c src/hal-0.5.14/hald/linux/addons/addon-imac-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-imac-backlight.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/addons/addon-imac-backlight.c 2011-12-19 20:39:54.000000000 +0100 +@@ -158,7 +158,8 @@ + goto out; + } + +- if (ioperm(0xB2, 0xB3, 1) < 0) ++ /* Allow access to ports 0xB2 and 0xB3 */ ++ if (ioperm(0xB2, 2, 1) < 0) + { + HAL_ERROR (("ioperm failed (you should be root).")); + exit(1); +diff -u -r hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c src/hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c +--- hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/addons/addon-macbookpro-backlight.c 2011-12-19 20:39:54.000000000 +0100 +@@ -507,7 +507,8 @@ + state = INREG(0x7ae4); + OUTREG(0x7ae4, state); + +- if (ioperm (0x300, 0x304, 1) < 0) { ++ /* Allow access to porta 0x300 through 0x304 */ ++ if (ioperm (0x300, 5, 1) < 0) { + HAL_ERROR (("ioperm failed (you should be root).")); + exit(1); + } +diff -u -r hal-0.5.14/hald/linux/osspec.c src/hal-0.5.14/hald/linux/osspec.c +--- hal-0.5.14/hald/linux/osspec.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/osspec.c 2011-12-19 20:39:54.000000000 +0100 +@@ -215,6 +215,11 @@ + g_free (str); + } + g_free (dstr); ++ } else if (strncmp(key, "DM_UDEV_DISABLE_OTHER_RULES_FLAG=", 33) == 0) { ++ if (strtoul(&key[33], NULL, 10) == 1) { ++ HAL_INFO (("ignoring device requested by DM udev rules")); ++ goto invalid; ++ } + } + } + +diff -u -r hal-0.5.14/hald/linux/probing/probe-hiddev.c src/hal-0.5.14/hald/linux/probing/probe-hiddev.c +--- hal-0.5.14/hald/linux/probing/probe-hiddev.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-hiddev.c 2011-12-19 20:39:54.000000000 +0100 +@@ -57,11 +57,12 @@ + /* assume failure */ + ret = 1; + ++ dbus_error_init (&error); ++ + udi = getenv ("UDI"); + if (udi == NULL) + goto out; + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/linux/probing/probe-ieee1394-unit.c src/hal-0.5.14/hald/linux/probing/probe-ieee1394-unit.c +--- hal-0.5.14/hald/linux/probing/probe-ieee1394-unit.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-ieee1394-unit.c 2011-12-19 20:39:54.000000000 +0100 +@@ -388,6 +388,8 @@ + + setup_logger (); + ++ dbus_error_init (&error); ++ + udi = getenv ("UDI"); + if (udi == NULL) + goto out; +@@ -396,7 +398,6 @@ + if (ieee1394_udi == NULL) + goto out; + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/linux/probing/probe-input.c src/hal-0.5.14/hald/linux/probing/probe-input.c +--- hal-0.5.14/hald/linux/probing/probe-input.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-input.c 2011-12-19 20:39:54.000000000 +0100 +@@ -70,6 +70,7 @@ + fd = -1; + + setup_logger (); ++ dbus_error_init (&error); + + button_type = getenv ("HAL_PROP_BUTTON_TYPE"); + if (button_type == NULL) +@@ -96,7 +97,6 @@ + if (udi == NULL) + goto out; + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/linux/probing/probe-net-bluetooth.c src/hal-0.5.14/hald/linux/probing/probe-net-bluetooth.c +--- hal-0.5.14/hald/linux/probing/probe-net-bluetooth.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-net-bluetooth.c 2011-12-19 20:39:54.000000000 +0100 +@@ -141,6 +141,8 @@ + DBusMessage *reply = NULL; + DBusError error; + ++ dbus_error_init (&error); ++ + udi = getenv ("UDI"); + if (udi == NULL) + goto out; +@@ -151,8 +153,6 @@ + + HAL_INFO (("Investigating '%s'", iface)); + +- dbus_error_init (&error); +- + if ((conn = dbus_bus_get (DBUS_BUS_SYSTEM, &error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/linux/probing/probe-printer.c src/hal-0.5.14/hald/linux/probing/probe-printer.c +--- hal-0.5.14/hald/linux/probing/probe-printer.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-printer.c 2011-12-19 20:39:54.000000000 +0100 +@@ -66,6 +66,8 @@ + ret = 1; + + setup_logger (); ++ ++ dbus_error_init (&error); + + udi = getenv ("UDI"); + if (udi == NULL) { +@@ -73,7 +75,6 @@ + goto out; + } + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) { + HAL_ERROR (("ctx init failed")); + goto out; +diff -u -r hal-0.5.14/hald/linux/probing/probe-smbios.c src/hal-0.5.14/hald/linux/probing/probe-smbios.c +--- hal-0.5.14/hald/linux/probing/probe-smbios.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-smbios.c 2011-12-19 20:39:54.000000000 +0100 +@@ -129,6 +129,8 @@ + ret = 1; + + setup_logger (); ++ ++ dbus_error_init (&error); + + udi = getenv ("UDI"); + if (udi == NULL) { +@@ -136,7 +138,6 @@ + goto out; + } + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) { + HAL_ERROR (("ctx init failed")); + goto out; +diff -u -r hal-0.5.14/hald/linux/probing/probe-storage.c src/hal-0.5.14/hald/linux/probing/probe-storage.c +--- hal-0.5.14/hald/linux/probing/probe-storage.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-storage.c 2011-12-19 20:39:54.000000000 +0100 +@@ -109,6 +109,8 @@ + /* assume failure */ + ret = 1; + ++ dbus_error_init (&error); ++ + if ((udi = getenv ("UDI")) == NULL) + goto out; + if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL) +@@ -127,7 +129,6 @@ + else + only_check_for_fs = FALSE; + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/linux/probing/probe-video4linux.c src/hal-0.5.14/hald/linux/probing/probe-video4linux.c +--- hal-0.5.14/hald/linux/probing/probe-video4linux.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-video4linux.c 2011-12-19 20:44:20.000000000 +0100 +@@ -30,7 +30,7 @@ + #include <sys/types.h> + #include <sys/time.h> + #include <sys/ioctl.h> +-#include <linux/videodev.h> ++#include <libv4l1-videodev.h> + #include <linux/videodev2.h> + #include <errno.h> + #include <fcntl.h> +@@ -58,6 +58,8 @@ + + setup_logger (); + ++ dbus_error_init (&error); ++ + device_file = getenv ("HAL_PROP_VIDEO4LINUX_DEVICE"); + if (device_file == NULL) + goto out; +@@ -66,7 +68,6 @@ + if (udi == NULL) + goto out; + +- dbus_error_init (&error); + ctx = libhal_ctx_init_direct (&error); + if (ctx == NULL) + goto out; +diff -u -r hal-0.5.14/hald/linux/probing/probe-volume.c src/hal-0.5.14/hald/linux/probing/probe-volume.c +--- hal-0.5.14/hald/linux/probing/probe-volume.c 2009-08-24 14:42:30.000000000 +0200 ++++ src/hal-0.5.14/hald/linux/probing/probe-volume.c 2011-12-19 20:39:54.000000000 +0100 +@@ -318,6 +318,8 @@ + /* assume failure */ + ret = 1; + ++ dbus_error_init (&error); ++ + if ((udi = getenv ("UDI")) == NULL) + goto out; + if ((device_file = getenv ("HAL_PROP_BLOCK_DEVICE")) == NULL) +@@ -346,7 +348,6 @@ + + fsusage = getenv ("HAL_PROP_VOLUME_FSUSAGE"); + +- dbus_error_init (&error); + if ((ctx = libhal_ctx_init_direct (&error)) == NULL) + goto out; + +diff -u -r hal-0.5.14/hald/util.h src/hal-0.5.14/hald/util.h +--- hal-0.5.14/hald/util.h 2009-04-03 16:31:34.000000000 +0200 ++++ src/hal-0.5.14/hald/util.h 2011-12-19 20:39:54.000000000 +0100 +@@ -38,7 +38,7 @@ + #endif + + #define HAL_NAME_MAX 256 +-#define HAL_PATH_MAX 512 ++#define HAL_PATH_MAX 4096 + + gboolean hal_util_remove_trailing_slash (gchar *path); + +diff -u -r hal-0.5.14/tools/linux/hal-system-killswitch-get-power-linux src/hal-0.5.14/tools/linux/hal-system-killswitch-get-power-linux +--- hal-0.5.14/tools/linux/hal-system-killswitch-get-power-linux 2008-11-10 11:14:12.000000000 +0100 ++++ src/hal-0.5.14/tools/linux/hal-system-killswitch-get-power-linux 2011-12-19 20:39:54.000000000 +0100 +@@ -8,11 +8,6 @@ + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + +-DELL_WCTL=/usr/bin/dellWirelessCtl +-if [ -x "/usr/sbin/dellWirelessCtl" ]; then +- DELL_WCTL=/usr/sbin/dellWirelessCtl +-fi +- + if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then + if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then + value="`hal-system-sonypic getbluetooth`" +@@ -22,25 +17,6 @@ + exit 1 + fi + exit ${value} +- elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # TODO: write our own binary that links with libsmbios? +- $DELL_WCTL --st_bt +- value=$? +- if [ "$value" = "0" ]; then +- exit 1 +- elif [ "$value" = "1" ]; then +- exit 0 +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $value" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi + elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then + read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null + if [ $? -eq 0 ]; then +@@ -53,56 +29,6 @@ + else + echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 + echo "Access type not supported" >&2 +- exit 1 +- fi +-elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then +- if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # TODO: write our own binary that links with libsmbios? +- $DELL_WCTL --st_wlan +- value=$? +- if [ "$value" = "0" ]; then +- exit 1 +- elif [ "$value" = "1" ]; then +- exit 0 +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $value" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "Access type not supported" >&2 +- exit 1 +- fi +-elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then +- if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # TODO: write our own binary that links with libsmbios? +- $DELL_WCTL --st_wwan +- value=$? +- if [ "$value" = "0" ]; then +- exit 1 +- elif [ "$value" = "1" ]; then +- exit 0 +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $value" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "Access type not supported" >&2 + exit 1 + fi + else +diff -u -r hal-0.5.14/tools/linux/hal-system-killswitch-set-power-linux src/hal-0.5.14/tools/linux/hal-system-killswitch-set-power-linux +--- hal-0.5.14/tools/linux/hal-system-killswitch-set-power-linux 2008-11-10 11:14:12.000000000 +0100 ++++ src/hal-0.5.14/tools/linux/hal-system-killswitch-set-power-linux 2011-12-19 20:39:54.000000000 +0100 +@@ -8,11 +8,6 @@ + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + +-DELL_WCTL=/usr/bin/dellWirelessCtl +-if [ -x "/usr/sbin/dellWirelessCtl" ]; then +- DELL_WCTL=/usr/sbin/dellWirelessCtl +-fi +- + if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then + if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then + hal-system-sonypic setbluetooth $value +@@ -23,26 +18,6 @@ + exit 1 + fi + exit 0 +- elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # TODO: write our own binary that links with libsmbios? +- if [ "$value" = "true" ]; then +- $DELL_WCTL --bt 1 +- ret=$? +- else +- $DELL_WCTL --bt 0 +- ret=$? +- fi +- if [ "$ret" != "0" ]; then +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $ret" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi + elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -w "$HAL_PROP_LINUX_SYSFS_PATH" ]; then + if [ "$value" = "true" ]; then + bit=1; +@@ -59,60 +34,6 @@ + else + echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 + echo "Access type not supported" >&2 +- exit 1 +- fi +-elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then +- if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # As a side effect we disable the physical kill switch +- # TODO: write our own binary that links with libsmbios? +- if [ "$value" = "true" ]; then +- $DELL_WCTL --sw_wlan 0 --wlan 1 +- ret=$? +- else +- $DELL_WCTL --sw_wlan 0 --wlan 0 +- ret=$? +- fi +- if [ "$ret" != "0" ]; then +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $ret" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "Access type not supported" >&2 +- exit 1 +- fi +-elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then +- if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then +- if [ -x "$DELL_WCTL" ]; then +- # As a side effect we disable the physical kill switch +- # TODO: write our own binary that links with libsmbios? +- if [ "$value" = "true" ]; then +- $DELL_WCTL --sw_wwan 0 --wwan 1 +- ret=$? +- else +- $DELL_WCTL --sw_wwan 0 --wwan 0 +- ret=$? +- fi +- if [ "$ret" != "0" ]; then +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl returned $ret" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "dellWirelessCtl ($DELL_WCTL) not available or executable" >&2 +- exit 1 +- fi +- else +- echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2 +- echo "Access type not supported" >&2 + exit 1 + fi + else diff --git a/hal.service b/hal.service new file mode 100644 index 000000000000..8851cfe5feff --- /dev/null +++ b/hal.service @@ -0,0 +1,14 @@ +[Unit] +Description=Hardware Abstraction Layer +Requires=dbus.service +Wants=acpid.service +After=dbus.service syslog.target acpid.service + +[Service] +Type=dbus +BusName=org.freedesktop.Hal +ExecStart=/usr/sbin/hald --daemon=no --use-syslog + +[Install] +WantedBy=multi-user.target +Alias=dbus-org.freedesktop.Hal.service @@ -0,0 +1,54 @@ +#!/bin/bash + +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +case "$1" in + start) + #Check for running dbus, start when not running + ck_daemon dbus && /etc/rc.d/dbus start + if [ -x /etc/rc.d/acpid ]; then + ck_daemon acpid && /etc/rc.d/acpid start + fi + stat_busy "Starting Hardware Abstraction Layer" + if [ ! -x /var/cache/hald ] ; then + install -m755 -g 82 -o 82 -d /var/cache/hald + fi + if [ ! -x /var/run/hald ]; then + install -m755 -g 82 -o 82 -d /var/run/hald + fi + if [ ! -x /var/run/hald/hald-local ]; then + install -m755 -g 0 -o 0 -d /var/run/hald/hald-local + fi + if [ ! -x /var/run/hald/hald-runner ]; then + install -m755 -g 0 -o 0 -d /var/run/hald/hald-runner + fi + /usr/sbin/hald + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon hald + stat_done + fi + ;; + stop) + stat_busy "Stopping Hardware Abstraction Layer" + [ -f /var/run/hald.pid ] && kill `cat /var/run/hald.pid` &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon hald + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" + ;; +esac +exit 0 diff --git a/udev-update.patch b/udev-update.patch new file mode 100644 index 000000000000..f2ca5977a7ed --- /dev/null +++ b/udev-update.patch @@ -0,0 +1,55 @@ +diff -ur hal-0.5.14_origin/hald/linux/blockdev.c hal-0.5.14/hald/linux/blockdev.c +--- hal-0.5.14_origin/hald/linux/blockdev.c 2012-02-15 01:44:51.000000000 +0100 ++++ hal-0.5.14/hald/linux/blockdev.c 2012-02-15 01:45:12.000000000 +0100 +@@ -1864,7 +1864,7 @@ + char *ret; + char *u_stdout; + int u_exit_status; +- const char *argv[] = {"/sbin/udevadm", "info", "--root", "--query", "name", "--path", NULL, NULL}; ++ const char *argv[] = {"/usr/bin/udevadm", "info", "--root", "--query", "name", "--path", NULL, NULL}; + GError *g_error; + + ret = NULL; +diff -ur hal-0.5.14_origin/hald/linux/coldplug.c hal-0.5.14/hald/linux/coldplug.c +--- hal-0.5.14_origin/hald/linux/coldplug.c 2012-02-15 01:44:51.000000000 +0100 ++++ hal-0.5.14/hald/linux/coldplug.c 2012-07-16 20:59:15.880478378 -0700 +@@ -154,8 +154,7 @@ + static gboolean + hal_util_init_sysfs_to_udev_map (void) + { +- char *udevdb_export_argv[] = { "/sbin/udevadm", "info", "-e", NULL }; +- char *udevroot_argv[] = { "/sbin/udevadm", "info", "-r", NULL }; ++ char *udevdb_export_argv[] = { "/usr/bin/udevadm", "info", "-e", NULL }; + int udevinfo_exitcode; + UdevInfo *info = NULL; + char *p; +@@ -163,26 +162,9 @@ + + sysfs_to_udev_map = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, udev_info_free); + +- /* get udevroot */ +- if (g_spawn_sync ("/", udevroot_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL, +- &udevinfo_stdout, +- NULL, +- &udevinfo_exitcode, +- NULL) != TRUE) { +- HAL_ERROR (("Couldn't invoke %s", udevroot_argv[0])); +- goto error; +- } +- if (udevinfo_exitcode != 0) { +- HAL_ERROR (("%s returned %d", udevroot_argv[0], udevinfo_exitcode)); +- goto error; +- } +- +- g_strlcpy(dev_root, udevinfo_stdout, sizeof(dev_root)); +- p = strchr(dev_root, '\n'); +- if (p != NULL) +- p[0] = '\0'; +- g_free(udevinfo_stdout); +- HAL_INFO (("dev_root is %s", dev_root)); ++ /* get udevroot - hardcode to /dev to fix udevadm commit ++ * http://cgit.freedesktop.org/systemd/systemd/commit/?id=4f5d327a49e1a40ae0a3b8f1855dc90f3c0d953f */ ++ g_strlcpy(dev_root, "/dev", sizeof(dev_root)); + + /* get udevdb export */ + if (g_spawn_sync ("/", udevdb_export_argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, NULL, NULL, |