Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183083
b: refs/heads/master
c: b45d44e
h: refs/heads/master
i:
  183081: d248483
  183079: 8a2853c
v: v3
  • Loading branch information
Nicolas Léveillé authored and Dmitry Torokhov committed Dec 30, 2009
1 parent 05380d4 commit 3bc1a5b
Show file tree
Hide file tree
Showing 35 changed files with 522 additions and 711 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 197d4db752e67160d79fed09968c2140376a80a3
refs/heads/master: b45d44e7e00c1726dac9437b66c05d3d27acb3f0
48 changes: 8 additions & 40 deletions trunk/Documentation/input/multi-touch-protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,12 @@ set of events/packets.

A set of ABS_MT events with the desired properties is defined. The events
are divided into categories, to allow for partial implementation. The
minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which
allows for multiple fingers to be tracked. If the device supports it, the
ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size
of the contact area and approaching finger, respectively.

The TOUCH and WIDTH parameters have a geometrical interpretation; imagine
looking through a window at someone gently holding a finger against the
glass. You will see two regions, one inner region consisting of the part
of the finger actually touching the glass, and one outer region formed by
the perimeter of the finger. The diameter of the inner region is the
ABS_MT_TOUCH_MAJOR, the diameter of the outer region is
ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger harder
against the glass. The inner region will increase, and in general, the
ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller than
unity, is related to the finger pressure. For pressure-based devices,
ABS_MT_PRESSURE may be used to provide the pressure on the contact area
instead.

In addition to the MAJOR parameters, the oval shape of the finger can be
described by adding the MINOR parameters, such that MAJOR and MINOR are the
major and minor axis of an ellipse. Finally, the orientation of the oval
shape can be describe with the ORIENTATION parameter.

The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
minimum set consists of ABS_MT_TOUCH_MAJOR, ABS_MT_POSITION_X and
ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked. If the
device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide the size
of the approaching finger. Anisotropy and direction may be specified with
ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and ABS_MT_ORIENTATION. The
ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
finger or a pen or something else. Devices with more granular information
may specify general shapes as blobs, i.e., as a sequence of rectangular
shapes grouped together by an ABS_MT_BLOB_ID. Finally, for the few devices
Expand All @@ -60,9 +42,11 @@ report finger tracking from hardware [5].
Here is what a minimal event sequence for a two-finger touch would look
like:

ABS_MT_TOUCH_MAJOR
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
SYN_MT_REPORT
ABS_MT_TOUCH_MAJOR
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
SYN_MT_REPORT
Expand Down Expand Up @@ -103,12 +87,6 @@ the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
the notion of pressure. The fingers of the hand and the palm all have
different characteristic widths [1].

ABS_MT_PRESSURE

The pressure, in arbitrary units, on the contact area. May be used instead
of TOUCH and WIDTH for pressure-based devices or any device with a spatial
signal intensity distribution.

ABS_MT_ORIENTATION

The orientation of the ellipse. The value should describe a signed quarter
Expand Down Expand Up @@ -192,16 +170,6 @@ There are a few devices that support trackingID in hardware. User space can
make use of these native identifiers to reduce bandwidth and cpu usage.


Gestures
--------

In the specific application of creating gesture events, the TOUCH and WIDTH
parameters can be used to, e.g., approximate finger pressure or distinguish
between index finger and thumb. With the addition of the MINOR parameters,
one can also distinguish between a sweeping finger and a pointing finger,
and with ORIENTATION, one can detect twisting of fingers.


Notes
-----

Expand Down
1 change: 0 additions & 1 deletion trunk/arch/arm/mach-davinci/include/mach/keyscan.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ enum davinci_matrix_types {
};

struct davinci_ks_platform_data {
int (*device_enable)(struct device *dev);
unsigned short *keymap;
u32 keymapsize;
u8 rep:1;
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ static void evdev_pass_event(struct evdev_client *client,
client->head &= EVDEV_BUFFER_SIZE - 1;
spin_unlock(&client->buffer_lock);

if (event->type == EV_SYN)
kill_fasync(&client->fasync, SIGIO, POLL_IN);
kill_fasync(&client->fasync, SIGIO, POLL_IN);
}

/*
Expand Down
48 changes: 7 additions & 41 deletions trunk/drivers/input/ff-memless.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,28 +220,12 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
return 0;
}

/*
* Only left/right direction should be used (under/over 0x8000) for
* forward/reverse motor direction (to keep calculation fast & simple).
*/
static u16 ml_calculate_direction(u16 direction, u16 force,
u16 new_direction, u16 new_force)
{
if (!force)
return new_direction;
if (!new_force)
return direction;
return (((u32)(direction >> 1) * force +
(new_direction >> 1) * new_force) /
(force + new_force)) << 1;
}

/*
* Combine two effects and apply gain.
*/
static void ml_combine_effects(struct ff_effect *effect,
struct ml_effect_state *state,
int gain)
unsigned int gain)
{
struct ff_effect *new = state->effect;
unsigned int strong, weak, i;
Expand All @@ -268,21 +252,8 @@ static void ml_combine_effects(struct ff_effect *effect,
break;

case FF_RUMBLE:
strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;

if (effect->u.rumble.strong_magnitude + strong)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.strong_magnitude,
new->direction, strong);
else if (effect->u.rumble.weak_magnitude + weak)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.weak_magnitude,
new->direction, weak);
else
effect->direction = 0;
strong = new->u.rumble.strong_magnitude * gain / 0xffff;
weak = new->u.rumble.weak_magnitude * gain / 0xffff;
effect->u.rumble.strong_magnitude =
min(strong + effect->u.rumble.strong_magnitude,
0xffffU);
Expand All @@ -297,13 +268,6 @@ static void ml_combine_effects(struct ff_effect *effect,
/* here we also scale it 0x7fff => 0xffff */
i = i * gain / 0x7fff;

if (effect->u.rumble.strong_magnitude + i)
effect->direction = ml_calculate_direction(
effect->direction,
effect->u.rumble.strong_magnitude,
new->direction, i);
else
effect->direction = 0;
effect->u.rumble.strong_magnitude =
min(i + effect->u.rumble.strong_magnitude, 0xffffU);
effect->u.rumble.weak_magnitude =
Expand Down Expand Up @@ -447,16 +411,18 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
msecs_to_jiffies(state->effect->replay.length);
state->adj_at = state->play_at;

ml_schedule_timer(ml);

} else {
debug("initiated stop");

if (test_bit(FF_EFFECT_PLAYING, &state->flags))
__set_bit(FF_EFFECT_ABORTING, &state->flags);
else
__clear_bit(FF_EFFECT_STARTED, &state->flags);
}

