Sat May 19 13:25:36 2018 UTC ()
On NetBSD/arm with FDT, the root device is "armfdt0" instead of "mainbus0".
Bump pkg revision.


(jmcneill)
diff -r1.79 -r1.80 pkgsrc/sysutils/hal/Makefile
diff -r1.5 -r1.6 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.c
diff -r1.1 -r1.2 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.h
diff -r1.1 -r1.2 pkgsrc/sysutils/hal/files/hald-netbsd/hotplug.c
diff -r1.6 -r1.7 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo_misc.c
diff -r1.4 -r1.5 pkgsrc/sysutils/hal/files/hald-netbsd/drvctl.c
diff -r1.3 -r1.4 pkgsrc/sysutils/hal/files/hald-netbsd/osspec.c

cvs diff -r1.79 -r1.80 pkgsrc/sysutils/hal/Makefile (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/Makefile 2017/10/10 13:51:21 1.79
+++ pkgsrc/sysutils/hal/Makefile 2018/05/19 13:25:36 1.80
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.79 2017/10/10 13:51:21 jperkin Exp $ 1# $NetBSD: Makefile,v 1.80 2018/05/19 13:25:36 jmcneill Exp $
2 2
3DISTNAME= hal-0.5.14 3DISTNAME= hal-0.5.14
4PKGREVISION= 18 4PKGREVISION= 19
5CATEGORIES= sysutils 5CATEGORIES= sysutils
6MASTER_SITES= http://hal.freedesktop.org/releases/ 6MASTER_SITES= http://hal.freedesktop.org/releases/
7EXTRACT_SUFX= .tar.bz2 7EXTRACT_SUFX= .tar.bz2
8 8
9MAINTAINER= pkgsrc-users@NetBSD.org 9MAINTAINER= pkgsrc-users@NetBSD.org
10HOMEPAGE= http://hal.freedesktop.org/ 10HOMEPAGE= http://hal.freedesktop.org/
11COMMENT= FreeDesktop hardware abstraction layer 11COMMENT= FreeDesktop hardware abstraction layer
12LICENSE= gnu-gpl-v2 12LICENSE= gnu-gpl-v2
13 13
14DEPENDS+= pciids-[0-9]*:../../misc/pciids 14DEPENDS+= pciids-[0-9]*:../../misc/pciids
15 15
16BUILD_DEFS+= VARBASE PKG_SYSCONFBASE 16BUILD_DEFS+= VARBASE PKG_SYSCONFBASE
17 17

cvs diff -r1.5 -r1.6 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.c 2008/12/11 15:05:01 1.5
+++ pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.c 2018/05/19 13:25:36 1.6
@@ -38,26 +38,41 @@ @@ -38,26 +38,41 @@
38#include "devinfo_cpu.h" 38#include "devinfo_cpu.h"
39#include "devinfo_optical.h" 39#include "devinfo_optical.h"
40/* #include "devinfo_scsipi.h" */ 40/* #include "devinfo_scsipi.h" */
41#include "drvctl.h" 41#include "drvctl.h"
42 42
43void devinfo_add_subtree(HalDevice *parent, const char *devnode, gboolean is_root); 43void devinfo_add_subtree(HalDevice *parent, const char *devnode, gboolean is_root);
44 44
45void 45void
46devinfo_add(HalDevice *parent, gchar *name) 46devinfo_add(HalDevice *parent, gchar *name)
47{ 47{
48 devinfo_add_subtree (parent, name, TRUE); 48 devinfo_add_subtree (parent, name, TRUE);
49} 49}
50 50
 51gboolean
 52devinfo_probe(HalDevice *parent, gchar *name)
 53{
 54 struct devlistargs laa;
 55
 56 if (drvctl_list (name, &laa) == -1) {
 57 HAL_INFO (("devinfo_probe: no %s device found", name));
 58 return FALSE;
 59 }
 60
 61 free (laa.l_childname);
 62
 63 return TRUE;
 64}
 65
51void 66void
52devinfo_add_subtree(HalDevice *parent, const char *devnode, gboolean is_root) 67devinfo_add_subtree(HalDevice *parent, const char *devnode, gboolean is_root)
53{ 68{
54 HalDevice *d; 69 HalDevice *d;
55 struct devlistargs laa; 70 struct devlistargs laa;
56 int i; 71 int i;
57 72
58 HAL_INFO (("add_subtree: %s", devnode)); 73 HAL_INFO (("add_subtree: %s", devnode));
59 74
60 if (parent == NULL) { 75 if (parent == NULL) {
61 parent = devinfo_add_node (NULL, devnode); 76 parent = devinfo_add_node (NULL, devnode);
62 } 77 }
63 78
@@ -77,38 +92,38 @@ devinfo_add_subtree(HalDevice *parent, c @@ -77,38 +92,38 @@ devinfo_add_subtree(HalDevice *parent, c
77} 92}
78 93
79void 94void
80devinfo_set_default_properties (HalDevice *d, HalDevice *parent, const char *devnode, char *devfs_path) 95devinfo_set_default_properties (HalDevice *d, HalDevice *parent, const char *devnode, char *devfs_path)
81{ 96{
82 char *driver_name, *s; 97 char *driver_name, *s;
83 const char *s1; 98 const char *s1;
84 char udi[HAL_PATH_MAX]; 99 char udi[HAL_PATH_MAX];
85 100
86 if (parent != NULL) { 101 if (parent != NULL) {
87 char *pdevice = hal_device_property_get_string (parent, "netbsd.device"); 102 char *pdevice = hal_device_property_get_string (parent, "netbsd.device");
88 if (pdevice) { 103 if (pdevice) {
89 gchar *path; 104 gchar *path;
90 if (strcmp (pdevice, "mainbus0") == 0) 105 if (strcmp (pdevice, "mainbus0") == 0 || strcmp (pdevice, "armfdt0") == 0)
91 pdevice = "computer"; 106 pdevice = "computer";
92 path = g_strdup_printf ("/org/freedesktop/Hal/devices/%s", pdevice); 107 path = g_strdup_printf ("/org/freedesktop/Hal/devices/%s", pdevice);
93 hal_device_property_set_string (d, "info.parent", path); 108 hal_device_property_set_string (d, "info.parent", path);
94 g_free (path); 109 g_free (path);
95 } 110 }
96 } else { 111 } else {
97 gchar pdevnode[512]; 112 gchar pdevnode[512];
98 char *pdevice = pdevnode; 113 char *pdevice = pdevnode;
99 if (drvctl_find_parent (devnode, pdevnode) == TRUE) { 114 if (drvctl_find_parent (devnode, pdevnode) == TRUE) {
100 gchar *path; 115 gchar *path;
101 if (strcmp (pdevnode, "mainbus0") == 0) 116 if (strcmp (pdevnode, "mainbus0") == 0 || strcmp (pdevnode, "armfdt0") == 0)
102 pdevice = "computer"; 117 pdevice = "computer";
103 path = g_strdup_printf ("/org/freedesktop/Hal/devices/%s", pdevice); 118 path = g_strdup_printf ("/org/freedesktop/Hal/devices/%s", pdevice);
104 hal_device_property_set_string (d, "info.parent", path); 119 hal_device_property_set_string (d, "info.parent", path);
105 g_free (path); 120 g_free (path);
106 } else 121 } else
107 hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/local"); 122 hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/local");
108 } 123 }
109 124
110 hald_compute_udi (udi, sizeof (udi), 125 hald_compute_udi (udi, sizeof (udi),
111 "/org/freedesktop/Hal/devices/%s", devnode); 126 "/org/freedesktop/Hal/devices/%s", devnode);
112 hal_device_set_udi (d, udi); 127 hal_device_set_udi (d, udi);
113 128
114#if notyet 129#if notyet

cvs diff -r1.1 -r1.2 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.h (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.h 2008/11/25 23:10:23 1.1
+++ pkgsrc/sysutils/hal/files/hald-netbsd/devinfo.h 2018/05/19 13:25:36 1.2
@@ -42,26 +42,27 @@ typedef struct DevinfoDevHandler_s @@ -42,26 +42,27 @@ typedef struct DevinfoDevHandler_s
42 42
43#define PROP_STR(d, node, v, diprop, halprop) \ 43#define PROP_STR(d, node, v, diprop, halprop) \
44 if (di_prop_lookup_strings(DDI_DEV_T_ANY, node, diprop, &(v)) > 0) { \ 44 if (di_prop_lookup_strings(DDI_DEV_T_ANY, node, diprop, &(v)) > 0) { \
45 hal_device_property_set_string (d, halprop, v); \ 45 hal_device_property_set_string (d, halprop, v); \
46 } 46 }
47 47
48#define PROP_BOOL(d, node, v, diprop, halprop) \ 48#define PROP_BOOL(d, node, v, diprop, halprop) \
49 hal_device_property_set_bool (d, halprop, \ 49 hal_device_property_set_bool (d, halprop, \
50 (di_prop_lookup_ints(DDI_DEV_T_ANY, node, diprop, &(v)) >= 0)); 50 (di_prop_lookup_ints(DDI_DEV_T_ANY, node, diprop, &(v)) >= 0));
51 51
52#define NELEM(a) (sizeof (a) / sizeof (*(a))) 52#define NELEM(a) (sizeof (a) / sizeof (*(a)))
53 53
54void devinfo_add (HalDevice *parent, gchar *path); 54void devinfo_add (HalDevice *parent, gchar *path);
 55gboolean devinfo_probe (HalDevice *parent, gchar *path);
55HalDevice *devinfo_add_node(HalDevice *parent, const char *devnode); 56HalDevice *devinfo_add_node(HalDevice *parent, const char *devnode);
56void devinfo_set_default_properties (HalDevice *d, HalDevice *parent, const char *devnode, char *devfs_path); 57void devinfo_set_default_properties (HalDevice *d, HalDevice *parent, const char *devnode, char *devfs_path);
57void devinfo_callouts_preprobing_done (HalDevice *d, gpointer userdata1, gpointer userdata2); 58void devinfo_callouts_preprobing_done (HalDevice *d, gpointer userdata1, gpointer userdata2);
58void devinfo_callouts_probing_done (HalDevice *d, guint32 exit_type, gint return_code, char **error, 59void devinfo_callouts_probing_done (HalDevice *d, guint32 exit_type, gint return_code, char **error,
59 gpointer userdata1, gpointer userdata2); 60 gpointer userdata1, gpointer userdata2);
60void devinfo_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2); 61void devinfo_callouts_add_done (HalDevice *d, gpointer userdata1, gpointer userdata2);
61void devinfo_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2); 62void devinfo_callouts_remove_done (HalDevice *d, gpointer userdata1, gpointer userdata2);
62void hotplug_event_begin_add_devinfo (HalDevice *d, HalDevice *parent, DevinfoDevHandler *handler, void *end_token); 63void hotplug_event_begin_add_devinfo (HalDevice *d, HalDevice *parent, DevinfoDevHandler *handler, void *end_token);
63void devinfo_remove (gchar *path); 64void devinfo_remove (gchar *path);
64void devinfo_remove_branch (gchar *path, HalDevice *d); 65void devinfo_remove_branch (gchar *path, HalDevice *d);
65void hotplug_event_begin_remove_devinfo (HalDevice *d, gchar *devfs_path, void *end_token); 66void hotplug_event_begin_remove_devinfo (HalDevice *d, gchar *devfs_path, void *end_token);
66void devinfo_hotplug_enqueue(HalDevice *d, gchar *devfs_path, DevinfoDevHandler *handler, int action, int front); 67void devinfo_hotplug_enqueue(HalDevice *d, gchar *devfs_path, DevinfoDevHandler *handler, int action, int front);
67void devinfo_add_enqueue(HalDevice *d, gchar *devfs_path, DevinfoDevHandler *handler); 68void devinfo_add_enqueue(HalDevice *d, gchar *devfs_path, DevinfoDevHandler *handler);

cvs diff -r1.1 -r1.2 pkgsrc/sysutils/hal/files/hald-netbsd/hotplug.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/hotplug.c 2008/11/25 23:10:23 1.1
+++ pkgsrc/sysutils/hal/files/hald-netbsd/hotplug.c 2018/05/19 13:25:36 1.2
@@ -79,27 +79,27 @@ hotplug_event_begin_devfs_add (HotplugEv @@ -79,27 +79,27 @@ hotplug_event_begin_devfs_add (HotplugEv
79 if (parent == NULL) 79 if (parent == NULL)
80 HAL_INFO (("no info.udi=%s parameter found", parent_udi)); 80 HAL_INFO (("no info.udi=%s parameter found", parent_udi));
81 } 81 }
82 82
83 if (parent == NULL) { 83 if (parent == NULL) {
84 gchar pdevnode[512]; 84 gchar pdevnode[512];
85 HAL_INFO (("couldn't look up %s parent by udi, trying netbsd.device", hotplug_event->un.devfs.devfs_path)); 85 HAL_INFO (("couldn't look up %s parent by udi, trying netbsd.device", hotplug_event->un.devfs.devfs_path));
86 if (drvctl_find_parent (hotplug_event->un.devfs.devfs_path, pdevnode) == TRUE) 86 if (drvctl_find_parent (hotplug_event->un.devfs.devfs_path, pdevnode) == TRUE)
87 parent = hal_device_store_match_key_value_string (hald_get_gdl (), "netbsd.device", pdevnode); 87 parent = hal_device_store_match_key_value_string (hald_get_gdl (), "netbsd.device", pdevnode);
88 } 88 }
89 89
90 /* only root node is allowed to be orphan */ 90 /* only root node is allowed to be orphan */
91 if (parent == NULL) { 91 if (parent == NULL) {
92 if (strcmp(hotplug_event->un.devfs.devfs_path, "mainbus0") != 0) { 92 if (strcmp(hotplug_event->un.devfs.devfs_path, "mainbus0") != 0 && strcmp(hotplug_event->un.devfs.devfs_path, "armfdt0") != 0) {
93 HAL_ERROR (("Parent is NULL devfs_path=%s parent_udi=%s", hotplug_event->un.devfs.devfs_path, parent_udi ? parent_udi : "<null>")); 93 HAL_ERROR (("Parent is NULL devfs_path=%s parent_udi=%s", hotplug_event->un.devfs.devfs_path, parent_udi ? parent_udi : "<null>"));
94 hotplug_event_end ((void *) hotplug_event); 94 hotplug_event_end ((void *) hotplug_event);
95 return; 95 return;
96 } 96 }
97 } 97 }
98 98
99 /* children of ignored parent should be ignored */ 99 /* children of ignored parent should be ignored */
100 if (hal_device_property_get_bool (parent, "info.ignore")) { 100 if (hal_device_property_get_bool (parent, "info.ignore")) {
101 HAL_INFO (("parent ignored %s", parent_udi)); 101 HAL_INFO (("parent ignored %s", parent_udi));
102 hotplug_event_end ((void *) hotplug_event); 102 hotplug_event_end ((void *) hotplug_event);
103 return; 103 return;
104 } 104 }
105 105

cvs diff -r1.6 -r1.7 pkgsrc/sysutils/hal/files/hald-netbsd/devinfo_misc.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/devinfo_misc.c 2015/01/25 18:46:09 1.6
+++ pkgsrc/sysutils/hal/files/hald-netbsd/devinfo_misc.c 2018/05/19 13:25:36 1.7
@@ -56,27 +56,27 @@ DevinfoDevHandler devinfo_default_handle @@ -56,27 +56,27 @@ DevinfoDevHandler devinfo_default_handle
56 NULL, 56 NULL,
57 NULL, 57 NULL,
58 NULL 58 NULL
59}; 59};
60 60
61static HalDevice * 61static HalDevice *
62devinfo_computer_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type) 62devinfo_computer_add(HalDevice *parent, const char *devnode, char *devfs_path, char *device_type)
63{ 63{
64 HalDevice *d; 64 HalDevice *d;
65 struct utsname un; 65 struct utsname un;
66 char acpi_supported_states[20]; 66 char acpi_supported_states[20];
67 size_t len = sizeof(acpi_supported_states); 67 size_t len = sizeof(acpi_supported_states);
68 68
69 if (strcmp (devnode, "mainbus0") != 0) { 69 if (strcmp (devnode, "mainbus0") != 0 && strcmp (devnode, "armfdt0") != 0) {
70 return (NULL); 70 return (NULL);
71 } 71 }
72 72
73 HAL_INFO (("devinfo_computer_add parent=%p devnode=%s devfs_path=%s device_type=%s", 73 HAL_INFO (("devinfo_computer_add parent=%p devnode=%s devfs_path=%s device_type=%s",
74 parent, devnode, devfs_path, device_type)); 74 parent, devnode, devfs_path, device_type));
75 75
76 d = hal_device_new (); 76 d = hal_device_new ();
77 77
78 hal_device_property_set_string (d, "info.subsystem", "unknown"); 78 hal_device_property_set_string (d, "info.subsystem", "unknown");
79 hal_device_property_set_string (d, "info.product", "Computer"); 79 hal_device_property_set_string (d, "info.product", "Computer");
80 hal_device_set_udi (d, "/org/freedesktop/Hal/devices/computer"); 80 hal_device_set_udi (d, "/org/freedesktop/Hal/devices/computer");
81 hal_device_property_set_string (d, "netbsd.device", devnode); 81 hal_device_property_set_string (d, "netbsd.device", devnode);
82 82

cvs diff -r1.4 -r1.5 pkgsrc/sysutils/hal/files/hald-netbsd/drvctl.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/drvctl.c 2015/01/25 18:46:09 1.4
+++ pkgsrc/sysutils/hal/files/hald-netbsd/drvctl.c 2018/05/19 13:25:36 1.5
@@ -169,26 +169,27 @@ drvctl_list(const gchar *name, struct de @@ -169,26 +169,27 @@ drvctl_list(const gchar *name, struct de
169 if (children == 0) 169 if (children == 0)
170 return -1; 170 return -1;
171 laa->l_childname = malloc (children * sizeof (laa->l_childname[0])); 171 laa->l_childname = malloc (children * sizeof (laa->l_childname[0]));
172 if (laa->l_childname == NULL) { 172 if (laa->l_childname == NULL) {
173 HAL_INFO (("drvctl_list couldn't allocate %d children: %s\n", children, strerror(errno))); 173 HAL_INFO (("drvctl_list couldn't allocate %d children: %s\n", children, strerror(errno)));
174 return -1; 174 return -1;
175 } 175 }
176 if (ioctl (drvctl_fd, DRVLISTDEV, laa) == -1) { 176 if (ioctl (drvctl_fd, DRVLISTDEV, laa) == -1) {
177 HAL_INFO (("DRVLISTDEV/2 failed: %s", strerror(errno))); 177 HAL_INFO (("DRVLISTDEV/2 failed: %s", strerror(errno)));
178 return -1; 178 return -1;
179 } 179 }
180 if (children != laa->l_children) 180 if (children != laa->l_children)
181 HAL_WARNING (("DRVLISTDEV/3 expected %d children, got %d", children, laa->l_childname)); 181 HAL_WARNING (("DRVLISTDEV/3 expected %d children, got %d", children, laa->l_childname));
 182 return 0;
182} 183}
183 184
184gboolean 185gboolean
185drvctl_find_device(const gchar *devnode, prop_dictionary_t *properties) 186drvctl_find_device(const gchar *devnode, prop_dictionary_t *properties)
186{ 187{
187 prop_dictionary_t command_dict; 188 prop_dictionary_t command_dict;
188 prop_dictionary_t args_dict; 189 prop_dictionary_t args_dict;
189 prop_dictionary_t results_dict; 190 prop_dictionary_t results_dict;
190 int err; 191 int err;
191  192
192 command_dict = prop_dictionary_create (); 193 command_dict = prop_dictionary_create ();
193 args_dict = prop_dictionary_create (); 194 args_dict = prop_dictionary_create ();
194  195
@@ -242,27 +243,34 @@ drvctl_find_device_with_child(const gcha @@ -242,27 +243,34 @@ drvctl_find_device_with_child(const gcha
242 } 243 }
243 } 244 }
244 245
245 if (laa.l_childname) 246 if (laa.l_childname)
246 free(laa.l_childname); 247 free(laa.l_childname);
247 248
248 HAL_INFO (("%s: couldn't find device with child %s", curnode, devnode)); 249 HAL_INFO (("%s: couldn't find device with child %s", curnode, devnode));
249 return FALSE; 250 return FALSE;
250} 251}
251 252
252gboolean 253gboolean
253drvctl_find_parent(const gchar *devnode, char *parent) 254drvctl_find_parent(const gchar *devnode, char *parent)
254{ 255{
255 return drvctl_find_device_with_child("mainbus0", devnode, parent); 256 gboolean ret;
 257
 258 ret = drvctl_find_device_with_child("mainbus0", devnode, parent);
 259 if (ret == FALSE) {
 260 ret = drvctl_find_device_with_child("armfdt0", devnode, parent);
 261 }
 262
 263 return ret;
256} 264}
257 265
258#if 0 266#if 0
259static void 267static void
260drvctl_lofi_add(gchar *devfs_path, gchar *name) 268drvctl_lofi_add(gchar *devfs_path, gchar *name)
261{ 269{
262 di_node_t node; 270 di_node_t node;
263 const char *parent_udi; 271 const char *parent_udi;
264 HalDevice *d, *parent; 272 HalDevice *d, *parent;
265 273
266 HAL_INFO (("lofi_add: %s %s", name, devfs_path)); 274 HAL_INFO (("lofi_add: %s %s", name, devfs_path));
267 275
268 if ((d = hal_device_store_match_key_value_string (hald_get_gdl (), 276 if ((d = hal_device_store_match_key_value_string (hald_get_gdl (),

cvs diff -r1.3 -r1.4 pkgsrc/sysutils/hal/files/hald-netbsd/osspec.c (expand / switch to unified diff)

--- pkgsrc/sysutils/hal/files/hald-netbsd/osspec.c 2008/12/01 02:02:33 1.3
+++ pkgsrc/sysutils/hal/files/hald-netbsd/osspec.c 2018/05/19 13:25:36 1.4
@@ -62,27 +62,32 @@ osspec_privileged_init (void) @@ -62,27 +62,32 @@ osspec_privileged_init (void)
62 62
63void 63void
64hotplug_queue_now_empty (void) 64hotplug_queue_now_empty (void)
65{ 65{
66 if (hald_is_initialising) { 66 if (hald_is_initialising) {
67 osspec_probe_done (); 67 osspec_probe_done ();
68 } 68 }
69} 69}
70 70
71void  71void
72osspec_probe (void) 72osspec_probe (void)
73{ 73{
74 /* add entire device tree */ 74 /* add entire device tree */
75 devinfo_add (NULL, "mainbus0"); 75 if (devinfo_probe (NULL, "mainbus0") == TRUE) {
 76 devinfo_add (NULL, "mainbus0");
 77 }
 78 if (devinfo_probe (NULL, "armfdt0") == TRUE) {
 79 devinfo_add (NULL, "armfdt0");
 80 }
76 81
77 /* start processing events */ 82 /* start processing events */
78 hotplug_event_process_queue (); 83 hotplug_event_process_queue ();
79} 84}
80 85
81gboolean 86gboolean
82osspec_device_rescan (HalDevice *d) 87osspec_device_rescan (HalDevice *d)
83{ 88{
84 return (devinfo_device_rescan (d)); 89 return (devinfo_device_rescan (d));
85} 90}
86 91
87gboolean 92gboolean
88osspec_device_reprobe (HalDevice *d) 93osspec_device_reprobe (HalDevice *d)