summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/psm.c
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1998-01-20 03:37:27 +0000
committeryokota <yokota@FreeBSD.org>1998-01-20 03:37:27 +0000
commit43da2fbee4cbb36a509d9d8e0fd41e20955fbcab (patch)
tree4b26a3117241bf173723c2fd1628169545df5e42 /sys/i386/isa/psm.c
parent54650486538bbfb1f9f240f46db21c35a5e2122a (diff)
downloadFreeBSD-src-43da2fbee4cbb36a509d9d8e0fd41e20955fbcab.zip
FreeBSD-src-43da2fbee4cbb36a509d9d8e0fd41e20955fbcab.tar.gz
- Add binary compatibility support for obsolete console/mouse ioctls
so that existing programs which were compiled before the introduction of the new mouse code and use these ioctls will run unmodified. Suggested by msmith.
Diffstat (limited to 'sys/i386/isa/psm.c')
-rw-r--r--sys/i386/isa/psm.c69
1 files changed, 67 insertions, 2 deletions
diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c
index d839a82..fb23ba6 100644
--- a/sys/i386/isa/psm.c
+++ b/sys/i386/isa/psm.c
@@ -20,7 +20,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: psm.c,v 1.46 1997/11/21 11:36:21 yokota Exp $
+ * $Id: psm.c,v 1.47 1997/12/07 08:09:17 yokota Exp $
*/
/*
@@ -191,6 +191,25 @@ static struct psm_softc { /* Driver status information */
*/
#define PSM_FLAGS_NATIVEMODE 0x0200
+/* for backward compatibility */
+#define OLD_MOUSE_GETHWINFO _IOR('M', 1, old_mousehw_t)
+#define OLD_MOUSE_GETMODE _IOR('M', 2, old_mousemode_t)
+#define OLD_MOUSE_SETMODE _IOW('M', 3, old_mousemode_t)
+
+typedef struct old_mousehw {
+ int buttons;
+ int iftype;
+ int type;
+ int hwid;
+} old_mousehw_t;
+
+typedef struct old_mousemode {
+ int protocol;
+ int rate;
+ int resolution;
+ int accelfactor;
+} old_mousemode_t;
+
/* packet formatting function */
typedef int packetfunc_t __P((struct psm_softc *, unsigned char *,
int *, int, mousestatus_t *));
@@ -1361,6 +1380,15 @@ psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
/* Perform IOCTL command */
switch (cmd) {
+ case OLD_MOUSE_GETHWINFO:
+ s = spltty();
+ ((old_mousehw_t *)addr)->buttons = sc->hw.buttons;
+ ((old_mousehw_t *)addr)->iftype = sc->hw.iftype;
+ ((old_mousehw_t *)addr)->type = sc->hw.type;
+ ((old_mousehw_t *)addr)->hwid = sc->hw.hwid;
+ splx(s);
+ break;
+
case MOUSE_GETHWINFO:
s = spltty();
*(mousehw_t *)addr = sc->hw;
@@ -1369,6 +1397,25 @@ psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
splx(s);
break;
+ case OLD_MOUSE_GETMODE:
+ s = spltty();
+ switch (sc->mode.level) {
+ case PSM_LEVEL_BASE:
+ ((old_mousemode_t *)addr)->protocol = MOUSE_PROTO_PS2;
+ break;
+ case PSM_LEVEL_STANDARD:
+ ((old_mousemode_t *)addr)->protocol = MOUSE_PROTO_SYSMOUSE;
+ break;
+ case PSM_LEVEL_NATIVE:
+ ((old_mousemode_t *)addr)->protocol = MOUSE_PROTO_PS2;
+ break;
+ }
+ ((old_mousemode_t *)addr)->rate = sc->mode.rate;
+ ((old_mousemode_t *)addr)->resolution = sc->mode.resolution;
+ ((old_mousemode_t *)addr)->accelfactor = sc->mode.accelfactor;
+ splx(s);
+ break;
+
case MOUSE_GETMODE:
s = spltty();
*(mousemode_t *)addr = sc->mode;
@@ -1393,8 +1440,26 @@ psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
splx(s);
break;
+ case OLD_MOUSE_SETMODE:
case MOUSE_SETMODE:
- mode = *(mousemode_t *)addr;
+ if (cmd == OLD_MOUSE_SETMODE) {
+ mode.rate = ((old_mousemode_t *)addr)->rate;
+ /*
+ * resolution old I/F new I/F
+ * default 0 0
+ * low 1 -2
+ * medium low 2 -3
+ * medium high 3 -4
+ * high 4 -5
+ */
+ if (((old_mousemode_t *)addr)->resolution > 0)
+ mode.resolution = -((old_mousemode_t *)addr)->resolution - 1;
+ mode.accelfactor = ((old_mousemode_t *)addr)->accelfactor;
+ mode.level = -1;
+ } else {
+ mode = *(mousemode_t *)addr;
+ }
+
/* adjust and validate parameters. */
if (mode.rate > UCHAR_MAX)
return EINVAL;
OpenPOWER on IntegriCloud