From ced9088db5a7147fd240df17fd05c8dffc6b18a9 Mon Sep 17 00:00:00 2001 From: christos Date: Sun, 11 Jan 2009 23:36:39 +0000 Subject: [PATCH] retain compatibility with old firm_event. Perhaps we should bump the protocol version with an ioctl? --- sys/dev/sun/kbd.c | 6 +++--- sys/dev/sun/ms.c | 10 +++++----- sys/dev/sun/vuid_event.h | 19 +++++++++++++++++-- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c index b03aace7ecb5..67ab165fee5d 100644 --- a/sys/dev/sun/kbd.c +++ b/sys/dev/sun/kbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kbd.c,v 1.61 2008/04/20 03:05:55 tsutsui Exp $ */ +/* $NetBSD: kbd.c,v 1.62 2009/01/11 23:36:39 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -47,7 +47,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.61 2008/04/20 03:05:55 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.62 2009/01/11 23:36:39 christos Exp $"); #include #include @@ -790,7 +790,7 @@ kbd_input_event(struct kbd_softc *k, int code) fe->id = KEY_CODE(code); fe->value = KEY_UP(code) ? VKEY_UP : VKEY_DOWN; - getmicrotime(&fe->time); + firm_gettime(fe); k->k_events.ev_put = put; EV_WAKEUP(&k->k_events); } diff --git a/sys/dev/sun/ms.c b/sys/dev/sun/ms.c index 1b647db41f00..87c38d0054a2 100644 --- a/sys/dev/sun/ms.c +++ b/sys/dev/sun/ms.c @@ -1,4 +1,4 @@ -/* $NetBSD: ms.c,v 1.37 2008/04/20 03:05:55 tsutsui Exp $ */ +/* $NetBSD: ms.c,v 1.38 2009/01/11 23:36:39 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.37 2008/04/20 03:05:55 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ms.c,v 1.38 2009/01/11 23:36:39 christos Exp $"); #include #include @@ -347,7 +347,7 @@ ms_input(struct ms_softc *ms, int c) d = to_one[d - 1]; /* from 1..7 to {1,2,4} */ fe->id = to_id[d - 1]; /* from {1,2,4} to ID */ fe->value = mb & d ? VKEY_DOWN : VKEY_UP; - getmicrotime(&fe->time); + firm_gettime(fe); ADVANCE; ub ^= d; } @@ -355,7 +355,7 @@ ms_input(struct ms_softc *ms, int c) NEXT; fe->id = LOC_X_DELTA; fe->value = ms->ms_dx; - getmicrotime(&fe->time); + firm_gettime(fe); ADVANCE; ms->ms_dx = 0; } @@ -363,7 +363,7 @@ ms_input(struct ms_softc *ms, int c) NEXT; fe->id = LOC_Y_DELTA; fe->value = ms->ms_dy; - getmicrotime(&fe->time); + firm_gettime(fe); ADVANCE; ms->ms_dy = 0; } diff --git a/sys/dev/sun/vuid_event.h b/sys/dev/sun/vuid_event.h index eccca5e5e066..e59076703531 100644 --- a/sys/dev/sun/vuid_event.h +++ b/sys/dev/sun/vuid_event.h @@ -1,4 +1,4 @@ -/* $NetBSD: vuid_event.h,v 1.4 2006/08/28 16:41:04 he Exp $ */ +/* $NetBSD: vuid_event.h,v 1.5 2009/01/11 23:36:39 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -43,6 +43,11 @@ #ifndef _SUN_VUID_EVENT_H_ #define _SUN_VUID_EVENT_H_ +struct firm_timeval { + long tv_sec; + long tv_usec; +}; + /* * The following is a minimal emulation of Sun's `Firm_event' structures * and related operations necessary to make X11 happy (i.e., make it @@ -52,9 +57,19 @@ typedef struct firm_event { u_short id; /* key or MS_* or LOC_[XY]_DELTA */ u_short pad; /* unused, at least by X11 */ int value; /* VKEY_{UP,DOWN} or locator delta */ - struct timeval time; + struct firm_timeval time; } Firm_event; +__BEGIN_DECLS +static __inline void firm_settime(Firm_event *fev) +{ + struct timeval tv; + getmicrotime(&tv); + fev->time.tv_sec = (long)tv.tv_sec; + fev->time.tv_usec = (long)tv.tv_usec; +} +__END_DECLS + /* * Special `id' fields. These weird numbers simply match the old binaries. * Others are in 0..0x7f and are keyboard key numbers (keyboard dependent!).