ml_play_effects(ml);
ml_play_effects(ml);
}

return 0;
}
Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/input/input-polldev.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@ static void input_close_polled_device(struct input_dev *input)
struct input_polled_dev *dev = input_get_drvdata(input);

cancel_delayed_work_sync(&dev->work);
/*
* Clean up work struct to remove references to the workqueue.
* It may be destroyed by the next call. This causes problems
* at next device open-close in case of poll_interval == 0.
*/
INIT_DELAYED_WORK(&dev->work, dev->work.work.func);
input_polldev_stop_workqueue();

if (dev->close)
Expand Down
87 changes: 15 additions & 72 deletions trunk/drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <linux/mutex.h>
#include <linux/rcupdate.h>
#include <linux/smp_lock.h>
#include "input-compat.h"

MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("Input core");
Expand All @@ -46,7 +45,6 @@ static unsigned int input_abs_bypass_init_data[] __initdata = {
ABS_MT_TOOL_TYPE,
ABS_MT_BLOB_ID,
ABS_MT_TRACKING_ID,
ABS_MT_PRESSURE,
0
};
static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)];
Expand Down Expand Up @@ -766,40 +764,6 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
return error;
}

#ifdef CONFIG_COMPAT

static int input_bits_to_string(char *buf, int buf_size,
unsigned long bits, bool skip_empty)
{
int len = 0;

if (INPUT_COMPAT_TEST) {
u32 dword = bits >> 32;
if (dword || !skip_empty)
len += snprintf(buf, buf_size, "%x ", dword);

dword = bits & 0xffffffffUL;
if (dword || !skip_empty || len)
len += snprintf(buf + len, max(buf_size - len, 0),
"%x", dword);
} else {
if (bits || !skip_empty)
len += snprintf(buf, buf_size, "%lx", bits);
}

return len;
}

#else /* !CONFIG_COMPAT */

static int input_bits_to_string(char *buf, int buf_size,
unsigned long bits, bool skip_empty)
{
return bits || !skip_empty ?
snprintf(buf, buf_size, "%lx", bits) : 0;
}

#endif

#ifdef CONFIG_PROC_FS

Expand Down Expand Up @@ -868,25 +832,14 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
unsigned long *bitmap, int max)
{
int i;
bool skip_empty = true;
char buf[18];

seq_printf(seq, "B: %s=", name);

for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
if (input_bits_to_string(buf, sizeof(buf),
bitmap[i], skip_empty)) {
skip_empty = false;
seq_printf(seq, "%s%s", buf, i > 0 ? " " : "");
}
}

/*
* If no output was produced print a single 0.
*/
if (skip_empty)
seq_puts(seq, "0");
for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
if (bitmap[i])
break;

seq_printf(seq, "B: %s=", name);
for (; i >= 0; i--)
seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : "");
seq_putc(seq, '\n');
}

Expand Down Expand Up @@ -1175,23 +1128,14 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
{
int i;
int len = 0;
bool skip_empty = true;

for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
len += input_bits_to_string(buf + len, max(buf_size - len, 0),
bitmap[i], skip_empty);
if (len) {
skip_empty = false;
if (i > 0)
len += snprintf(buf + len, max(buf_size - len, 0), " ");
}
}

/*
* If no output was produced print a single 0.
*/
if (len == 0)
len = snprintf(buf, buf_size, "%d", 0);
for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
if (bitmap[i])
break;

for (; i >= 0; i--)
len += snprintf(buf + len, max(buf_size - len, 0),
"%lx%s", bitmap[i], i > 0 ? " " : "");

if (add_cr)
len += snprintf(buf + len, max(buf_size - len, 0), "\n");
Expand All @@ -1206,8 +1150,7 @@ static ssize_t input_dev_show_cap_##bm(struct device *dev, \
{ \
struct input_dev *input_dev = to_input_dev(dev); \
int len = input_print_bitmap(buf, PAGE_SIZE, \
input_dev->bm##bit, ev##_MAX, \
true); \
input_dev->bm##bit, ev##_MAX, 1); \
return min_t(int, len, PAGE_SIZE); \
} \
static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL)
Expand Down Expand Up @@ -1271,7 +1214,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env,

len = input_print_bitmap(&env->buf[env->buflen - 1],
sizeof(env->buf) - env->buflen,
bitmap, max, false);
bitmap, max, 0);
if (len >= (sizeof(env->buf) - env->buflen))
return -ENOMEM;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/input/joystick/gf2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
}

#ifdef RESET_WORKS
if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) &&
if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) ||
(gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) {
err = -ENODEV;
goto fail2;
Expand Down
Loading

0 comments on commit 3bc1a5b

Please sign in to comment.