[Pkg-utopia-maintainers] Bug#528383: hal: GNU/kFreeBSD support

Aurelien Jarno aurel32 at debian.org
Tue May 12 15:29:20 UTC 2009


Package: hal
Version: 0.5.12~git20090406.46dc48-2
Severity: important
Tags: patch
User: glibc-bsd-devel at lists.alioth.debian.org
Usertags: kfreebsd

hal support has been added recently to FreeBSD, and with minor changes
it also works on GNU/kFreeBSD. I have already change most of the needed
changes upstream, but they have been committed just after the release of
version 0.5.12. I'll try to merge the remaining needed changes for 
version 0.5.13 so that it works out of the box.

You will find below a patch to make hal working on GNU/kFreeBSD, 
including both changes to the packaging and upstream. It would be nice 
if you can apply it for the upload of version 0.5.12. Thanks in 
advance.

diff -u hal-0.5.12~git20090406.46dc48/debian/control hal-0.5.12~git20090406.46dc48/debian/control
--- hal-0.5.12~git20090406.46dc48/debian/control
+++ hal-0.5.12~git20090406.46dc48/debian/control
@@ -32,7 +32,7 @@
 
 Package: hal
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, pciutils, usbutils, udev (>= 0.125), dbus (>= 0.61), lsb-base (>= 3.2-14), hal-info (>= 20070402), pm-utils, mount (>= 2.13), policykit (>= 0.7), consolekit (>= 0.3), acl
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, pciutils, usbutils, udev (>= 0.125) [!kfreebsd-amd64 !kfreebsd-i386], dbus (>= 0.61), lsb-base (>= 3.2-14), hal-info (>= 20070402), pm-utils [!kfreebsd-amd64 !kfreebsd-i386], mount (>= 2.13) [!kfreebsd-amd64 !kfreebsd-i386], freebsd-utils [kfreebsd-amd64 kfreebsd-i386], policykit (>= 0.7), consolekit (>= 0.3), acl
 Recommends: eject, libsmbios-bin [amd64 i386 lpia]
 Suggests: gnome-device-manager
 Description: Hardware Abstraction Layer
@@ -125,0 +126,15 @@
+Package: libhald-freebsd-probe0
+Section: libs
+Architecture: kfreebsd-i386 kfreebsd-amd64
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Hardware Abstraction Layer - shared library for device probing
+ HAL provides an abstract view on hardware.
+ .
+ This abstraction layer is simply an interface that makes it possible to
+ add support for new devices and new ways of connecting devices to the
+ computer, without modifying every application that uses the device.
+ It maintains a list of devices that currently exist, and can provide
+ information about those upon request.
+ .
+ This library provides device probing on FreeBSD.
+
diff -u hal-0.5.12~git20090406.46dc48/debian/hal.init hal-0.5.12~git20090406.46dc48/debian/hal.init
--- hal-0.5.12~git20090406.46dc48/debian/hal.init
+++ hal-0.5.12~git20090406.46dc48/debian/hal.init
@@ -48,7 +48,7 @@
 
 case "$1" in
   start)
-	if [ ! -d /proc/sys/fs/inotify ]; then
+	if [ ! -d /proc/sys/fs/inotify ] && [ `uname` = "Linux" ]; then
 		log_failure_msg "Can't start $DESC - enable inotify support in your kernel"
 		exit 0
 	fi
@@ -57,7 +57,7 @@
 		exit 0
 	fi
 	
-	if [ ! -d /sys/kernel ]; then
+	if [ ! -d /sys/kernel ] && [ `uname` = "Linux" ]; then
 		log_failure_msg "Can't start $DESC - sysfs not mounted on /sys"
 		exit 0
 	fi
