1 /* $OpenBSD: adb_subr.c,v 1.4 2013/03/09 11:33:24 mpi 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 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/device.h>
32
33 #include <dev/adb/adb.h>
34
35 struct cfdriver adb_cd = {
36 NULL, "adb", DV_DULL
37 };
38
39 const char adb_device_name[] = "adb_device";
40
41 int
adbprint(void * args,const char * name)42 adbprint(void *args, const char *name)
43 {
44 struct adb_attach_args *aa_args = (struct adb_attach_args *)args;
45 int rv = UNCONF;
46
47 if (name) { /* no configured device matched */
48 rv = UNSUPP; /* most ADB device types are unsupported */
49
50 /* print out what kind of ADB device we have found */
51 switch(aa_args->origaddr) {
52 #ifdef ADBVERBOSE
53 case ADBADDR_SECURE:
54 printf("security dongle (%d)", aa_args->handler_id);
55 break;
56 #endif
57 case ADBADDR_MAP:
58 printf("mapped device (%d)", aa_args->handler_id);
59 rv = UNCONF;
60 break;
61 case ADBADDR_REL:
62 printf("relative positioning device (%d)",
63 aa_args->handler_id);
64 rv = UNCONF;
65 break;
66 #ifdef ADBVERBOSE
67 case ADBADDR_ABS:
68 switch (aa_args->handler_id) {
69 case ADB_ARTPAD:
70 printf("WACOM ArtPad II");
71 break;
72 default:
73 printf("absolute positioning device (%d)",
74 aa_args->handler_id);
75 break;
76 }
77 break;
78 case ADBADDR_DATATX:
79 printf("data transfer device (modem?) (%d)",
80 aa_args->handler_id);
81 break;
82 case ADBADDR_MISC:
83 switch (aa_args->handler_id) {
84 case ADB_POWERKEY:
85 printf("Sophisticated Circuits PowerKey");
86 break;
87 default:
88 printf("misc. device (remote control?) (%d)",
89 aa_args->handler_id);
90 break;
91 }
92 break;
93 #endif /* ADBVERBOSE */
94 default:
95 printf("unknown type %d device, (handler %d)",
96 aa_args->origaddr, aa_args->handler_id);
97 break;
98 }
99 printf(" at %s", name);
100 }
101
102 printf(" addr %d", aa_args->adbaddr);
103
104 return (rv);
105 }
106