Commit 473912f5 authored by Peter Osterlund's avatar Peter Osterlund

Add a config option to prevent the driver from grabbing the event

device for exclusive use.
parent 1b258685
......@@ -72,7 +72,7 @@ ALPS_initialize(int fd)
}
static void
ALPSDeviceOnHook(LocalDevicePtr local)
ALPSDeviceOnHook(LocalDevicePtr local, SynapticsSHM *para)
{
}
......
......@@ -41,14 +41,16 @@
****************************************************************************/
static void
EventDeviceOnHook(LocalDevicePtr local)
EventDeviceOnHook(LocalDevicePtr local, SynapticsSHM *para)
{
/* Try to grab the event device so that data don't leak to /dev/input/mice */
int ret;
SYSCALL(ret = ioctl(local->fd, EVIOCGRAB, (pointer)1));
if (ret < 0) {
xf86Msg(X_WARNING, "%s can't grab event device, errno=%d\n",
local->name, errno);
if (para->grab_event_device) {
/* Try to grab the event device so that data don't leak to /dev/input/mice */
int ret;
SYSCALL(ret = ioctl(local->fd, EVIOCGRAB, (pointer)1));
if (ret < 0) {
xf86Msg(X_WARNING, "%s can't grab event device, errno=%d\n",
local->name, errno);
}
}
}
......
......@@ -324,6 +324,26 @@ Coasting threshold scrolling speed.
.TP
\fBSingleTapTimeout\fR (Integer)
Timeout after a tap to recognize it as a single tap.
.TP
\fBGrabEventDevice\fR (Bool)
If GrabEventDevice is true, the driver will grab the event device for
exclusive use when using the linux 2.6 event protocol.
.
When using other protocols, this option has no effect.
.
Grabbing the event device means that no other user space or kernel
space program sees the touchpad events.
.
This is desirable if the X config file includes /dev/input/mice as an
input device, but is undesirable if you want to monitor the device
from user space.
.
When changing this parameter with the synclient program, the change
will not take effect until the synaptics driver is disabled and
reenabled.
.
This can be achieved by switching to a text console and then switching
back to X.
.
.
.LP
......
......@@ -433,7 +433,7 @@ ps2_print_ident(const struct SynapticsHwInfo *synhw)
static void
PS2DeviceOnHook(LocalDevicePtr local)
PS2DeviceOnHook(LocalDevicePtr local, SynapticsSHM* para)
{
}
......
......@@ -89,7 +89,7 @@ PSMQueryIsSynaptics(LocalDevicePtr local)
}
static void
PSMDeviceOnHook(LocalDevicePtr local)
PSMDeviceOnHook(LocalDevicePtr local, SynapticsSHM *para)
{
}
......
......@@ -430,6 +430,7 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
pars->coasting_speed = synSetFloatOption(opts, "CoastingSpeed", 0.0);
pars->press_motion_min_factor = synSetFloatOption(opts, "PressureMotionMinFactor", 1.0);
pars->press_motion_max_factor = synSetFloatOption(opts, "PressureMotionMaxFactor", 1.0);
pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE);
/* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
if (pars->top_edge > pars->bottom_edge) {
......@@ -555,7 +556,7 @@ DeviceOn(DeviceIntPtr dev)
return !Success;
}
priv->proto_ops->DeviceOnHook(local);
priv->proto_ops->DeviceOnHook(local, priv->synpara);
priv->comm.buffer = XisbNew(local->fd, 64);
if (!priv->comm.buffer) {
......
......@@ -100,6 +100,7 @@ typedef struct _SynapticsSHM
int press_motion_max_z; /* finger pressure at which maximum pressure motion factor is applied */
double press_motion_min_factor; /* factor applied on speed when finger pressure is at minimum */
double press_motion_max_factor; /* factor applied on speed when finger pressure is at minimum */
Bool grab_event_device; /* grab event device for exclusive use? */
} SynapticsSHM;
/*
......
......@@ -105,7 +105,8 @@ static struct Parameter params[] = {
DEFINE_PAR("PressureMotionMinZ", press_motion_min_z, PT_INT, 1, 255),
DEFINE_PAR("PressureMotionMaxZ", press_motion_max_z, PT_INT, 1, 255),
DEFINE_PAR("PressureMotionMinFactor", press_motion_min_factor, PT_DOUBLE, 0, 10.0),
DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 0, 10.0),
DEFINE_PAR("PressureMotionMaxFactor", press_motion_max_factor, PT_DOUBLE, 0, 10.0),
DEFINE_PAR("GrabEventDevice", grab_event_device, PT_BOOL, 0, 1),
{ 0, 0, 0, 0, 0 }
};
......
......@@ -72,11 +72,12 @@ enum SynapticsProtocol {
SYN_PROTO_ALPS /* ALPS touchpad protocol */
};
struct _SynapticsSHM;
struct SynapticsHwInfo;
struct CommData;
struct SynapticsProtocolOperations {
void (*DeviceOnHook)(LocalDevicePtr local);
void (*DeviceOnHook)(LocalDevicePtr local, struct _SynapticsSHM *para);
void (*DeviceOffHook)(LocalDevicePtr local);
Bool (*QueryHardware)(LocalDevicePtr local, struct SynapticsHwInfo *synhw);
Bool (*ReadHwState)(LocalDevicePtr local, struct SynapticsHwInfo *synhw,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment