-/* $OpenBSD: acpidock.c,v 1.40 2010/07/21 19:35:15 deraadt Exp $ */
+/* $OpenBSD: acpidock.c,v 1.41 2010/07/23 18:38:46 jordan Exp $ */
/*
* Copyright (c) 2006,2007 Michael Knudsen <mk@openbsd.org>
*
if (aml_evalnode(sc->sc_acpi, node, 0, NULL, &res) == -1)
printf(": error\n");
else {
- if (!memcmp(res.v_string, "_SB.", 4)) {
- dock = aml_searchname(&aml_root, "_SB_");
- dock = aml_searchname(dock, res.v_string+4);
- } else
- dock = aml_searchname(&aml_root, res.v_string);
+ dock = aml_searchname(&aml_root, res.v_string);
if (dock == sc->sc_devnode)
/* Add all children devices of Device containing _EJD */
-/* $OpenBSD: dsdt.c,v 1.172 2010/07/22 14:19:47 deraadt Exp $ */
+/* $OpenBSD: dsdt.c,v 1.173 2010/07/23 18:38:46 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
aml_searchname(struct aml_node *root, const void *vname)
{
char *name = (char *)vname;
+ char nseg[AML_NAMESEG_LEN + 1];
+ int i;
dnprintf(25,"Searchname: %s:%s = ", aml_nodename(root), vname);
if (*name == AMLOP_ROOTCHAR) {
name++;
}
while (*name != 0) {
- root = __aml_search(root, name, 0);
- name += (name[4] == '.') ? 5 : 4;
+ /* Ugh.. we can have short names here: append '_' */
+ strlcpy(nseg, "____", sizeof(nseg));
+ for (i=0; i < AML_NAMESEG_LEN && *name && *name != '.'; i++)
+ nseg[i] = *name++;
+ if (*name == '.')
+ name++;
+ root = __aml_search(root, nseg, 0);
}
dnprintf(25,"%p %s\n", root, aml_nodename(root));
return root;