2 * Copyright (c) 1987-1993, The University of Utah and
3 * the Center for Software Science at the University of Utah (CSS).
6 * Permission to use, copy, modify and distribute this software is hereby
7 * granted provided that (1) source code retains these copyright, permission,
8 * and disclaimer notices, and (2) redistributions including binaries
9 * reproduce the notices in supporting documentation, and (3) all advertising
10 * materials mentioning features or use of this software display the following
11 * acknowledgement: ``This product includes software developed by the Center
12 * for Software Science at the University of Utah.''
14 * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
15 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
16 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 * CSS requests users of this software to return to css-dist@cs.utah.edu any
19 * improvements that they make and grant CSS redistribution rights.
21 * from: Utah $Hdr: hilinfo.c 1.3 94/04/04$
22 * $NetBSD: hilinfo.c,v 1.5 2002/05/30 18:01:03 thorpej Exp $
25 #include <sys/cdefs.h>
27 __RCSID("$NetBSD: hilinfo.c,v 1.5 2002/05/30 18:01:03 thorpej Exp $");
30 #include <sys/types.h>
31 #include <sys/ioctl.h>
32 #include <dev/hilioctl.h>
51 {0xA0, 0xFF, "keyboard"},
52 {0x60, 0x6B, "mouse"},
53 {0x90, 0x97, "tablet"},
54 {0x34, 0x34, "id-module"},
55 {0x30, 0x30, "button-box"},
56 {0x00, 0x00, "unknown"},
59 int getinfo
__P((void));
60 int main
__P((int, char **));
61 const char *tname
__P((void));
62 void printall
__P((void));
63 void usage
__P((void));
73 while ((c
= getopt(argc
, argv
, "at")) != -1)
91 multi
= (argc
- optind
) - 1;
92 while (optind
< argc
) {
95 printf("%s: ", dname
);
100 printf("%s\n", tname());
113 if (f
< 0 || ioctl(f
, HILIOCID
, &hi
) < 0) {
115 printf(errno
== EBUSY
? "busy\n" : "none\n");
123 (void) ioctl(f
, HILIOCSC
, &sc
);
133 printf("%s: %s, info: ", dname
, tname());
134 for (i
= 0; i
< 11; i
++)
135 printf("%2.2x", hi
.string
[i
]);
136 if (strcmp(tname(), "id-module") == 0) {
138 for (i
= 0; i
< 16; i
++)
139 printf("%2.2x", sc
.string
[i
]);
149 for (hp
= info
; hp
->hil_lo
; hp
++)
150 if (hi
.string
[0] >= hp
->hil_lo
&& hi
.string
[0] <= hp
->hil_hi
)
152 if (hi
.string
[0] == 0x61 && hi
.string
[1] == 0x13)
154 return(hp
->hil_name
);
161 fprintf(stderr
, "usage: %s [-at] device\n", getprogname());