Sun Jun 11 03:38:12 2017 UTC ()
Seperate the definitions for the console beep.  This code will be shared
with a new device.

Ok pgoyette@.


(nat)
diff -r0 -r1.1 src/sys/dev/wscons/wsbelldata.h
diff -r1.138 -r1.139 src/sys/dev/wscons/wskbd.c

File Added: src/sys/dev/wscons/wsbelldata.h
/* $NetBSD: wsbelldata.h,v 1.1 2017/06/11 03:38:12 nat Exp $ */
/*-
 * Copyright (c) 2017 Nathanial Sloss <nathanialsloss@yahoo.com.au>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef WSKBD_DEFAULT_BELL_PITCH
#define	WSKBD_DEFAULT_BELL_PITCH	1500	/* 1500Hz */
#endif
#ifndef WSKBD_DEFAULT_BELL_PERIOD
#define	WSKBD_DEFAULT_BELL_PERIOD	100	/* 100ms */
#endif
#ifndef WSKBD_DEFAULT_BELL_VOLUME
#define	WSKBD_DEFAULT_BELL_VOLUME	50	/* 50% volume */
#endif

static struct wskbd_bell_data wskbd_default_bell_data = {
	WSKBD_BELL_DOALL,
	WSKBD_DEFAULT_BELL_PITCH,
	WSKBD_DEFAULT_BELL_PERIOD,
	WSKBD_DEFAULT_BELL_VOLUME,
};

cvs diff -r1.138 -r1.139 src/sys/dev/wscons/wskbd.c (expand / switch to unified diff)

--- src/sys/dev/wscons/wskbd.c 2016/12/10 22:36:28 1.138
+++ src/sys/dev/wscons/wskbd.c 2017/06/11 03:38:12 1.139
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $ */ 1/* $NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. 4 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -95,27 +95,27 @@ @@ -95,27 +95,27 @@
95 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 95 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
96 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 96 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
97 * SUCH DAMAGE. 97 * SUCH DAMAGE.
98 * 98 *
99 * @(#)kbd.c 8.2 (Berkeley) 10/30/93 99 * @(#)kbd.c 8.2 (Berkeley) 10/30/93
100 */ 100 */
101 101
102/* 102/*
103 * Keyboard driver (/dev/wskbd*). Translates incoming bytes to ASCII or 103 * Keyboard driver (/dev/wskbd*). Translates incoming bytes to ASCII or
104 * to `wscons_events' and passes them up to the appropriate reader. 104 * to `wscons_events' and passes them up to the appropriate reader.
105 */ 105 */
106 106
107#include <sys/cdefs.h> 107#include <sys/cdefs.h>
108__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.138 2016/12/10 22:36:28 christos Exp $"); 108__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $");
109 109
110#ifdef _KERNEL_OPT 110#ifdef _KERNEL_OPT
111#include "opt_ddb.h" 111#include "opt_ddb.h"
112#include "opt_kgdb.h" 112#include "opt_kgdb.h"
113#include "opt_wsdisplay_compat.h" 113#include "opt_wsdisplay_compat.h"
114#endif 114#endif
115 115
116#include "wsdisplay.h" 116#include "wsdisplay.h"
117#include "wskbd.h" 117#include "wskbd.h"
118#include "wsmux.h" 118#include "wsmux.h"
119 119
120#include <sys/param.h> 120#include <sys/param.h>
121#include <sys/conf.h> 121#include <sys/conf.h>
@@ -132,26 +132,27 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1. @@ -132,26 +132,27 @@ __KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.
132#include <sys/signalvar.h> 132#include <sys/signalvar.h>
133#include <sys/errno.h> 133#include <sys/errno.h>
134#include <sys/fcntl.h> 134#include <sys/fcntl.h>
135#include <sys/vnode.h> 135#include <sys/vnode.h>
136#include <sys/kauth.h> 136#include <sys/kauth.h>
137 137
138#include <dev/wscons/wsconsio.h> 138#include <dev/wscons/wsconsio.h>
139#include <dev/wscons/wskbdvar.h> 139#include <dev/wscons/wskbdvar.h>
140#include <dev/wscons/wsksymdef.h> 140#include <dev/wscons/wsksymdef.h>
141#include <dev/wscons/wsksymvar.h> 141#include <dev/wscons/wsksymvar.h>
142#include <dev/wscons/wsdisplayvar.h> 142#include <dev/wscons/wsdisplayvar.h>
143#include <dev/wscons/wseventvar.h> 143#include <dev/wscons/wseventvar.h>
144#include <dev/wscons/wscons_callbacks.h> 144#include <dev/wscons/wscons_callbacks.h>
 145#include <dev/wscons/wsbelldata.h>
