xref: /openbsd/sys/dev/adb/adb_subr.c (revision 17df1aa7)
1 /*	$OpenBSD: adb_subr.c,v 1.2 2006/02/09 06:45:41 miod Exp $	*/
2 /*	$NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $	*/
3 
4 /*-
5  * Copyright (C) 1994	Bradley A. Grantham
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by Bradley A. Grantham.
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
37 
38 #include <dev/adb/adb.h>
39 
40 struct cfdriver adb_cd = {
41 	NULL, "adb", DV_DULL
42 };
43 
44 int
45 adbprint(void *args, const char *name)
46 {
47 	struct adb_attach_args *aa_args = (struct adb_attach_args *)args;
48 	int rv = UNCONF;
49 
50 	if (name) {	/* no configured device matched */
51 		rv = UNSUPP; /* most ADB device types are unsupported */
52 
53 		/* print out what kind of ADB device we have found */
54 		switch(aa_args->origaddr) {
55 #ifdef ADBVERBOSE
56 		case ADBADDR_SECURE:
57 			printf("security dongle (%d)", aa_args->handler_id);
58 			break;
59 #endif
60 		case ADBADDR_MAP:
61 			printf("mapped device (%d)", aa_args->handler_id);
62 			rv = UNCONF;
63 			break;
64 		case ADBADDR_REL:
65 			printf("relative positioning device (%d)",
66 			    aa_args->handler_id);
67 			rv = UNCONF;
68 			break;
69 #ifdef ADBVERBOSE
70 		case ADBADDR_ABS:
71 			switch (aa_args->handler_id) {
72 			case ADB_ARTPAD:
73 				printf("WACOM ArtPad II");
74 				break;
75 			default:
76 				printf("absolute positioning device (%d)",
77 				    aa_args->handler_id);
78 				break;
79 			}
80 			break;
81 		case ADBADDR_DATATX:
82 			printf("data transfer device (modem?) (%d)",
83 			    aa_args->handler_id);
84 			break;
85 		case ADBADDR_MISC:
86 			switch (aa_args->handler_id) {
87 			case ADB_POWERKEY:
88 				printf("Sophisticated Circuits PowerKey");
89 				break;
90 			default:
91 				printf("misc. device (remote control?) (%d)",
92 				    aa_args->handler_id);
93 				break;
94 			}
95 			break;
96 #endif /* ADBVERBOSE */
97 		default:
98 			printf("unknown type %d device, (handler %d)",
99 			    aa_args->origaddr, aa_args->handler_id);
100 			break;
101 		}
102 		printf(" at %s", name);
103 	}
104 
105 	printf(" addr %d", aa_args->adbaddr);
106 
107 	return (rv);
108 }
109