forked from Lainports/freebsd-ports
Fix the build on recent -CURRENT with the removal of oldusb.
This commit is contained in:
parent
edb4caa644
commit
372eb252ae
4 changed files with 145 additions and 39 deletions
|
|
@ -1,6 +1,14 @@
|
|||
--- hald/freebsd/hf-devd.c.orig 2008-05-07 19:23:59.000000000 -0400
|
||||
+++ hald/freebsd/hf-devd.c 2009-02-23 01:44:32.000000000 -0500
|
||||
@@ -40,7 +40,11 @@
|
||||
+++ hald/freebsd/hf-devd.c 2009-05-30 03:15:33.000000000 -0400
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
+#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
@@ -40,7 +41,11 @@
|
||||
#include "hf-acpi.h"
|
||||
#include "hf-net.h"
|
||||
#include "hf-pcmcia.h"
|
||||
|
|
@ -12,14 +20,16 @@
|
|||
#include "hf-util.h"
|
||||
|
||||
#define HF_DEVD_SOCK_PATH "/var/run/devd.pipe"
|
||||
@@ -51,10 +55,14 @@
|
||||
@@ -51,10 +56,16 @@
|
||||
#define HF_DEVD_EVENT_NOMATCH '?'
|
||||
|
||||
static HFDevdHandler *handlers[] = {
|
||||
+#ifdef HAVE_LIBUSB20
|
||||
+ &hf_usb2_devd_handler,
|
||||
+#endif
|
||||
+#if __FreeBSD_version < 800092
|
||||
&hf_usb_devd_handler,
|
||||
+#endif
|
||||
&hf_net_devd_handler,
|
||||
&hf_acpi_devd_handler,
|
||||
- &hf_pcmcia_devd_handler
|
||||
|
|
@ -28,7 +38,7 @@
|
|||
};
|
||||
|
||||
static gboolean hf_devd_inited = FALSE;
|
||||
@@ -381,13 +389,13 @@ hf_devd_event_cb (GIOChannel *source, GI
|
||||
@@ -381,13 +392,13 @@ hf_devd_event_cb (GIOChannel *source, GI
|
||||
|
||||
status = g_io_channel_read_line(source, &event, NULL, &terminator, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
--- hald/freebsd/hf-usb.c.orig 2008-05-08 01:24:02.000000000 +0200
|
||||
+++ hald/freebsd/hf-usb.c 2009-03-02 04:23:32.000000000 +0100
|
||||
@@ -25,13 +25,18 @@
|
||||
--- hald/freebsd/hf-usb.c.orig 2008-05-07 19:24:02.000000000 -0400
|
||||
+++ hald/freebsd/hf-usb.c 2009-05-30 03:20:24.000000000 -0400
|
||||
@@ -25,13 +25,20 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -11,17 +11,21 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
+#if __FreeBSD_version < 800092
|
||||
+#if __FreeBSD_version >= 800064
|
||||
+#include <legacy/dev/usb/usb.h>
|
||||
+#else
|
||||
#include <dev/usb/usb.h>
|
||||
+#endif
|
||||
+#endif
|
||||
|
||||
#include "../logger.h"
|
||||
#include "../osspec.h"
|
||||
@@ -41,6 +46,11 @@
|
||||
@@ -40,7 +47,13 @@
|
||||
#include "hf-devtree.h"
|
||||
#include "hf-util.h"
|
||||
|
||||
+#if __FreeBSD_version < 800092
|
||||
#define HF_USB_DEVICE "/dev/usb"
|
||||
+#if __FreeBSD_version < 800066
|
||||
+#define HF_USB2_DEVICE "/dev/usb "
|
||||
|
|
@ -31,32 +35,59 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
@@ -231,7 +241,7 @@
|
||||
* Adapted from usb_compute_udi() in linux2/physdev.c and
|
||||
* usbclass_compute_udi() in linux2/classdev.c.
|
||||
*/
|
||||
-static void
|
||||
+void
|
||||
hf_usb_device_compute_udi (HalDevice *device)
|
||||
{
|
||||
g_return_if_fail(HAL_IS_DEVICE(device));
|
||||
@@ -250,12 +260,13 @@
|
||||
hf_device_set_udi(device, "usb_device_%x_%x_%s",
|
||||
hal_device_property_get_int(device, "usb_device.vendor_id"),
|
||||
hal_device_property_get_int(device, "usb_device.product_id"),
|
||||
- hal_device_has_property(device, "usb_device.serial")
|
||||
+ (hal_device_has_property(device, "usb_device.serial") &&
|
||||
+ strcmp(hal_device_property_get_string(device, "usb_device.serial"), ""))
|
||||
? hal_device_property_get_string(device, "usb_device.serial")
|
||||
: "noserial");
|
||||
@@ -227,51 +240,6 @@ hf_usb_get_full_config_descriptor (int f
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Adapted from usb_compute_udi() in linux2/physdev.c and
|
||||
- * usbclass_compute_udi() in linux2/classdev.c.
|
||||
- */
|
||||
-static void
|
||||
+void
|
||||
hf_usb_add_webcam_properties (HalDevice *device)
|
||||
{
|
||||
int unit;
|
||||
@@ -424,7 +435,7 @@
|
||||
-hf_usb_device_compute_udi (HalDevice *device)
|
||||
-{
|
||||
- g_return_if_fail(HAL_IS_DEVICE(device));
|
||||
-
|
||||
- if (hal_device_has_capability(device, "hiddev"))
|
||||
- hf_device_set_full_udi(device, "%s_hiddev",
|
||||
- hal_device_property_get_string(device, "info.parent"));
|
||||
- else if (hal_device_has_capability(device, "video4linux"))
|
||||
- hf_device_set_full_udi(device, "%s_video4linux",
|
||||
- hal_device_property_get_string(device, "info.parent"));
|
||||
- else if (hal_device_has_property(device, "usb.interface.number"))
|
||||
- hf_device_set_full_udi(device, "%s_if%i",
|
||||
- hal_device_property_get_string(device, "info.parent"),
|
||||
- hal_device_property_get_int(device, "usb.interface.number"));
|
||||
- else
|
||||
- hf_device_set_udi(device, "usb_device_%x_%x_%s",
|
||||
- hal_device_property_get_int(device, "usb_device.vendor_id"),
|
||||
- hal_device_property_get_int(device, "usb_device.product_id"),
|
||||
- hal_device_has_property(device, "usb_device.serial")
|
||||
- ? hal_device_property_get_string(device, "usb_device.serial")
|
||||
- : "noserial");
|
||||
-}
|
||||
-
|
||||
-static void
|
||||
-hf_usb_add_webcam_properties (HalDevice *device)
|
||||
-{
|
||||
- int unit;
|
||||
-
|
||||
- g_return_if_fail(HAL_IS_DEVICE(device));
|
||||
-
|
||||
- unit = hal_device_property_get_int(device, "freebsd.unit");
|
||||
- if (unit < 0)
|
||||
- unit = 0;
|
||||
-
|
||||
- hal_device_property_set_string(device, "info.category", "video4linux");
|
||||
- hal_device_add_capability(device, "video4linux");
|
||||
- hf_device_property_set_string_printf(device, "video4linux.device", "/dev/video%i", unit);
|
||||
- hal_device_property_set_string(device, "info.product", "Video Device");
|
||||
-}
|
||||
-
|
||||
/* adapted from usbif_set_name() in linux2/physdev.c */
|
||||
static const char *
|
||||
hf_usb_get_interface_name (const usb_interface_descriptor_t *desc)
|
||||
@@ -424,7 +392,7 @@ hf_usb_device_new (HalDevice *parent,
|
||||
hf_devtree_device_set_name(device, di->udi_devnames[0]);
|
||||
|
||||
if ((devname = hf_usb_get_devname(di, "ukbd"))) /* USB keyboard */
|
||||
|
|
@ -65,7 +96,7 @@
|
|||
else if ((devname = hf_usb_get_devname(di, "ums"))) /* USB mouse */
|
||||
hf_device_set_input(device, "mouse", devname);
|
||||
else if ((devname = hf_usb_get_devname(di, "uhid"))) /* UHID device */
|
||||
@@ -575,6 +586,8 @@
|
||||
@@ -575,6 +543,8 @@ hf_usb_probe_device (HalDevice *parent,
|
||||
{
|
||||
if (hal_device_has_capability(device, "hiddev"))
|
||||
hf_runner_run_sync(device, 0, "hald-probe-hiddev", NULL);
|
||||
|
|
@ -74,7 +105,7 @@
|
|||
|
||||
hf_device_add(device);
|
||||
}
|
||||
@@ -633,9 +646,18 @@
|
||||
@@ -633,9 +603,18 @@ hf_usb_privileged_init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -94,3 +125,54 @@
|
|||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
@@ -885,3 +864,50 @@ HFDevdHandler hf_usb_devd_handler = {
|
||||
.add = hf_usb_devd_add,
|
||||
.remove = hf_usb_devd_remove
|
||||
};
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Adapted from usb_compute_udi() in linux2/physdev.c and
|
||||
+ * usbclass_compute_udi() in linux2/classdev.c.
|
||||
+ */
|
||||
+void
|
||||
+hf_usb_device_compute_udi (HalDevice *device)
|
||||
+{
|
||||
+ g_return_if_fail(HAL_IS_DEVICE(device));
|
||||
+
|
||||
+ if (hal_device_has_capability(device, "hiddev"))
|
||||
+ hf_device_set_full_udi(device, "%s_hiddev",
|
||||
+ hal_device_property_get_string(device, "info.parent"));
|
||||
+ else if (hal_device_has_capability(device, "video4linux"))
|
||||
+ hf_device_set_full_udi(device, "%s_video4linux",
|
||||
+ hal_device_property_get_string(device, "info.parent"));
|
||||
+ else if (hal_device_has_property(device, "usb.interface.number"))
|
||||
+ hf_device_set_full_udi(device, "%s_if%i",
|
||||
+ hal_device_property_get_string(device, "info.parent"),
|
||||
+ hal_device_property_get_int(device, "usb.interface.number"));
|
||||
+ else
|
||||
+ hf_device_set_udi(device, "usb_device_%x_%x_%s",
|
||||
+ hal_device_property_get_int(device, "usb_device.vendor_id"),
|
||||
+ hal_device_property_get_int(device, "usb_device.product_id"),
|
||||
+ (hal_device_has_property(device, "usb_device.serial") &&
|
||||
+ strcmp(hal_device_property_get_string(device, "usb_device.serial"), ""))
|
||||
+ ? hal_device_property_get_string(device, "usb_device.serial")
|
||||
+ : "noserial");
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+hf_usb_add_webcam_properties (HalDevice *device)
|
||||
+{
|
||||
+ int unit;
|
||||
+
|
||||
+ g_return_if_fail(HAL_IS_DEVICE(device));
|
||||
+
|
||||
+ unit = hal_device_property_get_int(device, "freebsd.unit");
|
||||
+ if (unit < 0)
|
||||
+ unit = 0;
|
||||
+
|
||||
+ hal_device_property_set_string(device, "info.category", "video4linux");
|
||||
+ hal_device_add_capability(device, "video4linux");
|
||||
+ hf_device_property_set_string_printf(device, "video4linux.device", "/dev/video%i", unit);
|
||||
+ hal_device_property_set_string(device, "info.product", "Video Device");
|
||||
+}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
--- hald/freebsd/osspec.c.orig 2008-05-07 19:24:01.000000000 -0400
|
||||
+++ hald/freebsd/osspec.c 2009-02-18 00:24:42.000000000 -0500
|
||||
@@ -46,6 +46,9 @@
|
||||
+++ hald/freebsd/osspec.c 2009-05-30 03:14:33.000000000 -0400
|
||||
@@ -25,6 +25,7 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
+#include <sys/param.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../ids.h"
|
||||
@@ -46,13 +47,21 @@
|
||||
#include "hf-sound.h"
|
||||
#include "hf-storage.h"
|
||||
#include "hf-usb.h"
|
||||
|
|
@ -10,10 +18,12 @@
|
|||
#include "hf-volume.h"
|
||||
|
||||
/* the order matters: PCI devices must be created before their children, etc */
|
||||
@@ -53,6 +56,9 @@ static HFHandler *handlers[] = {
|
||||
static HFHandler *handlers[] = {
|
||||
&hf_pci_handler,
|
||||
&hf_devtree_handler,
|
||||
+#if __FreeBSD_version < 800092
|
||||
&hf_usb_handler,
|
||||
+#endif
|
||||
+#ifdef HAVE_LIBUSB20
|
||||
+ &hf_usb2_handler,
|
||||
+#endif
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
--- hald/freebsd/probing/probe-usb2-device.c.orig 2009-05-23 15:56:54.000000000 -0400
|
||||
+++ hald/freebsd/probing/probe-usb2-device.c 2009-05-23 17:14:06.000000000 -0400
|
||||
@@ -0,0 +1,204 @@
|
||||
--- hald/freebsd/probing/probe-usb2-device.c.orig 2009-05-30 03:09:03.000000000 -0400
|
||||
+++ hald/freebsd/probing/probe-usb2-device.c 2009-05-30 03:10:48.000000000 -0400
|
||||
@@ -0,0 +1,208 @@
|
||||
+/***************************************************************************
|
||||
+ * CVSID: $Id$
|
||||
+ *
|
||||
|
|
@ -76,7 +76,11 @@
|
|||
+ {
|
||||
+ struct LIBUSB20_DEVICE_DESC_DECODED *ddesc;
|
||||
+ struct LIBUSB20_CONFIG_DESC_DECODED *cdesc;
|
||||
+#if __FreeBSD_version >= 800092
|
||||
+ struct usb_device_info di;
|
||||
+#else
|
||||
+ struct usb2_device_info di;
|
||||
+#endif
|
||||
+ struct libusb20_config *pcfg = NULL;
|
||||
+ int curr_config;
|
||||
+ int bcdspeed = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue