1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-25 00:51:21 +00:00

- Fix USB storage detection.

- Add MMC/SD support.
- Update LIB_DEPENDS to new format.

PR:		183236
Submitted by:	avilla (myself)
Approved by:	gnome (maintainer timeout)

- Fix plist when PREFIX != LOCALBASE

Reported by:	poudriere testport
This commit is contained in:
Alberto Villa 2013-11-12 17:35:53 +00:00
parent 3df78f7fe4
commit 7dfafb3561
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=333593
8 changed files with 262 additions and 14 deletions

View File

@ -4,7 +4,7 @@
PORTNAME= hal
DISTVERSION= 0.5.14
PORTREVISION= 21
PORTREVISION= 22
CATEGORIES= sysutils
MASTER_SITES= http://hal.freedesktop.org/releases/
@ -13,9 +13,9 @@ COMMENT= Hardware Abstraction Layer for simplifying device access
BUILD_DEPENDS= ${LOCALBASE}/include/linux/videodev2.h:${PORTSDIR}/multimedia/v4l_compat
# keep shlib version, to prevent confusion with polkit-* from sysutils/polkit
LIB_DEPENDS= polkit.2:${PORTSDIR}/sysutils/policykit \
volume_id:${PORTSDIR}/devel/libvolume_id \
ck-connector:${PORTSDIR}/sysutils/consolekit
LIB_DEPENDS= libpolkit.so.2:${PORTSDIR}/sysutils/policykit \
libvolume_id.so:${PORTSDIR}/devel/libvolume_id \
libck-connector.so:${PORTSDIR}/sysutils/consolekit
RUN_DEPENDS= ${LOCALBASE}/share/pciids/pci.ids:${PORTSDIR}/misc/pciids
USES= pathfix gettext gmake pkgconfig

View File

@ -0,0 +1,36 @@
--- ./hald/freebsd/Makefile.in.orig 2009-11-30 23:22:38.000000000 +0100
+++ ./hald/freebsd/Makefile.in 2013-10-22 02:07:00.268399458 +0200
@@ -59,13 +59,14 @@
hf-pcmcia.c hf-pcmcia.h hf-scsi.c hf-scsi.h hf-serial.c \
hf-serial.h hf-sound.c hf-sound.h hf-storage.c hf-storage.h \
hf-usb.c hf-usb.h hf-util.c hf-util.h hf-volume.c hf-volume.h \
- osspec.c hal-file-monitor.c hf-usb2.c hf-usb2.h
+ osspec.c hal-file-monitor.c hf-usb2.c hf-usb2.h \
+ hf-memcard.c hf-memcard.h
@HAVE_LIBUSB20_TRUE@am__objects_1 = hf-usb2.lo
am_libhald_freebsd_la_OBJECTS = hf-acpi.lo hf-ata.lo hf-block.lo \
hf-computer.lo hf-devd.lo hf-devtree.lo hf-drm.lo hf-net.lo \
hf-pci.lo hf-pcmcia.lo hf-scsi.lo hf-serial.lo hf-sound.lo \
hf-storage.lo hf-usb.lo hf-util.lo hf-volume.lo osspec.lo \
- hal-file-monitor.lo $(am__objects_1)
+ hf-memcard.lo hal-file-monitor.lo $(am__objects_1)
libhald_freebsd_la_OBJECTS = $(am_libhald_freebsd_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -325,7 +326,7 @@
hf-scsi.c hf-scsi.h hf-serial.c hf-serial.h hf-sound.c \
hf-sound.h hf-storage.c hf-storage.h hf-usb.c hf-usb.h \
hf-util.c hf-util.h hf-volume.c hf-volume.h osspec.c \
- hal-file-monitor.c $(am__append_1)
+ hf-memcard.c hf-memcard.h hal-file-monitor.c $(am__append_1)
libhald_freebsd_la_LDFLAGS = -lcam $(am__append_2)
EXTRA_DIST = README TODO
all: all-recursive
@@ -388,6 +389,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-devd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-devtree.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-drm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-memcard.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-net.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-pci.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hf-pcmcia.Plo@am__quote@

View File

@ -0,0 +1,21 @@
--- ./hald/freebsd/hf-devtree.c.orig 2009-09-17 15:47:14.000000000 +0200
+++ ./hald/freebsd/hf-devtree.c 2013-10-22 02:16:42.548388644 +0200
@@ -36,6 +36,7 @@
#include "hf-ata.h"
#include "hf-block.h"
#include "hf-drm.h"
+#include "hf-memcard.h"
#include "hf-pcmcia.h"
#include "hf-storage.h"
#include "hf-util.h"
@@ -388,7 +389,9 @@
{ "psm", hf_devtree_psm_set_properties },
{ "sio", NULL },
{ "speaker", NULL },
- { "usbus", NULL }
+ { "usbus", NULL },
+ { "mmc", hf_mmc_host_set_properties },
+ { "mmcsd", hf_mmc_set_properties }
};
static void

