Index: sys/dev/hid/bcm5974.c =================================================================== --- sys/dev/hid/bcm5974.c +++ sys/dev/hid/bcm5974.c @@ -691,29 +691,44 @@ for (i = 0, slot = 0; i != ntouch; i++) { f = (struct tp_finger *)(((uint8_t *)data) + params->tp->offset + params->tp->delta + i * fsize); + /* swap endianness, if any (note: these are SIGNED, do not inline le16toh) */ + if (le16toh(0x1234) != 0x1234) { + f->origin = le16toh((uint16_t)f->origin); + f->abs_x = le16toh((uint16_t)f->abs_x); + f->abs_y = le16toh((uint16_t)f->abs_y); + f->rel_x = le16toh((uint16_t)f->rel_x); + f->rel_y = le16toh((uint16_t)f->rel_y); + f->tool_major = le16toh((uint16_t)f->tool_major); + f->tool_minor = le16toh((uint16_t)f->tool_minor); + f->orientation = le16toh((uint16_t)f->orientation); + f->touch_major = le16toh((uint16_t)f->touch_major); + f->touch_minor = le16toh((uint16_t)f->touch_minor); + f->pressure = le16toh((uint16_t)f->pressure); + f->multi = le16toh((uint16_t)f->multi); + } DPRINTFN(BCM5974_LLEVEL_INFO, "[%d]ibt=%d, taps=%d, o=%4d, ax=%5d, ay=%5d, " "rx=%5d, ry=%5d, tlmaj=%4d, tlmin=%4d, ot=%4x, " - "tchmaj=%4d, tchmin=%4d, presure=%4d, m=%4x\n", - i, ibt, ntouch, le16toh(f->origin), le16toh(f->abs_x), - le16toh(f->abs_y), le16toh(f->rel_x), le16toh(f->rel_y), - le16toh(f->tool_major), le16toh(f->tool_minor), - le16toh(f->orientation), le16toh(f->touch_major), - le16toh(f->touch_minor), le16toh(f->pressure), - le16toh(f->multi)); + "tchmaj=%4d, tchmin=%4d, pressure=%4d, m=%4x\n", + i, ibt, ntouch, f->origin, f->abs_x, + f->abs_y, f->rel_x, f->rel_y, + f->tool_major, f->tool_minor, + f->orientation, f->touch_major, + f->touch_minor, f->pressure, + f->multi); if (f->touch_major == 0) continue; slot_data = (union evdev_mt_slot) { .id = slot, - .x = le16toh(f->abs_x), - .y = params->y.min + params->y.max - le16toh(f->abs_y), - .p = le16toh(f->pressure), - .maj = le16toh(f->touch_major) << 1, - .min = le16toh(f->touch_minor) << 1, - .w_maj = le16toh(f->tool_major) << 1, - .w_min = le16toh(f->tool_minor) << 1, - .ori = params->o.max - le16toh(f->orientation), + .x = f->abs_x, + .y = params->y.min + params->y.max - f->abs_y, + .p = f->pressure, + .maj = f->touch_major << 1, + .min = f->touch_minor << 1, + .w_maj = f->tool_major << 1, + .w_min = f->tool_minor << 1, + .ori = params->o.max - f->orientation, }; evdev_mt_push_slot(sc->sc_evdev, slot, &slot_data); slot++;