Sat Mar 15 18:59:07 2008 UTC ()
Use proper types.


(cube)
diff -r1.22 -r1.23 src/sys/dev/pckbport/pckbd.c
diff -r1.12 -r1.13 src/sys/dev/pckbport/pckbport.c
diff -r1.7 -r1.8 src/sys/dev/pckbport/pckbportvar.h
diff -r1.25 -r1.26 src/sys/dev/pckbport/pms.c
diff -r1.6 -r1.7 src/sys/dev/pckbport/pmsvar.h

cvs diff -r1.22 -r1.23 src/sys/dev/pckbport/pckbd.c (expand / switch to unified diff)

--- src/sys/dev/pckbport/pckbd.c 2008/03/15 18:46:22 1.22
+++ src/sys/dev/pckbport/pckbd.c 2008/03/15 18:59:07 1.23
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pckbd.c,v 1.22 2008/03/15 18:46:22 cube Exp $ */ 1/* $NetBSD: pckbd.c,v 1.23 2008/03/15 18:59:07 cube Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum. 8 * by Charles M. Hannum.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -65,27 +65,27 @@ @@ -65,27 +65,27 @@
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE. 68 * SUCH DAMAGE.
69 * 69 *
70 * @(#)pccons.c 5.11 (Berkeley) 5/21/91 70 * @(#)pccons.c 5.11 (Berkeley) 5/21/91
71 */ 71 */
72 72
73/* 73/*
74 * code to work keyboard for PC-style console 74 * code to work keyboard for PC-style console
75 */ 75 */
76 76
77#include <sys/cdefs.h> 77#include <sys/cdefs.h>
78__KERNEL_RCSID(0, "$NetBSD: pckbd.c,v 1.22 2008/03/15 18:46:22 cube Exp $"); 78__KERNEL_RCSID(0, "$NetBSD: pckbd.c,v 1.23 2008/03/15 18:59:07 cube Exp $");
79 79
80#include <sys/param.h> 80#include <sys/param.h>
81#include <sys/systm.h> 81#include <sys/systm.h>
82#include <sys/device.h> 82#include <sys/device.h>
83#include <sys/malloc.h> 83#include <sys/malloc.h>
84#include <sys/ioctl.h> 84#include <sys/ioctl.h>
85 85
86#include <sys/bus.h> 86#include <sys/bus.h>
87 87
88#include <dev/pckbport/pckbportvar.h> 88#include <dev/pckbport/pckbportvar.h>
89 89
90#include <dev/wscons/wsconsio.h> 90#include <dev/wscons/wsconsio.h>
91#include <dev/wscons/wskbdvar.h> 91#include <dev/wscons/wskbdvar.h>
@@ -112,36 +112,36 @@ struct pckbd_internal { @@ -112,36 +112,36 @@ struct pckbd_internal {
112 int t_extended1; 112 int t_extended1;
113 113
114 struct pckbd_softc *t_sc; /* back pointer */ 114 struct pckbd_softc *t_sc; /* back pointer */
115}; 115};
116 116
117struct pckbd_softc { 117struct pckbd_softc {
118 device_t sc_dev; 118 device_t sc_dev;
119 119
120 struct pckbd_internal *id; 120 struct pckbd_internal *id;
121 int sc_enabled; 121 int sc_enabled;
122 122
123 int sc_ledstate; 123 int sc_ledstate;
124 124
125 struct device *sc_wskbddev; 125 device_t sc_wskbddev;
126#ifdef WSDISPLAY_COMPAT_RAWKBD 126#ifdef WSDISPLAY_COMPAT_RAWKBD
127 int rawkbd; 127 int rawkbd;
128#endif 128#endif
129}; 129};
130 130
131static int pckbd_is_console(pckbport_tag_t, pckbport_slot_t); 131static int pckbd_is_console(pckbport_tag_t, pckbport_slot_t);
132 132
133int pckbdprobe(struct device *, struct cfdata *, void *); 133int pckbdprobe(device_t, cfdata_t, void *);
134void pckbdattach(struct device *, struct device *, void *); 134void pckbdattach(device_t, device_t, void *);
135 135
136CFATTACH_DECL_NEW(pckbd, sizeof(struct pckbd_softc), 136CFATTACH_DECL_NEW(pckbd, sizeof(struct pckbd_softc),
137 pckbdprobe, pckbdattach, NULL, NULL); 137 pckbdprobe, pckbdattach, NULL, NULL);
138 138
139int pckbd_enable(void *, int); 139int pckbd_enable(void *, int);
140void pckbd_set_leds(void *, int); 140void pckbd_set_leds(void *, int);
141int pckbd_ioctl(void *, u_long, void *, int, struct lwp *); 141int pckbd_ioctl(void *, u_long, void *, int, struct lwp *);
142 142
143const struct wskbd_accessops pckbd_accessops = { 143const struct wskbd_accessops pckbd_accessops = {
144 pckbd_enable, 144 pckbd_enable,
145 pckbd_set_leds, 145 pckbd_set_leds,
146 pckbd_ioctl, 146 pckbd_ioctl,
147}; 147};
@@ -291,27 +291,27 @@ pckbd_resume(device_t dv PMF_FN_ARGS) @@ -291,27 +291,27 @@ pckbd_resume(device_t dv PMF_FN_ARGS)
291 resp[0]); 291 resp[0]);
292 292
293 pckbport_flush(sc->id->t_kbctag, sc->id->t_kbcslot); 293 pckbport_flush(sc->id->t_kbctag, sc->id->t_kbcslot);
294 294
295 pckbd_enable(sc, 1); 295 pckbd_enable(sc, 1);
296 296
297 return true; 297 return true;
298} 298}
299 299
300/* 300/*
301 * these are both bad jokes 301 * these are both bad jokes
302 */ 302 */
303int 303int
304pckbdprobe(struct device *parent, struct cfdata *cf, void *aux) 304pckbdprobe(device_t parent, cfdata_t cf, void *aux)
305{ 305{
306 struct pckbport_attach_args *pa = aux; 306 struct pckbport_attach_args *pa = aux;
307 int res; 307 int res;
308 u_char cmd[1], resp[1]; 308 u_char cmd[1], resp[1];
309 309
310 /* 310 /*
311 * XXX There are rumours that a keyboard can be connected 311 * XXX There are rumours that a keyboard can be connected
312 * to the aux port as well. For me, this didn't work. 312 * to the aux port as well. For me, this didn't work.
313 * For further experiments, allow it if explicitly 313 * For further experiments, allow it if explicitly
314 * wired in the config file. 314 * wired in the config file.
315 */ 315 */
316 if ((pa->pa_slot != PCKBPORT_KBD_SLOT) && 316 if ((pa->pa_slot != PCKBPORT_KBD_SLOT) &&
317 (cf->cf_loc[PCKBPORTCF_SLOT] == PCKBPORTCF_SLOT_DEFAULT)) 317 (cf->cf_loc[PCKBPORTCF_SLOT] == PCKBPORTCF_SLOT_DEFAULT))
@@ -343,27 +343,27 @@ pckbdprobe(struct device *parent, struct @@ -343,27 +343,27 @@ pckbdprobe(struct device *parent, struct
343 * Some keyboards seem to leave a second ack byte after the reset. 343 * Some keyboards seem to leave a second ack byte after the reset.
344 * This is kind of stupid, but we account for them anyway by just 344 * This is kind of stupid, but we account for them anyway by just
345 * flushing the buffer. 345 * flushing the buffer.
346 */ 346 */
347 pckbport_flush(pa->pa_tag, pa->pa_slot); 347 pckbport_flush(pa->pa_tag, pa->pa_slot);
348 348
349 if (pckbd_set_xtscancode(pa->pa_tag, pa->pa_slot)) 349 if (pckbd_set_xtscancode(pa->pa_tag, pa->pa_slot))
350 return 0; 350 return 0;
351 351
352 return 2; 352 return 2;
353} 353}
354 354
355void 355void
356pckbdattach(struct device *parent, struct device *self, void *aux) 356pckbdattach(device_t parent, device_t self, void *aux)
357{ 357{
358 struct pckbd_softc *sc = device_private(self); 358 struct pckbd_softc *sc = device_private(self);
359 struct pckbport_attach_args *pa = aux; 359 struct pckbport_attach_args *pa = aux;
360 struct wskbddev_attach_args a; 360 struct wskbddev_attach_args a;
361 int isconsole; 361 int isconsole;
362 u_char cmd[1]; 362 u_char cmd[1];
363 363
364 aprint_naive("\n"); 364 aprint_naive("\n");
365 aprint_normal("\n"); 365 aprint_normal("\n");
366 366
367 sc->sc_dev = self; 367 sc->sc_dev = self;
368 isconsole = pckbd_is_console(pa->pa_tag, pa->pa_slot); 368 isconsole = pckbd_is_console(pa->pa_tag, pa->pa_slot);
369 369

cvs diff -r1.12 -r1.13 src/sys/dev/pckbport/pckbport.c (expand / switch to unified diff)

--- src/sys/dev/pckbport/pckbport.c 2008/03/15 18:46:22 1.12
+++ src/sys/dev/pckbport/pckbport.c 2008/03/15 18:59:07 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pckbport.c,v 1.12 2008/03/15 18:46:22 cube Exp $ */ 1/* $NetBSD: pckbport.c,v 1.13 2008/03/15 18:59:07 cube Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004 Ben Harris 4 * Copyright (c) 2004 Ben Harris
5 * Copyright (c) 1998 5 * Copyright (c) 1998
6 * Matthias Drochner. All rights reserved. 6 * Matthias Drochner. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 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 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 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 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.12 2008/03/15 18:46:22 cube Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: pckbport.c,v 1.13 2008/03/15 18:59:07 cube Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/callout.h> 34#include <sys/callout.h>
35#include <sys/kernel.h> 35#include <sys/kernel.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/malloc.h> 38#include <sys/malloc.h>
39#include <sys/errno.h> 39#include <sys/errno.h>
40#include <sys/queue.h> 40#include <sys/queue.h>
41 41
42#include <dev/pckbport/pckbdreg.h> 42#include <dev/pckbport/pckbdreg.h>
43#include <dev/pckbport/pckbportvar.h> 43#include <dev/pckbport/pckbportvar.h>
@@ -118,44 +118,44 @@ pckbport_attach(void *cookie, struct pck @@ -118,44 +118,44 @@ pckbport_attach(void *cookie, struct pck
118 pckbport_tag_t t; 118 pckbport_tag_t t;
119 119
120 if (cookie == pckbport_cntag.t_cookie && 120 if (cookie == pckbport_cntag.t_cookie &&
121 ops == pckbport_cntag.t_ops) 121 ops == pckbport_cntag.t_ops)
122 return &pckbport_cntag; 122 return &pckbport_cntag;
123 t = malloc(sizeof(struct pckbport_tag), M_DEVBUF, M_NOWAIT | M_ZERO); 123 t = malloc(sizeof(struct pckbport_tag), M_DEVBUF, M_NOWAIT | M_ZERO);
124 if (t == NULL) return NULL; 124 if (t == NULL) return NULL;
125 callout_init(&t->t_cleanup, 0); 125 callout_init(&t->t_cleanup, 0);
126 t->t_cookie = cookie; 126 t->t_cookie = cookie;
127 t->t_ops = ops; 127 t->t_ops = ops;
128 return t; 128 return t;
129} 129}
130 130
131struct device * 131device_t
132pckbport_attach_slot(struct device *dev, pckbport_tag_t t, 132pckbport_attach_slot(device_t dev, pckbport_tag_t t,
133 pckbport_slot_t slot) 133 pckbport_slot_t slot)
134{ 134{
135 struct pckbport_attach_args pa; 135 struct pckbport_attach_args pa;
136 void *sdata; 136 void *sdata;
137 struct device *found; 137 device_t found;
138 int alloced = 0; 138 int alloced = 0;
139 int locs[PCKBPORTCF_NLOCS]; 139 int locs[PCKBPORTCF_NLOCS];
140 140
141 pa.pa_tag = t; 141 pa.pa_tag = t;
142 pa.pa_slot = slot; 142 pa.pa_slot = slot;
143 143
144 if (t->t_slotdata[slot] == NULL) { 144 if (t->t_slotdata[slot] == NULL) {
145 sdata = malloc(sizeof(struct pckbport_slotdata), 145 sdata = malloc(sizeof(struct pckbport_slotdata),
146 M_DEVBUF, M_NOWAIT); 146 M_DEVBUF, M_NOWAIT);
147 if (sdata == NULL) { 147 if (sdata == NULL) {
148 printf("%s: no memory\n", dev->dv_xname); 148 aprint_error_dev(dev, "no memory\n");
149 return 0; 149 return 0;
150 } 150 }
151 t->t_slotdata[slot] = sdata; 151 t->t_slotdata[slot] = sdata;
152 pckbport_init_slotdata(t->t_slotdata[slot]); 152 pckbport_init_slotdata(t->t_slotdata[slot]);
153 alloced++; 153 alloced++;
154 } 154 }
155 155
156 locs[PCKBPORTCF_SLOT] = slot; 156 locs[PCKBPORTCF_SLOT] = slot;
157 157
158 found = config_found_sm_loc(dev, "pckbport", locs, &pa, 158 found = config_found_sm_loc(dev, "pckbport", locs, &pa,
159 pckbportprint, config_stdsubmatch); 159 pckbportprint, config_stdsubmatch);
160 160
161 if (found == NULL && alloced) { 161 if (found == NULL && alloced) {

cvs diff -r1.7 -r1.8 src/sys/dev/pckbport/pckbportvar.h (expand / switch to unified diff)

--- src/sys/dev/pckbport/pckbportvar.h 2008/03/15 18:46:22 1.7
+++ src/sys/dev/pckbport/pckbportvar.h 2008/03/15 18:59:07 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pckbportvar.h,v 1.7 2008/03/15 18:46:22 cube Exp $ */ 1/* $NetBSD: pckbportvar.h,v 1.8 2008/03/15 18:59:07 cube Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2004 Ben Harris 4 * Copyright (c) 2004 Ben Harris
5 * Copyright (c) 1998 5 * Copyright (c) 1998
6 * Matthias Drochner. All rights reserved. 6 * Matthias Drochner. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -86,21 +86,20 @@ int pckbport_poll_cmd(pckbport_tag_t, pc @@ -86,21 +86,20 @@ int pckbport_poll_cmd(pckbport_tag_t, pc
86 int, u_char *, int); 86 int, u_char *, int);
87int pckbport_enqueue_cmd(pckbport_tag_t, pckbport_slot_t, u_char *, int, 87int pckbport_enqueue_cmd(pckbport_tag_t, pckbport_slot_t, u_char *, int,
88 int, int, u_char *); 88 int, int, u_char *);
89int pckbport_poll_data(pckbport_tag_t, pckbport_slot_t); 89int pckbport_poll_data(pckbport_tag_t, pckbport_slot_t);
90void pckbport_set_poll(pckbport_tag_t, pckbport_slot_t, int); 90void pckbport_set_poll(pckbport_tag_t, pckbport_slot_t, int);
91int pckbport_xt_translation(pckbport_tag_t, pckbport_slot_t, int); 91int pckbport_xt_translation(pckbport_tag_t, pckbport_slot_t, int);
92void pckbport_slot_enable(pckbport_tag_t, pckbport_slot_t, int); 92void pckbport_slot_enable(pckbport_tag_t, pckbport_slot_t, int);
93 93
94/* calls from pckbc etc */ 94/* calls from pckbc etc */
95int pckbport_cnattach(void *, struct pckbport_accessops const *, 95int pckbport_cnattach(void *, struct pckbport_accessops const *,
96 pckbport_slot_t); 96 pckbport_slot_t);
97pckbport_tag_t pckbport_attach(void *, 97pckbport_tag_t pckbport_attach(void *,
98 struct pckbport_accessops const *); 98 struct pckbport_accessops const *);
99struct device *pckbport_attach_slot(struct device *, pckbport_tag_t, 99device_t pckbport_attach_slot(device_t, pckbport_tag_t, pckbport_slot_t);
100 pckbport_slot_t); 
101void pckbportintr(pckbport_tag_t, pckbport_slot_t, int); 100void pckbportintr(pckbport_tag_t, pckbport_slot_t, int);
102 101
103/* md hook for use without mi wscons */ 102/* md hook for use without mi wscons */
104int pckbport_machdep_cnattach(pckbport_tag_t, pckbport_slot_t); 103int pckbport_machdep_cnattach(pckbport_tag_t, pckbport_slot_t);
105 104
106#endif /* _DEV_PCKBPORT_PCKBPORTVAR_H_ */ 105#endif /* _DEV_PCKBPORT_PCKBPORTVAR_H_ */

cvs diff -r1.25 -r1.26 src/sys/dev/pckbport/pms.c (expand / switch to unified diff)

--- src/sys/dev/pckbport/pms.c 2008/03/15 18:46:22 1.25
+++ src/sys/dev/pckbport/pms.c 2008/03/15 18:59:07 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pms.c,v 1.25 2008/03/15 18:46:22 cube Exp $ */ 1/* $NetBSD: pms.c,v 1.26 2008/03/15 18:59:07 cube Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 Kentaro Kurahone. 4 * Copyright (c) 2004 Kentaro Kurahone.
5 * Copyright (c) 2004 Ales Krenek. 5 * Copyright (c) 2004 Ales Krenek.
6 * Copyright (c) 1994 Charles M. Hannum. 6 * Copyright (c) 1994 Charles M. Hannum.
7 * Copyright (c) 1992, 1993 Erik Forsberg. 7 * Copyright (c) 1992, 1993 Erik Forsberg.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.25 2008/03/15 18:46:22 cube Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.26 2008/03/15 18:59:07 cube Exp $");
30 30
31#include "opt_pms.h" 31#include "opt_pms.h"
32 32
33#include <sys/param.h> 33#include <sys/param.h>
34#include <sys/systm.h> 34#include <sys/systm.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/ioctl.h> 36#include <sys/ioctl.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <sys/kthread.h> 38#include <sys/kthread.h>
39 39
40#include <sys/bus.h> 40#include <sys/bus.h>
41 41
42#include <dev/pckbport/pckbportvar.h> 42#include <dev/pckbport/pckbportvar.h>
@@ -61,28 +61,28 @@ int pmsdebug = 1; @@ -61,28 +61,28 @@ int pmsdebug = 1;
61const enum pms_type tries[] = { 61const enum pms_type tries[] = {
62 PMS_SCROLL5, PMS_SCROLL3, PMS_STANDARD, PMS_UNKNOWN 62 PMS_SCROLL5, PMS_SCROLL3, PMS_STANDARD, PMS_UNKNOWN
63}; 63};
64 64
65const struct pms_protocol pms_protocols[] = { 65const struct pms_protocol pms_protocols[] = {
66 { { 0, 0, 0 }, 0, "unknown protocol" }, 66 { { 0, 0, 0 }, 0, "unknown protocol" },
67 { { 0, 0, 0 }, 0, "no scroll wheel (3 buttons)" }, 67 { { 0, 0, 0 }, 0, "no scroll wheel (3 buttons)" },
68 { { 200, 100, 80 }, 3, "scroll wheel (3 buttons)" }, 68 { { 200, 100, 80 }, 3, "scroll wheel (3 buttons)" },
69 { { 200, 200, 80 }, 4, "scroll wheel (5 buttons)" }, 69 { { 200, 200, 80 }, 4, "scroll wheel (5 buttons)" },
70 { { 0, 0, 0 }, 0, "synaptics" } 70 { { 0, 0, 0 }, 0, "synaptics" }
71}; 71};
72 72
73 73
74int pmsprobe(struct device *, struct cfdata *, void *); 74int pmsprobe(device_t, cfdata_t, void *);
75void pmsattach(struct device *, struct device *, void *); 75void pmsattach(device_t, device_t, void *);
76void pmsinput(void *, int); 76void pmsinput(void *, int);
77 77
78CFATTACH_DECL_NEW(pms, sizeof(struct pms_softc), 78CFATTACH_DECL_NEW(pms, sizeof(struct pms_softc),
79 pmsprobe, pmsattach, NULL, NULL); 79 pmsprobe, pmsattach, NULL, NULL);
80 80
81static int pms_protocol(pckbport_tag_t, pckbport_slot_t); 81static int pms_protocol(pckbport_tag_t, pckbport_slot_t);
82static void do_enable(struct pms_softc *); 82static void do_enable(struct pms_softc *);
83static void do_disable(struct pms_softc *); 83static void do_disable(struct pms_softc *);
84static void pms_reset_thread(void*); 84static void pms_reset_thread(void*);
85int pms_enable(void *); 85int pms_enable(void *);
86int pms_ioctl(void *, u_long, void *, int, struct lwp *); 86int pms_ioctl(void *, u_long, void *, int, struct lwp *);
87void pms_disable(void *); 87void pms_disable(void *);
88 88
@@ -119,28 +119,27 @@ pms_protocol(pckbport_tag_t tag, pckbpor @@ -119,28 +119,27 @@ pms_protocol(pckbport_tag_t tag, pckbpor
119 if (res) 119 if (res)
120 return PMS_UNKNOWN; 120 return PMS_UNKNOWN;
121 if (resp[0] == p->response) { 121 if (resp[0] == p->response) {
122 DPRINTF(("pms_protocol: found mouse protocol %d\n", 122 DPRINTF(("pms_protocol: found mouse protocol %d\n",
123 tries[j])); 123 tries[j]));
124 return tries[j]; 124 return tries[j];
125 } 125 }
126 } 126 }
127 DPRINTF(("pms_protocol: standard PS/2 protocol (no scroll wheel)\n")); 127 DPRINTF(("pms_protocol: standard PS/2 protocol (no scroll wheel)\n"));
128 return PMS_STANDARD; 128 return PMS_STANDARD;
129} 129}
130 130
131int 131int
132pmsprobe(struct device *parent, struct cfdata *match, 132pmsprobe(device_t parent, cfdata_t match, void *aux)
133 void *aux) 
134{ 133{
135 struct pckbport_attach_args *pa = aux; 134 struct pckbport_attach_args *pa = aux;
136 u_char cmd[1], resp[2]; 135 u_char cmd[1], resp[2];
137 int res; 136 int res;
138 137
139 if (pa->pa_slot != PCKBPORT_AUX_SLOT) 138 if (pa->pa_slot != PCKBPORT_AUX_SLOT)
140 return 0; 139 return 0;
141 140
142 /* Flush any garbage. */ 141 /* Flush any garbage. */
143 pckbport_flush(pa->pa_tag, pa->pa_slot); 142 pckbport_flush(pa->pa_tag, pa->pa_slot);
144 143
145 /* reset the device */ 144 /* reset the device */
146 cmd[0] = PMS_RESET; 145 cmd[0] = PMS_RESET;
@@ -158,27 +157,27 @@ pmsprobe(struct device *parent, struct c @@ -158,27 +157,27 @@ pmsprobe(struct device *parent, struct c
158 157
159 /* get type number (0 = mouse) */ 158 /* get type number (0 = mouse) */
160 if (resp[1] != 0) { 159 if (resp[1] != 0) {
161#ifdef DEBUG 160#ifdef DEBUG
162 printf("pmsprobe: type 0x%x\n", resp[1]); 161 printf("pmsprobe: type 0x%x\n", resp[1]);
163#endif 162#endif
164 return 0; 163 return 0;
165 } 164 }
166 165
167 return 10; 166 return 10;
168} 167}
169 168
170void 169void
171pmsattach(struct device *parent, struct device *self, void *aux) 170pmsattach(device_t parent, device_t self, void *aux)
172{ 171{
173 struct pms_softc *sc = device_private(self); 172 struct pms_softc *sc = device_private(self);
174 struct pckbport_attach_args *pa = aux; 173 struct pckbport_attach_args *pa = aux;
175 struct wsmousedev_attach_args a; 174 struct wsmousedev_attach_args a;
176 u_char cmd[2], resp[2]; 175 u_char cmd[2], resp[2];
177 int res; 176 int res;
178 177
179 sc->sc_dev = self; 178 sc->sc_dev = self;
180 sc->sc_kbctag = pa->pa_tag; 179 sc->sc_kbctag = pa->pa_tag;
181 sc->sc_kbcslot = pa->pa_slot; 180 sc->sc_kbcslot = pa->pa_slot;
182 181
183 aprint_naive("\n"); 182 aprint_naive("\n");
184 aprint_normal("\n"); 183 aprint_normal("\n");

cvs diff -r1.6 -r1.7 src/sys/dev/pckbport/pmsvar.h (expand / switch to unified diff)

--- src/sys/dev/pckbport/pmsvar.h 2008/03/15 18:46:22 1.6
+++ src/sys/dev/pckbport/pmsvar.h 2008/03/15 18:59:07 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmsvar.h,v 1.6 2008/03/15 18:46:22 cube Exp $ */ 1/* $NetBSD: pmsvar.h,v 1.7 2008/03/15 18:59:07 cube Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2004 Kentaro Kurahone. 4 * Copyright (c) 2004 Kentaro Kurahone.
5 * Copyright (c) 2004 Ales Krenek. 5 * Copyright (c) 2004 Ales Krenek.
6 * Copyright (c) 1994 Charles M. Hannum. 6 * Copyright (c) 1994 Charles M. Hannum.
7 * Copyright (c) 1992, 1993 Erik Forsberg. 7 * Copyright (c) 1992, 1993 Erik Forsberg.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -49,24 +49,24 @@ struct pms_softc { /* driver status inf @@ -49,24 +49,24 @@ struct pms_softc { /* driver status inf
49 int sc_kbcslot; 49 int sc_kbcslot;
50 50
51 int sc_enabled; /* input enabled? */ 51 int sc_enabled; /* input enabled? */
52#ifndef PMS_DISABLE_POWERHOOK 52#ifndef PMS_DISABLE_POWERHOOK
53 void *sc_powerhook; /* cookie from power hook */ 53 void *sc_powerhook; /* cookie from power hook */
54 int sc_suspended; /* suspended? */ 54 int sc_suspended; /* suspended? */
55#endif /* !PMS_DISABLE_POWERHOOK */ 55#endif /* !PMS_DISABLE_POWERHOOK */
56 int inputstate; /* number of bytes received for this packet */ 56 int inputstate; /* number of bytes received for this packet */
57 u_int buttons; /* mouse button status */ 57 u_int buttons; /* mouse button status */
58 enum pms_type protocol; 58 enum pms_type protocol;
59 unsigned char packet[6]; 59 unsigned char packet[6];
60 struct timeval last, current; 60 struct timeval last, current;
61 61
62 struct device *sc_wsmousedev; 62 device_t sc_wsmousedev;
63 struct lwp *sc_event_thread; 63 struct lwp *sc_event_thread;
64 64
65#ifdef PMS_SYNAPTICS_TOUCHPAD 65#ifdef PMS_SYNAPTICS_TOUCHPAD
66 union { 66 union {
67 struct synaptics_softc synaptics; 67 struct synaptics_softc synaptics;
68 } u; 68 } u;
69#endif 69#endif
70}; 70};
71 71
72#endif 72#endif