View File

@ -0,0 +1,109 @@
--- ./hald/freebsd/hf-memcard.c.orig 2013-10-22 01:49:10.228430727 +0200
+++ ./hald/freebsd/hf-memcard.c 2013-10-22 01:48:06.869268391 +0200
@@ -0,0 +1,106 @@
+/***************************************************************************
+ * CVSID: $Id$
+ *
+ * hf-memcard.c : memory card support
+ *
+ * Copyright (C) 2013 Alberto Villa <avilla@FreeBSD.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ **************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "../logger.h"
+
+#include "hf-memcard.h"
+#include "hf-block.h"
+#include "hf-devtree.h"
+#include "hf-storage.h"
+#include "hf-util.h"
+
+static HalDevice *
+hf_memcard_block_device_new (HalDevice *parent,
+ const char *driver,
+ int unit,
+ const char *drive_type)
+{
+ HalDevice *device;
+ char devname[16];
+
+ snprintf(devname, sizeof(devname), "%s%d", driver, unit);
+
+ g_return_val_if_fail(HAL_IS_DEVICE(parent), NULL);
+ g_return_val_if_fail(devname != NULL, NULL);
+
+ device = hf_device_new(parent);
+
+ hf_devtree_device_set_name(device, devname);
+ hf_block_device_enable(device, devname);
+
+ hf_storage_device_enable(device);
+
+ hal_device_copy_property(parent, "info.subsystem", device, "storage.bus");
+ hal_device_property_set_string(device, "storage.originating_device", hal_device_get_udi(parent));
+ hal_device_property_set_bool(device, "storage.removable", TRUE);
+ hal_device_property_set_bool(device, "storage.media_check_enabled", TRUE);
+ hal_device_property_set_bool(device, "storage.removable.support_async_notification", FALSE);
+ hal_device_property_set_bool(device, "storage.hotpluggable", TRUE);
+ if (drive_type)
+ {
+ hal_device_property_set_string(device, "storage.drive_type", drive_type);
+ }
+
+ if (hf_device_preprobe(device))
+ {
+ hf_block_device_complete(device, device, FALSE);
+ hf_device_add(device);
+ hf_storage_device_probe(device, FALSE);
+ }
+
+ return device;
+}
+
+void
+hf_mmc_host_set_properties (HalDevice *device)
+{
+ hal_device_property_set_string(device, "info.subsystem", "mmc_host");
+ hal_device_copy_property(device, "freebsd.unit", device, "mmc_host.host");
+}
+
+void
+hf_mmc_set_properties (HalDevice *device)
+{
+ HalDevice *block_device;
+
+ hal_device_property_set_string(device, "info.subsystem", "mmc");
+
+ hf_memcard_block_device_new(device,
+ hal_device_property_get_string(device, "freebsd.driver"),
+ hal_device_property_get_int(device, "freebsd.unit"),
+ "sd_mmc");
+
+ /* This information belongs to the block device. */
+ hal_device_property_remove(device, "freebsd.device_file");
+ hal_device_property_remove(device, "freebsd.driver");
+ hal_device_property_remove(device, "freebsd.unit");
+}

View File

@ -0,0 +1,39 @@
--- ./hald/freebsd/hf-memcard.h.orig 2013-10-22 01:49:12.608421644 +0200
+++ ./hald/freebsd/hf-memcard.h 2013-10-22 01:41:55.228962237 +0200
@@ -0,0 +1,36 @@
+/***************************************************************************
+ * CVSID: $Id$
+ *
+ * hf-memcard.h : memory card support
+ *
+ * Copyright (C) 2013 Alberto Villa <avilla@FreeBSD.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ **************************************************************************/
+
+#ifndef _HF_MEMCARD_H
+#define _HF_MEMCARD_H
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "../device.h"
+
+void hf_mmc_host_set_properties (HalDevice *device);
+void hf_mmc_set_properties (HalDevice *device);
+
+#endif /* _HF_MEMCARD_H */

View File