145 146
146#ifdef KGDB 147#ifdef KGDB
147#include <sys/kgdb.h> 148#include <sys/kgdb.h>
148#endif 149#endif
149 150
150#ifdef WSKBD_DEBUG 151#ifdef WSKBD_DEBUG
151#define DPRINTF(x) if (wskbddebug) printf x 152#define DPRINTF(x) if (wskbddebug) printf x
152int wskbddebug = 0; 153int wskbddebug = 0;
153#else 154#else
154#define DPRINTF(x) 155#define DPRINTF(x)
155#endif 156#endif
156 157
157#include <dev/wscons/wsmuxvar.h> 158#include <dev/wscons/wsmuxvar.h>
@@ -303,43 +304,26 @@ const struct cdevsw wskbd_cdevsw = { @@ -303,43 +304,26 @@ const struct cdevsw wskbd_cdevsw = {
303 .d_close = wskbdclose, 304 .d_close = wskbdclose,
304 .d_read = wskbdread, 305 .d_read = wskbdread,
305 .d_write = nowrite, 306 .d_write = nowrite,
306 .d_ioctl = wskbdioctl, 307 .d_ioctl = wskbdioctl,
307 .d_stop = nostop, 308 .d_stop = nostop,
308 .d_tty = notty, 309 .d_tty = notty,
309 .d_poll = wskbdpoll, 310 .d_poll = wskbdpoll,
310 .d_mmap = nommap, 311 .d_mmap = nommap,
311 .d_kqfilter = wskbdkqfilter, 312 .d_kqfilter = wskbdkqfilter,
312 .d_discard = nodiscard, 313 .d_discard = nodiscard,
313 .d_flag = D_OTHER 314 .d_flag = D_OTHER
314}; 315};
315 316
316#ifndef WSKBD_DEFAULT_BELL_PITCH 
317#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */ 
318#endif 
319#ifndef WSKBD_DEFAULT_BELL_PERIOD 
320#define WSKBD_DEFAULT_BELL_PERIOD 100 /* 100ms */ 
321#endif 
322#ifndef WSKBD_DEFAULT_BELL_VOLUME 
323#define WSKBD_DEFAULT_BELL_VOLUME 50 /* 50% volume */ 
324#endif 
325 
326struct wskbd_bell_data wskbd_default_bell_data = { 
327 WSKBD_BELL_DOALL, 
328 WSKBD_DEFAULT_BELL_PITCH, 
329 WSKBD_DEFAULT_BELL_PERIOD, 
330 WSKBD_DEFAULT_BELL_VOLUME, 
331}; 
332 
333#ifdef WSDISPLAY_SCROLLSUPPORT 317#ifdef WSDISPLAY_SCROLLSUPPORT
334struct wskbd_scroll_data wskbd_default_scroll_data = { 318struct wskbd_scroll_data wskbd_default_scroll_data = {
335 WSKBD_SCROLL_DOALL, 319 WSKBD_SCROLL_DOALL,
336 WSKBD_SCROLL_MODE_NORMAL, 320 WSKBD_SCROLL_MODE_NORMAL,
337#ifdef WSDISPLAY_SCROLLCOMBO 321#ifdef WSDISPLAY_SCROLLCOMBO
338 WSDISPLAY_SCROLLCOMBO, 322 WSDISPLAY_SCROLLCOMBO,
339#else 323#else
340 MOD_SHIFT_L, 324 MOD_SHIFT_L,
341#endif 325#endif
342}; 326};
343#endif 327#endif
344 328
345#ifndef WSKBD_DEFAULT_KEYREPEAT_DEL1 329#ifndef WSKBD_DEFAULT_KEYREPEAT_DEL1