On Sat, Nov 27, 2010 at 03:39:02PM -0800, Dmitry Torokhov wrote: > On Sat, Nov 27, 2010 at 12:46:03PM +0300, Nikolai Kondrashov wrote: > > On 11/27/2010 12:15 PM, Dmitry Torokhov wrote: > > >2000LPI == about 79 l/mm. How is it not useable? > > TBH, I didn't make any real calculations. > > The introduced error isn't very high, indeed. The vertical size of 4x3 inch > > tablet becomes 75 mm instead of 76 mm. So maybe it's alright. > > > > >In mainline synaptics is the only one that does this. We do not know how > > >many drivers in vendor trees fill and use this data nor we do not know > > >about userspace. The fact that we were not able to locate them does not > > >mean they do not exist. The units/mm are part of input ABI now. > > Well, I can't argue with you here. > > I didn't think about 3rd party drivers, TBH. > > > > >Right, standarize on existing UOM (which are per/mm) and then implement > > >other UOM if theya re really needed. > > Will this fix qualify for inclusion into 2.6.37? > > Yes, I believe it does. > Does the following work by any chance? Thanks. -- Dmitry HID: length resolution should be reported units/mm From: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> Input ABI requires reporting resolution on main axes in units per millimeter, not units per inch, so we need to convert accordingly. Signed-off-by: Dmitry Torokhov <dtor@xxxxxxx> --- drivers/hid/hid-input.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index c9c90de..5cde845 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -203,8 +203,8 @@ static int hidinput_setkeycode(struct input_dev *dev, * * as seen in the HID specification v1.11 6.2.2.7 Global Items. * - * Only exponent 1 length units are processed. Centimeters are converted to - * inches. Degrees are converted to radians. + * Only exponent 1 length units are processed. Centimeters and inches are + * converted to millimeters. Degrees are converted to radians. */ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) { @@ -225,13 +225,16 @@ static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) */ if (code == ABS_X || code == ABS_Y || code == ABS_Z) { if (field->unit == 0x11) { /* If centimeters */ - /* Convert to inches */ - prev = logical_extents; - logical_extents *= 254; - if (logical_extents < prev) + /* Convert to millimeters */ + unit_exponent += 1; + } else if (field->unit == 0x13) { /* If inches */ + /* Convert to millimeters */ + prev = physical_extents; + physical_extents *= 254; + if (physical_extents < prev) return 0; - unit_exponent += 2; - } else if (field->unit != 0x13) { /* If not inches */ + unit_exponent -= 1; + } else { return 0; } } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html