@ -0,0 +1,28 @@
--- ./hald/freebsd/hf-scsi.c.orig 2009-08-24 14:42:29.000000000 +0200
+++ ./hald/freebsd/hf-scsi.c 2013-10-23 13:11:08.979758920 +0200
@@ -223,7 +223,7 @@
hal_device_copy_property(parent, "scsi.lun", device, "storage.lun");
/* do not stop here, in case it's an umass device */
}
- else if (! strcmp(bus, "usb"))
+ else if (hal_device_has_property(parent, "scsi_host.freebsd.driver") && ! strcmp(hal_device_property_get_string(parent, "scsi_host.freebsd.driver"), "umass"))
{
hal_device_property_set_string(device, "storage.bus", "usb");
hal_device_property_set_string(device, "storage.originating_device", hal_device_get_udi(parent));
@@ -508,6 +508,16 @@
if (! parent || ! hal_device_property_get_bool(parent, "info.ignore"))
{
device = hf_scsi_bus_device_new(parent, match);
+ /*
+ * Due to synchronization problems, the SCSI bus could be
+ * created before the USB interface. Mark it as a USB mass
+ * storage device to ensure it is detected as such.
+ */
+ if (! strcmp(match->dev_name, "umass-sim"))
+ {
+ hal_device_property_set_string(device, "scsi_host.freebsd.driver", "umass");
+ hal_device_property_set_int(device, "scsi_host.freebsd.unit", match->unit_number);
+ }
hf_device_preprobe_and_add(device);
}
}

View File

@ -1,5 +1,5 @@
--- hald/freebsd/hf-usb2.c.orig 2009-08-24 14:42:29.000000000 +0200
+++ hald/freebsd/hf-usb2.c 2011-06-28 16:18:02.000000000 +0200
--- ./hald/freebsd/hf-usb2.c.orig 2009-08-24 14:42:29.000000000 +0200
+++ ./hald/freebsd/hf-usb2.c 2013-10-23 13:10:36.639758556 +0200
@@ -22,7 +22,7 @@
**************************************************************************/
@ -9,7 +9,7 @@
#endif
#include <string.h>
@@ -42,246 +42,200 @@
@@ -42,246 +42,213 @@
static struct libusb20_backend *hf_usb2_be = NULL;
static void
@ -94,6 +94,19 @@
+
+ hf_usb_device_compute_udi(device);
+ hf_device_add(device);
+
+ /*
+ * The SCSI bus could already exist; make it a child of
+ * this USB interface.
+ */
+ if (driver && !strcmp(driver, "umass")) {
+ HalDevice *scsi_bus;
+ scsi_bus = hf_device_store_match(hald_get_gdl(),
+ "scsi_host.freebsd.driver", HAL_PROPERTY_TYPE_STRING, driver,
+ "scsi_host.freebsd.unit", HAL_PROPERTY_TYPE_INT32, hal_device_property_get_int(device, "freebsd.unit"), NULL);
+ if (scsi_bus)
+ hal_device_property_set_string(scsi_bus, "info.parent", hal_device_get_udi(device));
+ }
+ }
+ }
}

View File

@ -70,6 +70,13 @@ libexec/hald-probe-storage
libexec/hald-probe-volume
libexec/hald-runner
sbin/hald
share/PolicyKit/policy/org.freedesktop.hal.dockstation.policy
share/PolicyKit/policy/org.freedesktop.hal.killswitch.policy
share/PolicyKit/policy/org.freedesktop.hal.leds.policy
share/PolicyKit/policy/org.freedesktop.hal.policy
share/PolicyKit/policy/org.freedesktop.hal.power-management.policy
share/PolicyKit/policy/org.freedesktop.hal.storage.policy
share/PolicyKit/policy/org.freedesktop.hal.wol.policy
%%PORTDOCS%%%%DOCSDIR%%/README.freebsd
%%PORTDOCS%%%%DOCSDIR%%/README.fuse
%%DATADIR%%/dist/hal.conf
@ -89,13 +96,6 @@ sbin/hald
%%DATADIR%%/fdi/policy/10osvendor/20-storage-methods.fdi
%%DATADIR%%/fdi/policy/10osvendor/30-wol.fdi
%%DATADIR%%/mount-fuse
share/PolicyKit/policy/org.freedesktop.hal.dockstation.policy
share/PolicyKit/policy/org.freedesktop.hal.killswitch.policy
share/PolicyKit/policy/org.freedesktop.hal.leds.policy
share/PolicyKit/policy/org.freedesktop.hal.policy
share/PolicyKit/policy/org.freedesktop.hal.power-management.policy
share/PolicyKit/policy/org.freedesktop.hal.storage.policy
share/PolicyKit/policy/org.freedesktop.hal.wol.policy
@exec mkdir -p %D/%%DATADIR%%/fdi/policy/20thirdparty
@exec mkdir -p %D/%%DATADIR%%/fdi/preprobe/10osvendor
@exec mkdir -p %D/%%DATADIR%%/fdi/preprobe/20thirdparty
@ -112,6 +112,8 @@ share/PolicyKit/policy/org.freedesktop.hal.wol.policy
@dirrm %%DATADIR%%/dist
@dirrm %%DATADIR%%
@dirrm %%DOCSDIR%%
@dirrmtry share/PolicyKit/policy
@dirrmtry share/PolicyKit
@dirrm libexec/hal/scripts/freebsd
@dirrm libexec/hal/scripts
@dirrm libexec/hal