summaryrefslogtreecommitdiff
path: root/sys/dev/adb
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-06-15 21:32:06 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-06-15 21:32:06 +0000
commitdf2037ddb7442555cd756f9ec3b72fbeba976ec9 (patch)
tree271e985c30ad99f0a96beb3e24ed669399a9453b /sys/dev/adb
parent7e3d4ded2937b75cb2254141749ef129a9a373c0 (diff)
Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb node, and not confuse real adb device attachments. ok mpi@
Diffstat (limited to 'sys/dev/adb')
-rw-r--r--sys/dev/adb/adb.h11
-rw-r--r--sys/dev/adb/adb_subr.c4
-rw-r--r--sys/dev/adb/akbd.c5
-rw-r--r--sys/dev/adb/ams.c5
4 files changed, 18 insertions, 7 deletions
diff --git a/sys/dev/adb/adb.h b/sys/dev/adb/adb.h
index 209688337b6..8600643f93e 100644
--- a/sys/dev/adb/adb.h
+++ b/sys/dev/adb/adb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.h,v 1.3 2007/03/13 20:56:56 miod Exp $ */
+/* $OpenBSD: adb.h,v 1.4 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
/*-
@@ -43,11 +43,14 @@
* Arguments used to attach a device to the Apple Desktop Bus
*/
struct adb_attach_args {
- int origaddr;
- int adbaddr;
- int handler_id;
+ const char *name; /* adb_device_name if real adb device */
+ int origaddr;
+ int adbaddr;
+ int handler_id;
};
+extern const char adb_device_name[];
+
#define ADB_CMDADDR(cmd) ((u_int8_t)(cmd & 0xf0) >> 4)
#define ADBFLUSH(dev) ((((u_int8_t)dev & 0x0f) << 4) | 0x01)
#define ADBLISTEN(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x08 | reg)
diff --git a/sys/dev/adb/adb_subr.c b/sys/dev/adb/adb_subr.c
index c69bf3caab8..d558f9e3593 100644
--- a/sys/dev/adb/adb_subr.c
+++ b/sys/dev/adb/adb_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb_subr.c,v 1.2 2006/02/09 06:45:41 miod Exp $ */
+/* $OpenBSD: adb_subr.c,v 1.3 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/*-
@@ -41,6 +41,8 @@ struct cfdriver adb_cd = {
NULL, "adb", DV_DULL
};
+const char adb_device_name[] = "adb_device";
+
int
adbprint(void *args, const char *name)
{
diff --git a/sys/dev/adb/akbd.c b/sys/dev/adb/akbd.c
index 5f539b595de..d48aed97bf3 100644
--- a/sys/dev/adb/akbd.c
+++ b/sys/dev/adb/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.9 2011/06/13 16:29:11 shadchin Exp $ */
+/* $OpenBSD: akbd.c,v 1.10 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: akbd.c,v 1.17 2005/01/15 16:00:59 chs Exp $ */
/*
@@ -100,6 +100,9 @@ akbdmatch(struct device *parent, void *vcf, void *aux)
{
struct adb_attach_args *aa_args = (struct adb_attach_args *)aux;
+ if (strcmp(aa_args->name, adb_device_name) != 0)
+ return (0);
+
if (aa_args->origaddr == ADBADDR_KBD)
return (1);
else
diff --git a/sys/dev/adb/ams.c b/sys/dev/adb/ams.c
index 332772d7660..fa468f60539 100644
--- a/sys/dev/adb/ams.c
+++ b/sys/dev/adb/ams.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ams.c,v 1.5 2007/04/10 22:37:17 miod Exp $ */
+/* $OpenBSD: ams.c,v 1.6 2011/06/15 21:32:05 miod Exp $ */
/* $NetBSD: ams.c,v 1.11 2000/12/19 03:13:40 tsubai Exp $ */
/*
@@ -78,6 +78,9 @@ amsmatch(struct device *parent, void *cf, void *aux)
{
struct adb_attach_args *aa_args = aux;
+ if (strcmp(aa_args->name, adb_device_name) != 0)
+ return (0);
+
if (aa_args->origaddr == ADBADDR_MS)
return 1;
else