Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm32/dev Some small improvements on the setting of...
details: https://anonhg.NetBSD.org/src/rev/1ff4fcd26311
branches: trunk
changeset: 509427:1ff4fcd26311
user: reinoud <reinoud%NetBSD.org@localhost>
date: Thu May 03 23:05:48 2001 +0000
description:
Some small improvements on the setting of keyboard LEDS's and a small
cleanup
diffstat:
sys/arch/arm32/dev/rpckbd.c | 30 ++++++++++++++++++++++--------
sys/arch/arm32/dev/rpckbdvar.h | 7 +++----
2 files changed, 25 insertions(+), 12 deletions(-)
diffs (101 lines):
diff -r 6e6750e5c6e1 -r 1ff4fcd26311 sys/arch/arm32/dev/rpckbd.c
--- a/sys/arch/arm32/dev/rpckbd.c Thu May 03 22:25:00 2001 +0000
+++ b/sys/arch/arm32/dev/rpckbd.c Thu May 03 23:05:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpckbd.c,v 1.2 2001/04/02 12:34:34 reinoud Exp $ */
+/* $NetBSD: rpckbd.c,v 1.3 2001/05/03 23:05:48 reinoud Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -56,6 +56,9 @@
#include <machine/bus.h>
#include <machine/conf.h>
+#include "opt_pckbd_layout.h"
+#include "opt_wsdisplay_compat.h"
+
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wskbdvar.h>
#include <dev/wscons/wsksymdef.h>
@@ -65,8 +68,6 @@
#include <arm32/dev/wskbdmap_mfii.h>
#include <dev/cons.h>
-#include "opt_pckbd_layout.h"
-
#include "beep.h"
/* Keyboard commands */
@@ -170,7 +171,7 @@
rpckbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
{
struct rpckbd_softc *sc = (struct rpckbd_softc *)v;
- int res;
+ int res, new_ledstate;;
switch (cmd) {
case WSKBDIO_GTYPE:
@@ -178,7 +179,13 @@
return 0;
case WSKBDIO_SETLEDS: {
/* same as rpckbd_set_leds */
- sc->sc_ledstate = rpckbd_led_encode(*(int *)data);
+
+ /* check if we're allready in this state */
+ new_ledstate = rpckbd_led_encode(*(int *)data);
+ if (new_ledstate == sc->sc_ledstate)
+ return (0);
+
+ sc->sc_ledstate = new_ledstate;
res = kbdcmd(sc, KBC_SETLEDS, 0);
res = kbdcmd(sc, sc->sc_ledstate, 0);
if (res == KBR_ACK)
@@ -318,9 +325,16 @@
rpckbd_set_leds(void *context, int leds)
{
struct rpckbd_softc *sc = (struct rpckbd_softc *) context;
- int res;
+ int res, new_ledstate;
+
- sc->sc_ledstate = rpckbd_led_encode(leds);
+ /* check if we're allready in this state */
+ new_ledstate = rpckbd_led_encode(leds);
+ if (new_ledstate == sc->sc_ledstate)
+ return;
+
+ /* set state */
+ sc->sc_ledstate = new_ledstate;;
kbdcmd(sc, KBC_SETLEDS, 0);
res = kbdcmd(sc, sc->sc_ledstate, 0);
@@ -342,7 +356,7 @@
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (sc->rawkbd) {
- wskbd_rawinput(sc->sc_wskbddev, &data, 1);
+ wskbd_rawinput(sc->sc_wskbddev, (u_char *) &data, 1);
return (1); /* claim interrupt */
}
#endif
diff -r 6e6750e5c6e1 -r 1ff4fcd26311 sys/arch/arm32/dev/rpckbdvar.h
--- a/sys/arch/arm32/dev/rpckbdvar.h Thu May 03 22:25:00 2001 +0000
+++ b/sys/arch/arm32/dev/rpckbdvar.h Thu May 03 23:05:48 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpckbdvar.h,v 1.1 2001/03/20 18:20:54 reinoud Exp $ */
+/* $NetBSD: rpckbdvar.h,v 1.2 2001/05/03 23:05:48 reinoud Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -66,9 +66,8 @@
int sc_ledstate;
struct device *sc_wskbddev;
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- int rawkbd
-#endif
+
+ int rawkbd;
};
Home |
Main Index |
Thread Index |
Old Index