1*20e60a76Smpi /* $OpenBSD: adb_subr.c,v 1.4 2013/03/09 11:33:24 mpi Exp $ */
2305d9e87Smiod /* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
3305d9e87Smiod
4305d9e87Smiod /*-
5305d9e87Smiod * Copyright (C) 1994 Bradley A. Grantham
6305d9e87Smiod * All rights reserved.
7305d9e87Smiod *
8305d9e87Smiod * Redistribution and use in source and binary forms, with or without
9305d9e87Smiod * modification, are permitted provided that the following conditions
10305d9e87Smiod * are met:
11305d9e87Smiod * 1. Redistributions of source code must retain the above copyright
12305d9e87Smiod * notice, this list of conditions and the following disclaimer.
13305d9e87Smiod * 2. Redistributions in binary form must reproduce the above copyright
14305d9e87Smiod * notice, this list of conditions and the following disclaimer in the
15305d9e87Smiod * documentation and/or other materials provided with the distribution.
16305d9e87Smiod *
17305d9e87Smiod * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18305d9e87Smiod * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19305d9e87Smiod * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20305d9e87Smiod * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21305d9e87Smiod * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22305d9e87Smiod * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23305d9e87Smiod * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24305d9e87Smiod * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25305d9e87Smiod * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26305d9e87Smiod * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27305d9e87Smiod */
28305d9e87Smiod
29305d9e87Smiod #include <sys/param.h>
30305d9e87Smiod #include <sys/systm.h>
31305d9e87Smiod #include <sys/device.h>
32305d9e87Smiod
33305d9e87Smiod #include <dev/adb/adb.h>
34305d9e87Smiod
35305d9e87Smiod struct cfdriver adb_cd = {
36305d9e87Smiod NULL, "adb", DV_DULL
37305d9e87Smiod };
38305d9e87Smiod
394425d974Smiod const char adb_device_name[] = "adb_device";
404425d974Smiod
41305d9e87Smiod int
adbprint(void * args,const char * name)42305d9e87Smiod adbprint(void *args, const char *name)
43305d9e87Smiod {
44305d9e87Smiod struct adb_attach_args *aa_args = (struct adb_attach_args *)args;
45305d9e87Smiod int rv = UNCONF;
46305d9e87Smiod
47305d9e87Smiod if (name) { /* no configured device matched */
48305d9e87Smiod rv = UNSUPP; /* most ADB device types are unsupported */
49305d9e87Smiod
50305d9e87Smiod /* print out what kind of ADB device we have found */
51305d9e87Smiod switch(aa_args->origaddr) {
52305d9e87Smiod #ifdef ADBVERBOSE
53305d9e87Smiod case ADBADDR_SECURE:
54305d9e87Smiod printf("security dongle (%d)", aa_args->handler_id);
55305d9e87Smiod break;
56305d9e87Smiod #endif
57305d9e87Smiod case ADBADDR_MAP:
58305d9e87Smiod printf("mapped device (%d)", aa_args->handler_id);
59305d9e87Smiod rv = UNCONF;
60305d9e87Smiod break;
61305d9e87Smiod case ADBADDR_REL:
62305d9e87Smiod printf("relative positioning device (%d)",
63305d9e87Smiod aa_args->handler_id);
64305d9e87Smiod rv = UNCONF;
65305d9e87Smiod break;
66305d9e87Smiod #ifdef ADBVERBOSE
67305d9e87Smiod case ADBADDR_ABS:
68305d9e87Smiod switch (aa_args->handler_id) {
69305d9e87Smiod case ADB_ARTPAD:
70305d9e87Smiod printf("WACOM ArtPad II");
71305d9e87Smiod break;
72305d9e87Smiod default:
73305d9e87Smiod printf("absolute positioning device (%d)",
74305d9e87Smiod aa_args->handler_id);
75305d9e87Smiod break;
76305d9e87Smiod }
77305d9e87Smiod break;
78305d9e87Smiod case ADBADDR_DATATX:
79305d9e87Smiod printf("data transfer device (modem?) (%d)",
80305d9e87Smiod aa_args->handler_id);
81305d9e87Smiod break;
82305d9e87Smiod case ADBADDR_MISC:
83305d9e87Smiod switch (aa_args->handler_id) {
84305d9e87Smiod case ADB_POWERKEY:
85305d9e87Smiod printf("Sophisticated Circuits PowerKey");
86305d9e87Smiod break;
87305d9e87Smiod default:
88305d9e87Smiod printf("misc. device (remote control?) (%d)",
89305d9e87Smiod aa_args->handler_id);
90305d9e87Smiod break;
91305d9e87Smiod }
92305d9e87Smiod break;
9337d15002Smiod #endif /* ADBVERBOSE */
94305d9e87Smiod default:
95305d9e87Smiod printf("unknown type %d device, (handler %d)",
96305d9e87Smiod aa_args->origaddr, aa_args->handler_id);
97305d9e87Smiod break;
98305d9e87Smiod }
99305d9e87Smiod printf(" at %s", name);
100305d9e87Smiod }
101305d9e87Smiod
102305d9e87Smiod printf(" addr %d", aa_args->adbaddr);
103305d9e87Smiod
104305d9e87Smiod return (rv);
105305d9e87Smiod }
106