mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
12 Commits
release/25
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf887a2b7c | ||
|
|
1cc0651e1b | ||
|
|
48a747ea86 | ||
|
|
aa58eb6096 | ||
|
|
aff7228d97 | ||
|
|
c695234c5c | ||
|
|
79d4956add | ||
|
|
7e9809837c | ||
|
|
d07692a4af | ||
|
|
1073cd4fdc | ||
|
|
486bbdc481 | ||
|
|
73e5eba8cd |
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
2.1.99.1,
|
2.2.2,
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
xf86-input-evdev)
|
xf86-input-evdev)
|
||||||
|
|
||||||
|
|||||||
77
src/evdev.c
77
src/evdev.c
@@ -263,8 +263,17 @@ PostKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
|||||||
static char warned[KEY_CNT];
|
static char warned[KEY_CNT];
|
||||||
|
|
||||||
/* Filter all repeated events from device.
|
/* Filter all repeated events from device.
|
||||||
We'll do softrepeat in the server */
|
We'll do softrepeat in the server, but only since 1.6 */
|
||||||
if (value == 2)
|
if (value == 2
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) <= 2
|
||||||
|
&& (ev->code == KEY_LEFTCTRL || ev->code == KEY_RIGHTCTRL ||
|
||||||
|
ev->code == KEY_LEFTSHIFT || ev->code == KEY_RIGHTSHIFT ||
|
||||||
|
ev->code == KEY_LEFTALT || ev->code == KEY_RIGHTALT ||
|
||||||
|
ev->code == KEY_LEFTMETA || ev->code == KEY_RIGHTMETA ||
|
||||||
|
ev->code == KEY_CAPSLOCK || ev->code == KEY_NUMLOCK ||
|
||||||
|
ev->code == KEY_SCROLLLOCK) /* XXX windows keys? */
|
||||||
|
#endif
|
||||||
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (code > 255)
|
if (code > 255)
|
||||||
@@ -333,6 +342,9 @@ EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
|||||||
return 100; /* come back in 100 ms */
|
return 100; /* come back in 100 ms */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ABS_X_VALUE 0x1
|
||||||
|
#define ABS_Y_VALUE 0x2
|
||||||
|
#define ABS_VALUE 0x4
|
||||||
/**
|
/**
|
||||||
* Take one input event and process it accordingly.
|
* Take one input event and process it accordingly.
|
||||||
*/
|
*/
|
||||||
@@ -383,7 +395,12 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
|
|||||||
if (ev->code > ABS_MAX)
|
if (ev->code > ABS_MAX)
|
||||||
break;
|
break;
|
||||||
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
|
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
|
||||||
abs = 1;
|
if (ev->code == ABS_X)
|
||||||
|
abs |= ABS_X_VALUE;
|
||||||
|
else if (ev->code == ABS_Y)
|
||||||
|
abs |= ABS_Y_VALUE;
|
||||||
|
else
|
||||||
|
abs |= ABS_VALUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_KEY:
|
case EV_KEY:
|
||||||
@@ -434,17 +451,20 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
|
|||||||
case EV_SYN:
|
case EV_SYN:
|
||||||
/* convert to relative motion for touchpads */
|
/* convert to relative motion for touchpads */
|
||||||
if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
|
if (abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
|
||||||
abs = 0;
|
|
||||||
if (pEvdev->tool) { /* meaning, touch is active */
|
if (pEvdev->tool) { /* meaning, touch is active */
|
||||||
if (pEvdev->old_vals[0] != -1)
|
if (pEvdev->old_vals[0] != -1)
|
||||||
delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
|
delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
|
||||||
if (pEvdev->old_vals[1] != -1)
|
if (pEvdev->old_vals[1] != -1)
|
||||||
delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
|
delta[REL_Y] = pEvdev->vals[1] - pEvdev->old_vals[1];
|
||||||
pEvdev->old_vals[0] = pEvdev->vals[0];
|
if (abs & ABS_X_VALUE)
|
||||||
pEvdev->old_vals[1] = pEvdev->vals[1];
|
pEvdev->old_vals[0] = pEvdev->vals[0];
|
||||||
|
if (abs & ABS_Y_VALUE)
|
||||||
|
pEvdev->old_vals[1] = pEvdev->vals[1];
|
||||||
} else {
|
} else {
|
||||||
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
|
pEvdev->old_vals[0] = pEvdev->old_vals[1] = -1;
|
||||||
}
|
}
|
||||||
|
abs = 0;
|
||||||
|
rel = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rel) {
|
if (rel) {
|
||||||
@@ -527,6 +547,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef ABS_X_VALUE
|
||||||
|
#undef ABS_Y_VALUE
|
||||||
|
#undef ABS_VALUE
|
||||||
|
|
||||||
/* just a magic number to reduce the number of reads */
|
/* just a magic number to reduce the number of reads */
|
||||||
#define NUM_EVENTS 16
|
#define NUM_EVENTS 16
|
||||||
|
|
||||||
@@ -540,25 +564,32 @@ EvdevReadInput(InputInfoPtr pInfo)
|
|||||||
while (len == sizeof(ev))
|
while (len == sizeof(ev))
|
||||||
{
|
{
|
||||||
len = read(pInfo->fd, &ev, sizeof(ev));
|
len = read(pInfo->fd, &ev, sizeof(ev));
|
||||||
if (len == 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
if (errno == ENODEV) /* May happen after resume */
|
if (errno == ENODEV) /* May happen after resume */
|
||||||
{
|
{
|
||||||
xf86RemoveEnabledDevice(pInfo);
|
xf86RemoveEnabledDevice(pInfo);
|
||||||
close(pInfo->fd);
|
close(pInfo->fd);
|
||||||
pInfo->fd = -1;
|
pInfo->fd = -1;
|
||||||
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
if (pEvdev->reopen_timer)
|
||||||
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
{
|
||||||
|
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||||
|
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
|
||||||
|
}
|
||||||
} else if (errno != EAGAIN)
|
} else if (errno != EAGAIN)
|
||||||
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name,
|
{
|
||||||
|
/* We use X_NONE here because it doesn't alloc */
|
||||||
|
xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The kernel promises that we always only read a complete
|
||||||
|
* event, so len != sizeof ev is an error. */
|
||||||
if (len % sizeof(ev[0])) {
|
if (len % sizeof(ev[0])) {
|
||||||
/* The kernel promises that we always only read a complete
|
/* We use X_NONE here because it doesn't alloc */
|
||||||
* event, so len != sizeof ev is an error. */
|
xf86MsgVerb(X_NONE, 0, "%s: Read error: %s\n", pInfo->name, strerror(errno));
|
||||||
xf86Msg(X_ERROR, "%s: Read error: %s\n", pInfo->name, strerror(errno));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,12 +1157,17 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
|
|||||||
static int
|
static int
|
||||||
EvdevInit(DeviceIntPtr device)
|
EvdevInit(DeviceIntPtr device)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
InputInfoPtr pInfo;
|
InputInfoPtr pInfo;
|
||||||
EvdevPtr pEvdev;
|
EvdevPtr pEvdev;
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
pInfo = device->public.devicePrivate;
|
||||||
pEvdev = pInfo->private;
|
pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
/* clear all axis_map entries */
|
||||||
|
for(i = 0; i < max(ABS_CNT,REL_CNT); i++)
|
||||||
|
pEvdev->axis_map[i]=-1;
|
||||||
|
|
||||||
if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS)
|
if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS)
|
||||||
EvdevAddKeyClass(device);
|
EvdevAddKeyClass(device);
|
||||||
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
|
||||||
@@ -1197,7 +1233,7 @@ EvdevOn(DeviceIntPtr device)
|
|||||||
if (pInfo->fd == -1)
|
if (pInfo->fd == -1)
|
||||||
{
|
{
|
||||||
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||||
pEvdev->reopen_timer = TimerSet(NULL, 0, 100, EvdevReopenTimer, pInfo);
|
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
|
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
|
||||||
@@ -1208,6 +1244,8 @@ EvdevOn(DeviceIntPtr device)
|
|||||||
return !Success;
|
return !Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 0, NULL, NULL);
|
||||||
|
|
||||||
xf86FlushInput(pInfo->fd);
|
xf86FlushInput(pInfo->fd);
|
||||||
xf86AddEnabledDevice(pInfo);
|
xf86AddEnabledDevice(pInfo);
|
||||||
EvdevMBEmuOn(pInfo);
|
EvdevMBEmuOn(pInfo);
|
||||||
@@ -1462,9 +1500,9 @@ EvdevProbe(InputInfoPtr pInfo)
|
|||||||
TestBit(ABS_Y, pEvdev->abs_bitmask)) {
|
TestBit(ABS_Y, pEvdev->abs_bitmask)) {
|
||||||
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
|
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
|
||||||
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
|
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
|
||||||
if (!TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) &&
|
if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
|
||||||
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
|
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
|
||||||
if (num_buttons) {
|
if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
|
||||||
xf86Msg(X_INFO, "%s: Found absolute touchpad\n", pInfo->name);
|
xf86Msg(X_INFO, "%s: Found absolute touchpad\n", pInfo->name);
|
||||||
pEvdev->flags |= EVDEV_TOUCHPAD;
|
pEvdev->flags |= EVDEV_TOUCHPAD;
|
||||||
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
|
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
|
||||||
@@ -1490,7 +1528,10 @@ EvdevProbe(InputInfoPtr pInfo)
|
|||||||
if (has_axes && num_buttons) {
|
if (has_axes && num_buttons) {
|
||||||
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
|
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
|
||||||
XI86_CONFIGURED;
|
XI86_CONFIGURED;
|
||||||
if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
|
if (pEvdev->flags & EVDEV_TOUCHPAD) {
|
||||||
|
xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
|
||||||
|
pInfo->type_name = XI_TOUCHPAD;
|
||||||
|
} else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
|
||||||
xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name);
|
xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name);
|
||||||
pInfo->type_name = XI_TABLET;
|
pInfo->type_name = XI_TABLET;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user