diff options
| author | Kazutaka YOKOTA <yokota@FreeBSD.org> | 1998-01-20 03:37:27 +0000 |
|---|---|---|
| committer | Kazutaka YOKOTA <yokota@FreeBSD.org> | 1998-01-20 03:37:27 +0000 |
| commit | 6c401d343fb59515fe6a280c0a07ca624f6c4809 (patch) | |
| tree | e01792f8b875e754bea8b70784ba51927294fbb0 | |
| parent | 141868ce36879219e8c241228cc93e462774ae12 (diff) | |
Notes
| -rw-r--r-- | sys/dev/syscons/syscons.c | 52 | ||||
| -rw-r--r-- | sys/i386/isa/psm.c | 69 | ||||
| -rw-r--r-- | sys/i386/isa/syscons.c | 52 | ||||
| -rw-r--r-- | sys/isa/syscons.c | 52 |
4 files changed, 220 insertions, 5 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index a63e79abe5cd..493cec7cae11 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.244 1998/01/09 09:06:55 yokota Exp $ + * $Id: syscons.c,v 1.245 1998/01/12 03:28:36 julian Exp $ */ #include "sc.h" @@ -91,6 +91,23 @@ #define MODE_MAP_SIZE (M_VGA_CG320 + 1) #define MODE_PARAM_SIZE 64 +/* for backward compatibility */ +#define OLD_CONS_MOUSECTL _IOWR('c', 10, old_mouse_info_t) + +typedef struct old_mouse_data { + int x; + int y; + int buttons; +} old_mouse_data_t; + +typedef struct old_mouse_info { + int operation; + union { + struct old_mouse_data data; + struct mouse_mode mode; + } u; +} old_mouse_info_t; + /* XXX use sc_bcopy where video memory is concerned */ #define sc_bcopy generic_bcopy extern void generic_bcopy(const void *, void *, size_t); @@ -1065,6 +1082,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return EINVAL; case CONS_MOUSECTL: /* control mouse arrow */ + case OLD_CONS_MOUSECTL: { /* MOUSE_BUTTON?DOWN -> MOUSE_MSC_BUTTON?UP */ static butmap[8] = { @@ -1079,10 +1097,42 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) 0, }; mouse_info_t *mouse = (mouse_info_t*)data; + mouse_info_t buf; if (!crtc_vga) return ENODEV; + if (cmd == OLD_CONS_MOUSECTL) { + static unsigned char swapb[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; + old_mouse_info_t *old_mouse = (old_mouse_info_t *)data; + + mouse = &buf; + mouse->operation = old_mouse->operation; + switch (mouse->operation) { + case MOUSE_MODE: + mouse->u.mode = old_mouse->u.mode; + break; + case MOUSE_SHOW: + case MOUSE_HIDE: + break; + case MOUSE_MOVEABS: + case MOUSE_MOVEREL: + case MOUSE_ACTION: + mouse->u.data.x = old_mouse->u.data.x; + mouse->u.data.y = old_mouse->u.data.y; + mouse->u.data.z = 0; + mouse->u.data.buttons = swapb[old_mouse->u.data.buttons & 0x7]; + break; + case MOUSE_GETINFO: + old_mouse->u.data.x = scp->mouse_xpos; + old_mouse->u.data.y = scp->mouse_ypos; + old_mouse->u.data.buttons = swapb[scp->mouse_buttons & 0x7]; + break; + default: + return EINVAL; + } + } + switch (mouse->operation) { case MOUSE_MODE: if (ISSIGVALID(mouse->u.mode.signal)) { diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c index d839a8252428..fb23ba620b15 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; diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index a63e79abe5cd..493cec7cae11 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.244 1998/01/09 09:06:55 yokota Exp $ + * $Id: syscons.c,v 1.245 1998/01/12 03:28:36 julian Exp $ */ #include "sc.h" @@ -91,6 +91,23 @@ #define MODE_MAP_SIZE (M_VGA_CG320 + 1) #define MODE_PARAM_SIZE 64 +/* for backward compatibility */ +#define OLD_CONS_MOUSECTL _IOWR('c', 10, old_mouse_info_t) + +typedef struct old_mouse_data { + int x; + int y; + int buttons; +} old_mouse_data_t; + +typedef struct old_mouse_info { + int operation; + union { + struct old_mouse_data data; + struct mouse_mode mode; + } u; +} old_mouse_info_t; + /* XXX use sc_bcopy where video memory is concerned */ #define sc_bcopy generic_bcopy extern void generic_bcopy(const void *, void *, size_t); @@ -1065,6 +1082,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return EINVAL; case CONS_MOUSECTL: /* control mouse arrow */ + case OLD_CONS_MOUSECTL: { /* MOUSE_BUTTON?DOWN -> MOUSE_MSC_BUTTON?UP */ static butmap[8] = { @@ -1079,10 +1097,42 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) 0, }; mouse_info_t *mouse = (mouse_info_t*)data; + mouse_info_t buf; if (!crtc_vga) return ENODEV; + if (cmd == OLD_CONS_MOUSECTL) { + static unsigned char swapb[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; + old_mouse_info_t *old_mouse = (old_mouse_info_t *)data; + + mouse = &buf; + mouse->operation = old_mouse->operation; + switch (mouse->operation) { + case MOUSE_MODE: + mouse->u.mode = old_mouse->u.mode; + break; + case MOUSE_SHOW: + case MOUSE_HIDE: + break; + case MOUSE_MOVEABS: + case MOUSE_MOVEREL: + case MOUSE_ACTION: + mouse->u.data.x = old_mouse->u.data.x; + mouse->u.data.y = old_mouse->u.data.y; + mouse->u.data.z = 0; + mouse->u.data.buttons = swapb[old_mouse->u.data.buttons & 0x7]; + break; + case MOUSE_GETINFO: + old_mouse->u.data.x = scp->mouse_xpos; + old_mouse->u.data.y = scp->mouse_ypos; + old_mouse->u.data.buttons = swapb[scp->mouse_buttons & 0x7]; + break; + default: + return EINVAL; + } + } + switch (mouse->operation) { case MOUSE_MODE: if (ISSIGVALID(mouse->u.mode.signal)) { diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index a63e79abe5cd..493cec7cae11 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.244 1998/01/09 09:06:55 yokota Exp $ + * $Id: syscons.c,v 1.245 1998/01/12 03:28:36 julian Exp $ */ #include "sc.h" @@ -91,6 +91,23 @@ #define MODE_MAP_SIZE (M_VGA_CG320 + 1) #define MODE_PARAM_SIZE 64 +/* for backward compatibility */ +#define OLD_CONS_MOUSECTL _IOWR('c', 10, old_mouse_info_t) + +typedef struct old_mouse_data { + int x; + int y; + int buttons; +} old_mouse_data_t; + +typedef struct old_mouse_info { + int operation; + union { + struct old_mouse_data data; + struct mouse_mode mode; + } u; +} old_mouse_info_t; + /* XXX use sc_bcopy where video memory is concerned */ #define sc_bcopy generic_bcopy extern void generic_bcopy(const void *, void *, size_t); @@ -1065,6 +1082,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) return EINVAL; case CONS_MOUSECTL: /* control mouse arrow */ + case OLD_CONS_MOUSECTL: { /* MOUSE_BUTTON?DOWN -> MOUSE_MSC_BUTTON?UP */ static butmap[8] = { @@ -1079,10 +1097,42 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) 0, }; mouse_info_t *mouse = (mouse_info_t*)data; + mouse_info_t buf; if (!crtc_vga) return ENODEV; + if (cmd == OLD_CONS_MOUSECTL) { + static unsigned char swapb[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; + old_mouse_info_t *old_mouse = (old_mouse_info_t *)data; + + mouse = &buf; + mouse->operation = old_mouse->operation; + switch (mouse->operation) { + case MOUSE_MODE: + mouse->u.mode = old_mouse->u.mode; + break; + case MOUSE_SHOW: + case MOUSE_HIDE: + break; + case MOUSE_MOVEABS: + case MOUSE_MOVEREL: + case MOUSE_ACTION: + mouse->u.data.x = old_mouse->u.data.x; + mouse->u.data.y = old_mouse->u.data.y; + mouse->u.data.z = 0; + mouse->u.data.buttons = swapb[old_mouse->u.data.buttons & 0x7]; + break; + case MOUSE_GETINFO: + old_mouse->u.data.x = scp->mouse_xpos; + old_mouse->u.data.y = scp->mouse_ypos; + old_mouse->u.data.buttons = swapb[scp->mouse_buttons & 0x7]; + break; + default: + return EINVAL; + } + } + switch (mouse->operation) { case MOUSE_MODE: if (ISSIGVALID(mouse->u.mode.signal)) { |
