summaryrefslogtreecommitdiffstats
path: root/sysutils/hal/files/patch-hald_freebsd_hf-devd.c
blob: 29ed38a7e4438eabd00867cc2b29cf6eb64419c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- hald/freebsd/hf-devd.c.orig 2008-05-07 19:23:59.000000000 -0400
+++ 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"
+#include "hf-storage.h"
 #include "hf-usb.h"
+#ifdef HAVE_LIBUSB20
+#include "hf-usb2.h"
+#endif
 #include "hf-util.h"
 
 #define HF_DEVD_SOCK_PATH      "/var/run/devd.pipe"
@@ -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
+  &hf_pcmcia_devd_handler,
+  &hf_storage_devd_handler
 };
 
 static gboolean hf_devd_inited = FALSE;
@@ -381,13 +392,13 @@ hf_devd_event_cb (GIOChannel *source, GI
 
   status = g_io_channel_read_line(source, &event, NULL, &terminator, NULL);
 
-  if (status != G_IO_STATUS_NORMAL)
+  if (status == G_IO_STATUS_NORMAL)
     {
       event[terminator] = 0;
       hf_devd_process_event(event);
       g_free(event);
     }
-  else if (status != G_IO_STATUS_AGAIN)
+  else if (status == G_IO_STATUS_AGAIN)
     {
       hf_devd_init();
       if (hf_devd_inited)