summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorqz150045 <none@none>2006-03-22 19:06:18 -0800
committerqz150045 <none@none>2006-03-22 19:06:18 -0800
commitd5007c14714a317d8cf986a22ec8ac39f16e168f (patch)
tree232bfda3a7e23ff68338050f22b96faa2a7f9a55 /usr/src
parentd6bb6a8465e557cb946ef49d56ed3202f6218652 (diff)
downloadillumos-joyent-d5007c14714a317d8cf986a22ec8ac39f16e168f.tar.gz
6396086 absolute mouse type event is not delivered to X during hotplug
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/io/consms.c45
-rw-r--r--usr/src/uts/common/io/usb/clients/usbms/usbms.c70
-rw-r--r--usr/src/uts/common/sys/consms.h11
-rw-r--r--usr/src/uts/common/sys/usb/clients/usbms/usbms.h10
4 files changed, 87 insertions, 49 deletions
diff --git a/usr/src/uts/common/io/consms.c b/usr/src/uts/common/io/consms.c
index 2c05c68e63..1077a988e7 100644
--- a/usr/src/uts/common/io/consms.c
+++ b/usr/src/uts/common/io/consms.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -811,46 +810,46 @@ consms_lqs_ack_complete(consms_lq_t *lq, mblk_t *mp)
case LQS_SET_WHEEL_STATE_PENDING:
/*
- * Fifth, issue MSIOSRESOLUTION ioctl
- * to set the screen resolution for absolute mouse.
+ * Fifth, issue MSIOSETPARMS ioctl
+ * to set the parameters for USB mouse.
*/
- req = mkiocb(MSIOSRESOLUTION);
- if (req && ((req->b_cont =
- allocb(sizeof (Ms_screen_resolution),
+ req = mkiocb(MSIOSETPARMS);
+ if (req && ((req->b_cont = allocb(sizeof (Ms_parms),
BPRI_MED)) == NULL)) {
freemsg(req);
req = NULL;
}
if (req) {
- sr =
- (Ms_screen_resolution *)req->b_cont->b_wptr;
- *sr = consms_state.consms_ms_sr;
- req->b_cont->b_wptr +=
- sizeof (Ms_screen_resolution);
+ params = (Ms_parms *)req->b_cont->b_wptr;
+ *params = consms_state.consms_ms_parms;
+ req->b_cont->b_wptr += sizeof (Ms_parms);
}
lq->lq_state++;
break;
- case LQS_SET_RESOLUTION_PENDING:
+ case LQS_SET_PARMS_PENDING:
/*
- * Sixth, issue MSIOSETPARMS ioctl
- * to set the parameters for USB mouse.
+ * Sixth, issue MSIOSRESOLUTION ioctl
+ * to set the screen resolution for absolute mouse.
*/
- req = mkiocb(MSIOSETPARMS);
- if (req && ((req->b_cont = allocb(sizeof (Ms_parms),
+ req = mkiocb(MSIOSRESOLUTION);
+ if (req && ((req->b_cont =
+ allocb(sizeof (Ms_screen_resolution),
BPRI_MED)) == NULL)) {
freemsg(req);
req = NULL;
}
if (req) {
- params = (Ms_parms *)req->b_cont->b_wptr;
- *params = consms_state.consms_ms_parms;
- req->b_cont->b_wptr += sizeof (Ms_parms);
+ sr =
+ (Ms_screen_resolution *)req->b_cont->b_wptr;
+ *sr = consms_state.consms_ms_sr;
+ req->b_cont->b_wptr +=
+ sizeof (Ms_screen_resolution);
}
lq->lq_state++;
break;
- case LQS_SET_PARMS_PENDING:
+ case LQS_SET_RESOLUTION_PENDING:
/*
* All jobs are done, lq->lq_state is turned into
* LQS_DONE, and this lq is added into our list.
diff --git a/usr/src/uts/common/io/usb/clients/usbms/usbms.c b/usr/src/uts/common/io/usb/clients/usbms/usbms.c
index 241510c5af..b88c8d59be 100644
--- a/usr/src/uts/common/io/usb/clients/usbms/usbms.c
+++ b/usr/src/uts/common/io/usb/clients/usbms/usbms.c
@@ -176,6 +176,7 @@ static int usbms_service_wheel_state(
uint_t cmd);
static void usbms_ack_ioctl(mblk_t *);
static int usbms_read_input_data_format(usbms_state_t *);
+static mblk_t *usbms_setup_abs_mouse_event();
static int usbms_get_coordinate(
uint_t pos,
uint_t len,
@@ -1032,6 +1033,8 @@ usbms_ioctl(register queue_t *q,
int err = 0;
mblk_t *datap;
ushort_t transparent = 0;
+ boolean_t report_abs = B_FALSE;
+ mblk_t *mb;
USB_DPRINTF_L3(PRINT_MASK_IOCTL, usbms_log_handle,
"usbms_ioctl entering");
@@ -1268,6 +1271,15 @@ usbms_ioctl(register queue_t *q,
}
datap = mp->b_cont;
err = usbms_get_screen_parms(q, datap);
+ /*
+ * Create the absolute mouse type event.
+ * It is used for the hotplug absolute mouse.
+ */
+ if ((!((usbmsp->usbms_idf).xattr & HID_MAIN_ITEM_RELATIVE)) &&
+ (usbmsp->usbms_rpt_abs == B_FALSE)) {
+ report_abs = B_TRUE;
+ }
+
break;
default:
@@ -1283,6 +1295,14 @@ usbms_ioctl(register queue_t *q,
iocp->ioc_error = 0;
mp->b_datap->db_type = M_IOCACK;
qreply(q, mp);
+
+ if (report_abs == B_TRUE) {
+ /* send the abs mouse type event to the upper level */
+ if ((mb = usbms_setup_abs_mouse_event()) != NULL) {
+ usbmsp->usbms_rpt_abs = B_TRUE;
+ qreply(q, mb);
+ }
+ }
}
return;
@@ -2174,6 +2194,33 @@ usbms_ack_ioctl(mblk_t *mp)
/*
+ * usbms_setup_abs_mouse_event() :
+ * Called from MSIOSRESOLUTION ioctl to create
+ * the absolute mouse type firm event.
+ */
+static mblk_t *
+usbms_setup_abs_mouse_event()
+{
+ mblk_t *mb;
+ Firm_event *fep;
+
+ if ((mb = allocb(sizeof (Firm_event), BPRI_HI)) != NULL) {
+ fep = (Firm_event *)mb->b_wptr;
+ fep->id = MOUSE_TYPE_ABSOLUTE;
+ fep->pair_type = FE_PAIR_NONE;
+ fep->pair = NULL;
+ fep->value = NULL;
+ mb->b_wptr += sizeof (Firm_event);
+ } else {
+ USB_DPRINTF_L3(PRINT_MASK_ALL, usbms_log_handle,
+ "No resource to report ABS mouse event");
+ }
+
+ return (mb);
+}
+
+
+/*
* usbms_read_input_data_format() :
* Get the mouse packet length and usages' length.
* Check whether X and Y are relative or absolute.
@@ -2192,11 +2239,12 @@ usbms_read_input_data_format(usbms_state_t *usbmsp)
uint32_t rptcnt, rptsz;
usbms_idf *idf = &(usbmsp->usbms_idf);
Ms_screen_resolution *res = &(usbmsp->usbms_resolution);
- Firm_event *fep;
mblk_t *mb;
register queue_t *q;
int rval;
+ usbmsp->usbms_rpt_abs = B_FALSE;
+
/* allocate hidparser report structure */
ms_rpt = kmem_zalloc(sizeof (hidparser_rpt_t), KM_SLEEP);
@@ -2334,24 +2382,12 @@ usbms_read_input_data_format(usbms_state_t *usbmsp)
/* The wheel is not supported in current remote kvms. */
usbmsp->usbms_num_wheels = 0;
-
- if ((mb = allocb(sizeof (Firm_event), BPRI_HI)) ==
- NULL) {
-
- return (USB_NO_RESOURCES);
+ q = usbmsp->usbms_rq_ptr;
+ if ((mb = usbms_setup_abs_mouse_event()) != NULL) {
+ putnext(q, mb);
} else {
- /*
- * notify the upper that it is an absolute mouse
- */
- q = usbmsp->usbms_rq_ptr;
- fep = (Firm_event *)mb->b_wptr;
- fep->id = MOUSE_TYPE_ABSOLUTE;
- fep->pair_type = FE_PAIR_NONE;
- fep->pair = NULL;
- fep->value = NULL;
- mb->b_wptr += sizeof (Firm_event);
- putnext(q, mb);
+ return (USB_NO_RESOURCES);
}
}
diff --git a/usr/src/uts/common/sys/consms.h b/usr/src/uts/common/sys/consms.h
index 87594aedfb..7d7e2aa690 100644
--- a/usr/src/uts/common/sys/consms.h
+++ b/usr/src/uts/common/sys/consms.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -57,8 +56,8 @@ typedef enum {
LQS_WHEEL_COUNT_PENDING = 2, /* wait for wheel count ACK */
LQS_SET_VUID_FORMAT_PENDING = 3, /* wait for set format ACK */
LQS_SET_WHEEL_STATE_PENDING = 4, /* wait for wheel state ACK */
- LQS_SET_RESOLUTION_PENDING = 5, /* wait for resolution ACK */
- LQS_SET_PARMS_PENDING = 6, /* wait for parameters ACK */
+ LQS_SET_PARMS_PENDING = 5, /* wait for parameters ACK */
+ LQS_SET_RESOLUTION_PENDING = 6, /* wait for resolution ACK */
LQS_DONE = 7 /* mark end of initialization */
} consms_lq_state_t;
diff --git a/usr/src/uts/common/sys/usb/clients/usbms/usbms.h b/usr/src/uts/common/sys/usb/clients/usbms/usbms.h
index 72a6a19206..82650af674 100644
--- a/usr/src/uts/common/sys/usb/clients/usbms/usbms.h
+++ b/usr/src/uts/common/sys/usb/clients/usbms/usbms.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -144,6 +143,10 @@ typedef struct usbms_state {
Ms_screen_resolution usbms_resolution;
+ /* report the abs mouse event to upper level once */
+
+ boolean_t usbms_rpt_abs;
+
usbms_idf usbms_idf;
struct usbmousebuf *usbms_buf;
} usbms_state_t;
@@ -181,6 +184,7 @@ typedef struct usbms_state {
#define USBMS_WAIT_Y 2 /* Delta Y byte */
#define USBMS_WAIT_WHEEL 3 /* Wheel Byte */
+
/*
* default resolution, 1024x768.
*/