Check to see if "/dev/usb " exists, and if it does, don't try to

initialize USB support.  This will keep hald from taking up 100% CPU
on usb2 -CURRENT systems.
This commit is contained in:
Joe Marcus Clarke 2009-02-16 04:53:51 +00:00
parent 533f8bd3c9
commit 5f7c107d66
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=228483

View File

@ -1,6 +1,14 @@
--- hald/freebsd/hf-usb.c.orig 2009-01-25 16:34:49.000000000 -0500
+++ hald/freebsd/hf-usb.c 2009-01-25 16:36:42.000000000 -0500
@@ -575,6 +575,8 @@ hf_usb_probe_device (HalDevice *parent,
--- hald/freebsd/hf-usb.c.orig 2008-05-07 19:24:02.000000000 -0400
+++ hald/freebsd/hf-usb.c 2009-02-15 22:17:58.000000000 -0500
@@ -41,6 +41,7 @@
#include "hf-util.h"
#define HF_USB_DEVICE "/dev/usb"
+#define HF_USB2_DEVICE "/dev/usb "
typedef struct
{
@@ -575,6 +576,8 @@ hf_usb_probe_device (HalDevice *parent,
{
if (hal_device_has_capability(device, "hiddev"))
hf_runner_run_sync(device, 0, "hald-probe-hiddev", NULL);
@ -9,3 +17,23 @@
hf_device_add(device);
}
@@ -633,9 +636,18 @@ hf_usb_privileged_init (void)
{
int i;
+ if (g_file_test(HF_USB2_DEVICE, G_FILE_TEST_EXISTS))
+ {
+ hf_usb_fd = -1;
+ return;
+ }
+
hf_usb_fd = open(HF_USB_DEVICE, O_RDONLY);
if (hf_usb_fd < 0)
- HAL_INFO(("unable to open %s: %s", HF_USB_DEVICE, g_strerror(errno)));
+ {
+ HAL_INFO(("unable to open %s: %s", HF_USB_DEVICE, g_strerror(errno)));
+ return;
+ }
for (i = 0; i < 16; i++)
{