diff options
Diffstat (limited to 'sysutils/hal/files/patch-hald_freebsd_hf-usb2.c')
-rw-r--r-- | sysutils/hal/files/patch-hald_freebsd_hf-usb2.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c b/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c index 0da9bc2bc566..9f0f5726186c 100644 --- a/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c +++ b/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c @@ -1,6 +1,6 @@ ---- hald/freebsd/hf-usb2.c.orig 2009-03-02 20:16:10.000000000 -0600 -+++ hald/freebsd/hf-usb2.c 2009-03-02 20:33:13.000000000 -0600 -@@ -0,0 +1,287 @@ +--- hald/freebsd/hf-usb2.c.orig 2009-11-21 19:57:40.000000000 -0500 ++++ hald/freebsd/hf-usb2.c 2009-11-21 19:58:07.000000000 -0500 +@@ -0,0 +1,312 @@ +/*************************************************************************** + * CVSID: $Id$ + * @@ -102,7 +102,7 @@ + { + if (! strcmp(driver, "ukbd")) + hf_device_set_input(device, "keyboard", NULL); -+ else if (! strcmp(driver, "ums")) ++ else if (! strcmp(driver, "ums") || ! strcmp(driver, "atp")) + { + hf_device_set_input(device, "mouse", devname); + hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL); @@ -195,11 +195,12 @@ + addr = libusb20_dev_get_address(pdev); + + if (addr == 1) -+ parent = hf_devtree_find_parent_from_info(hald_get_gdl(), "usbus", bus); ++ parent = hf_devtree_find_from_info(hald_get_gdl(), "usbus", bus); + else + parent = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number", + HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number", -+ HAL_PROPERTY_TYPE_INT32, addr - 1, NULL); ++ HAL_PROPERTY_TYPE_INT32, addr - 1, "info.bus", ++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); + if (! parent || hal_device_property_get_bool(parent, "info.ignore")) + continue; + @@ -219,7 +220,13 @@ + HalDevice *parent_device; + int bus, addr, pbus, paddr; + -+ if (strncmp(name, "ugen", strlen("ugen"))) ++ if (! parent) ++ return FALSE; ++ ++ if (strncmp(name, "ugen", strlen("ugen")) && ++ ! strncmp(parent, "uhub", strlen("uhub"))) ++ return TRUE; ++ else if (strncmp(name, "ugen", strlen("ugen"))) + return FALSE; + else if (strncmp(parent, "ugen", strlen("ugen"))) + return TRUE; @@ -235,7 +242,8 @@ + + parent_device = hf_device_store_match(hald_get_gdl(), + "usb_device.bus_number", HAL_PROPERTY_TYPE_INT32, pbus, -+ "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, NULL); ++ "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, "info.bus", ++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); + + if (parent_device && ! hal_device_property_get_bool(parent_device, + "info.ignore")) @@ -258,8 +266,6 @@ + + if (strncmp(name, "ugen", strlen("ugen"))) + return FALSE; -+ else if (strncmp(parent, "ugen", strlen("ugen"))) -+ return TRUE; + + if (sscanf(name, "ugen%i.%i", &bus, &addr) != 2) + return FALSE; @@ -268,7 +274,8 @@ + + device = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number", + HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number", -+ HAL_PROPERTY_TYPE_INT32, addr, NULL); ++ HAL_PROPERTY_TYPE_INT32, addr, "info.bus", ++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); + + if (device) + { @@ -279,6 +286,23 @@ + return FALSE; +} + ++static gboolean ++hf_usb2_devd_notify (const char *system, ++ const char *subsystem, ++ const char *type, ++ const char *data) ++{ ++ if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || ++ (strcmp(type, "CREATE") && strcmp(type, "DESTROY"))) ++ return FALSE; ++ ++ if (! strncmp(data, "cdev=ugen", strlen("cdev=ugen")) || ++ ! strncmp(data, "cdev=usb", strlen("cdev=usb"))) ++ return TRUE; ++ ++ return FALSE; ++} ++ +HFHandler hf_usb2_handler = { + .privileged_init = hf_usb2_privileged_init, + .probe = hf_usb2_probe @@ -286,5 +310,6 @@ + +HFDevdHandler hf_usb2_devd_handler = { + .add = hf_usb2_devd_add, -+ .remove = hf_usb2_devd_remove ++ .remove = hf_usb2_devd_remove, ++ .notify = hf_usb2_devd_notify +}; |