diff -u hal-0.5.12~git20090406.46dc48/debian/patches/series hal-0.5.12~git20090406.46dc48/debian/patches/series
--- hal-0.5.12~git20090406.46dc48/debian/patches/series
+++ hal-0.5.12~git20090406.46dc48/debian/patches/series
@@ -4,0 +5 @@
+50_kfreebsd.patch
--- hal-0.5.12~git20090406.46dc48.orig/debian/libhald-freebsd-probe0.install
+++ hal-0.5.12~git20090406.46dc48/debian/libhald-freebsd-probe0.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/libhald_freebsd_probe.so.*
only in patch2:
unchanged:
--- hal-0.5.12~git20090406.46dc48.orig/debian/libhald-freebsd-probe0.shlibs
+++ hal-0.5.12~git20090406.46dc48/debian/libhald-freebsd-probe0.shlibs
@@ -0,0 +1 @@
+libhald_freebsd_probe 0 libhald-freebsd-probe0 (>= 0.5.11)
only in patch2:
unchanged:
--- hal-0.5.12~git20090406.46dc48.orig/debian/hal.install.kfreebsd-amd64
+++ hal-0.5.12~git20090406.46dc48/debian/hal.install.kfreebsd-amd64
@@ -0,0 +1,9 @@
+debian/tmp/etc/
+debian/tmp/usr/bin/
+debian/tmp/usr/sbin/
+debian/tmp/sbin/umount.hal usr/sbin
+debian/tmp/usr/lib/hal/
+debian/tmp/usr/share/hal/fdi/
+debian/tmp/usr/share/PolicyKit/
+debian/preferences.fdi  etc/hal/fdi/policy
+debian/debian-storage-policy-ignore-fixed-crypto-drives.fdi usr/share/hal/fdi/policy/10osvendor
only in patch2:
unchanged:
--- hal-0.5.12~git20090406.46dc48.orig/debian/hal.install.kfreebsd-i386
+++ hal-0.5.12~git20090406.46dc48/debian/hal.install.kfreebsd-i386
@@ -0,0 +1,9 @@
+debian/tmp/etc/
+debian/tmp/usr/bin/
+debian/tmp/usr/sbin/
+debian/tmp/sbin/umount.hal usr/sbin
+debian/tmp/usr/lib/hal/
+debian/tmp/usr/share/hal/fdi/
+debian/tmp/usr/share/PolicyKit/
+debian/preferences.fdi  etc/hal/fdi/policy
+debian/debian-storage-policy-ignore-fixed-crypto-drives.fdi usr/share/hal/fdi/policy/10osvendor
only in patch2:
unchanged:
--- hal-0.5.12~git20090406.46dc48.orig/debian/patches/50_kfreebsd.patch
+++ hal-0.5.12~git20090406.46dc48/debian/patches/50_kfreebsd.patch
@@ -0,0 +1,276 @@
+--- a/configure
++++ b/configure
+@@ -19138,7 +19138,7 @@
+         *-*-solaris*)
+ 		   HALD_BACKEND="solaris"
+ 		   ;;
+-        *-*-freebsd*)
++        *-*-freebsd* | *-*-kfreebsd*-gnu)
+                    HALD_BACKEND="freebsd"
+                    ;;
+ 	*-linux*)
+--- a/configure.in
++++ b/configure.in
+@@ -488,7 +488,7 @@
+         *-*-solaris*)
+ 		   HALD_BACKEND="solaris"
+ 		   ;;
+-        *-*-freebsd*)
++        *-*-freebsd* | *-*-kfreebsd*-gnu)
+                    HALD_BACKEND="freebsd"
+                    ;;
+ 	*-linux*)
+--- a/hald/freebsd/hf-storage.c
++++ b/hald/freebsd/hf-storage.c
+@@ -644,7 +644,6 @@
+ hf_storage_device_enable (HalDevice *device)
+ {
+   g_return_if_fail(HAL_IS_DEVICE(device));
+-  g_return_if_fail(devname != NULL);
+ 
+   hal_device_property_set_string(device, "storage.bus", "platform");
+   hal_device_property_set_string(device, "storage.drive_type", "disk");
+--- a/hald/freebsd/addons/addon-storage.c
++++ b/hald/freebsd/addons/addon-storage.c
+@@ -181,10 +181,12 @@
+ static void
+ update_proc_title (const char *device, boolean polling_enabled)
+ {
++#ifndef __GLIBC__
+   if (polling_enabled)
+     setproctitle("%s", device);
+   else
+     setproctitle("no polling on %s because it is explicitly disabled", device);
++#endif
+ }
+ 
+ static DBusHandlerResult
+--- a/hald/freebsd/libprobe/hfp-cdrom.h
++++ b/hald/freebsd/libprobe/hfp-cdrom.h
+@@ -28,7 +28,7 @@
+ #  include <config.h>
+ #endif
+ 
+-#include <sys/types.h>
++#include <stdint.h>
+ 
+ #include "hfp.h"
+ 
+@@ -53,8 +53,8 @@
+ typedef struct
+ {
+   /* mode page data header */
+-  u_int16_t   data_length;
+-  u_int8_t    medium_type;
++  uint16_t   data_length;
++  uint8_t    medium_type;
+ #define HFP_CDROM_MST_TYPE_MASK_LOW	0x0f
+ #define HFP_CDROM_MST_FMT_NONE		0x00
+ #define HFP_CDROM_MST_DATA_120		0x01
+@@ -75,17 +75,17 @@
+ #define HFP_CDROM_MST_DOOR_OPEN		0x71
+ #define HFP_CDROM_MST_FMT_ERROR		0x72
+ 
+-  u_int8_t    dev_spec;
+-  u_int16_t   unused;
+-  u_int16_t   blk_desc_len;
++  uint8_t    dev_spec;
++  uint16_t   unused;
++  uint16_t   blk_desc_len;
+ 
+   /* capabilities page */
+-  u_int8_t    page_code;
++  uint8_t    page_code;
+ #define HFP_CDROM_CAP_PAGE		0x2a
+ 
+-  u_int8_t    param_len;
++  uint8_t    param_len;
+ 
+-  u_int16_t   media;
++  uint16_t   media;
+ #define HFP_CDROM_MST_READ_CDR		0x0001
+ #define HFP_CDROM_MST_READ_CDRW		0x0002
+ #define HFP_CDROM_MST_READ_PACKET	0x0004
+@@ -98,7 +98,7 @@
+ #define HFP_CDROM_MST_WRITE_DVDR	0x1000
+ #define HFP_CDROM_MST_WRITE_DVDRAM	0x2000
+ 
+-  u_int16_t   capabilities;
++  uint16_t   capabilities;
+ #define HFP_CDROM_MSTAUDIO_PLAY		0x0001
+ #define HFP_CDROM_MST_COMPOSITE		0x0002
+ #define HFP_CDROM_MST_AUDIO_P1		0x0004
+@@ -115,7 +115,7 @@
+ #define HFP_CDROM_MST_ISRC		0x2000
+ #define HFP_CDROM_MST_UPC		0x4000
+ 
+-  u_int8_t    mechanism;
++  uint8_t    mechanism;
+ #define HFP_CDROM_MST_LOCKABLE		0x01
+ #define HFP_CDROM_MST_LOCKED		0x02
+ #define HFP_CDROM_MST_PREVENT		0x04
+@@ -131,18 +131,18 @@
+ #define HFP_CDROM_MST_SEP_VOL		0x01
+ #define HFP_CDROM_MST_SEP_MUTE		0x02
+ 
+-  u_int16_t   max_read_speed;		/* max raw data rate in bytes/1000 */
+-  u_int16_t   max_vol_levels;		/* number of discrete volume levels */
+-  u_int16_t   buf_size;			/* internal buffer size in bytes/1024 */
+-  u_int16_t   cur_read_speed;		/* current data rate in bytes/1000  */
+-
+-  u_int8_t    reserved3;
+-  u_int8_t    misc;
+-
+-  u_int16_t   max_write_speed;		/* max raw data rate in bytes/1000 */
+-  u_int16_t   cur_write_speed;		/* current data rate in bytes/1000  */
+-  u_int16_t   copy_protect_rev;
+-  u_int16_t   reserved4;
++  uint16_t   max_read_speed;		/* max raw data rate in bytes/1000 */
++  uint16_t   max_vol_levels;		/* number of discrete volume levels */
++  uint16_t   buf_size;			/* internal buffer size in bytes/1024 */
++  uint16_t   cur_read_speed;		/* current data rate in bytes/1000  */
++
++  uint8_t    reserved3;
++  uint8_t    misc;
++
++  uint16_t   max_write_speed;		/* max raw data rate in bytes/1000 */
++  uint16_t   cur_write_speed;		/* current data rate in bytes/1000  */
++  uint16_t   copy_protect_rev;
++  uint16_t   reserved4;
+ } HFPCDROMCapabilities;
+ 
+ HFPCDROM *hfp_cdrom_new (const char *path, const char *parent);
+--- a/hald/freebsd/probing/probe-volume.c
++++ b/hald/freebsd/probing/probe-volume.c
+@@ -59,7 +59,7 @@
+ };
+ #define ISO_PATH_TABLE_ENTRY_SIZE         8
+ 
+-#if __FreeBSD_version < 600101
++#if (__FreeBSD_version < 600101) && (__FreeBSD_kernel_version < 600101)
+ static uint32_t
+ isonum_731(unsigned char *p)
+ {
+@@ -342,7 +342,9 @@
+     goto end;
+ 
+   /* give a meaningful process title for ps(1) */
++#ifndef __GLIBC__
+   setproctitle("%s", device_file);
++#endif
+ 
+   has_children = hfp_getenv_bool("HF_HAS_CHILDREN");
+   is_swap = hfp_getenv_bool("HF_IS_SWAP");
+only in patch2:
+unchanged:
+--- a/hald/freebsd/probing/probe-scsi.c
++++ b/hald/freebsd/probing/probe-scsi.c
+@@ -48,7 +48,9 @@
+     goto end;
+ 
+   /* give a meaningful process title for ps(1) */
++#ifndef __GLIBC__
+   setproctitle("%s", device_file);
++#endif
+ 
+   /* cam_open_device() fails unless we use O_RDWR */
+   cam = cam_open_device(device_file, O_RDWR);
+--- a/hald/freebsd/probing/probe-hiddev.c
++++ b/hald/freebsd/probing/probe-hiddev.c
+@@ -63,8 +63,9 @@
+     goto end;
+ 
+   /* give a meaningful process title for ps(1) */
++#ifndef __GLIBC__
+   setproctitle("%s", device_file);
+-
++#endif
+   if (ioctl(fd, USB_GET_REPORT_ID, &report_id) < 0)
+     goto end;
+ 
+--- a/hald/freebsd/probing/probe-storage.c
++++ b/hald/freebsd/probing/probe-storage.c
+@@ -192,7 +192,9 @@
+     goto end;
+ 
+   /* give a meaningful process title for ps(1) */
++#ifndef __GLIBC__
+   setproctitle("%s", device_file);
++#endif
+ 
+   has_children = hfp_getenv_bool("HF_HAS_CHILDREN");
+   only_check_for_media = hfp_getenv_bool("HF_ONLY_CHECK_FOR_MEDIA");
+only in patch2:
+unchanged:
+--- a/tools/hal-system-power-pmu.c
++++ b/tools/hal-system-power-pmu.c
+@@ -53,7 +53,7 @@
+ static int
+ pmac_sleep (void)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+@@ -90,7 +90,7 @@
+ static int
+ pmac_get_lcd_brightness (int *val)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+@@ -127,7 +127,7 @@
+ static int
+ pmac_set_lcd_brightness (int val)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+only in patch2:
+unchanged:
+--- a/tools/hal-system-sonypic.c
++++ b/tools/hal-system-sonypic.c
+@@ -63,7 +63,7 @@
+ static int
+ sonypi_get_lcd_brightness (__u8 *val)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+@@ -163,7 +163,7 @@
+ static int
+ sonypi_set_lcd_brightness (__u8 val)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+@@ -195,7 +195,7 @@
+ static int
+ sonypi_set_bluetooth_power (int val)
+ {
+-#ifdef __FreeBSD__
++#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
+ 	return FALSE;			/* FIXME implement */
+ #elif sun
+ 	return FALSE;			/* FIXME implement */
+--- a/hald/freebsd/hf-pci.c
++++ b/hald/freebsd/hf-pci.c
+@@ -27,7 +27,7 @@
+ 
+ #include <stdio.h>
+ #include <string.h>
+-#include <bitstring.h>
++#include <sys/bitstring.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+

-- System Information:
Debian Release: squeeze/sid
Architecture: kfreebsd-i386 (i686)

Kernel: kFreeBSD 7.1-1-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hal depends on:
ii  acl        2.2.47-2                      Access control list utilities
ii  adduser    3.110                         add and remove users and groups
ii  consolekit 0.3.0-2                       framework for defining and trackin
ii  dbus       1.2.12-1                      simple interprocess messaging syst
ii  freebsd-ut 7.1-5                         FreeBSD utilities needed for GNU/k
ii  hal-info   20090309-1                    Hardware Abstraction Layer - fdi f
ii  libc0.1    2.9-12                        GNU C Library: Shared libraries
ii  libcam0    7.1-2                         FreeBSD CAM (Common Access Method)
ii  libdbus-1- 1.2.12-1                      simple interprocess messaging syst
ii  libdbus-gl 0.80-4                        simple interprocess messaging syst
ii  libexpat1  2.0.1-4                       XML parsing C library - runtime li
ii  libglib2.0 2.20.1-2                      The GLib library of C routines
ii  libhal-sto 0.5.12~git20090406.46dc48-2   Hardware Abstraction Layer - share
ii  libhal1    0.5.12~git20090406.46dc48-2   Hardware Abstraction Layer - share
ii  libhald-fr 0.5.12~git20090406.46dc48-2   Hardware Abstraction Layer - share
ii  libpolkit2 0.9-3                         library for accessing PolicyKit
ii  libusbhid3 7.1-2                         FreeBSD library to access USB HID 
ii  libvolume- 0.81.0-2                      libvolume_id shared library
ii  lsb-base   3.2-22                        Linux Standard Base 3.2 init scrip
ii  pciutils   1:3.1.2-3                     Linux PCI Utilities
ii  policykit  0.9-3                         framework for managing administrat
ii  usbutils   0.81-1                        Linux USB utilities

Versions of packages hal recommends:
ii  eject           2.1.5+deb1+cvs20081104-6 ejects CDs and operates CD-Changer

Versions of packages hal suggests:
pn  gnome-device-manager          <none>     (no description available)

-- no debconf information





More information about the Pkg-utopia-maintainers mailing list