diff options
Diffstat (limited to 'sysutils/hal/files/patch-hald_freebsd_hf-usb.c')
-rw-r--r-- | sysutils/hal/files/patch-hald_freebsd_hf-usb.c | 140 |
1 files changed, 111 insertions, 29 deletions
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-usb.c b/sysutils/hal/files/patch-hald_freebsd_hf-usb.c index 07424b61ea45..a3289fbabfeb 100644 --- a/sysutils/hal/files/patch-hald_freebsd_hf-usb.c +++ b/sysutils/hal/files/patch-hald_freebsd_hf-usb.c @@ -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"); ++} |