wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
input_report_key(input, wacom->tool[0], 1);
input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
+ input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
+ input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127));
input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
case 2:
input_report_key(input, BTN_TOOL_PEN, 1);
input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
+ input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
+ input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
wacom->id[0] = STYLUS_DEVICE_ID;
}
input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
- input_report_abs(input, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
+ input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
+ input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
+ input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6]));
input_report_key(input, BTN_STYLUS, data[1] & 0x02);
input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
return 1;
struct wacom_features *features = &wacom->features;
unsigned char *data = wacom->data;
struct input_dev *input = wacom->input;
- int x, y, prox;
+ int prox;
int rw = 0;
int retval = 0;
break;
}
}
- x = wacom_le16_to_cpu(&data[2]);
- y = wacom_le16_to_cpu(&data[4]);
- input_report_abs(input, ABS_X, x);
- input_report_abs(input, ABS_Y, y);
+ input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
+ input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
if (wacom->tool[0] != BTN_TOOL_MOUSE) {
input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8));
input_report_key(input, BTN_TOUCH, data[1] & 0x01);
input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
} else {
- input_report_abs(input, ABS_X, wacom_be16_to_cpu(&data[2]));
- input_report_abs(input, ABS_Y, wacom_be16_to_cpu(&data[4]));
+ input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[2]));
+ input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[4]));
input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
}
switch (data[0]) {
case WACOM_REPORT_TPC1FG:
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
- input_report_abs(input, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
- input_report_key(input, BTN_TOUCH, wacom_le16_to_cpu(&data[6]));
+ input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
+ input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
+ input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6]));
+ input_report_key(input, BTN_TOUCH, le16_to_cpup((__le16 *)&data[6]));
input_report_abs(input, ABS_MISC, wacom->id[0]);
input_report_key(input, wacom->tool[0], 1);
break;
break;
}
} else {
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[1]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[3]));
+ input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
+ input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
input_report_key(input, BTN_TOUCH, 1);
input_report_abs(input, ABS_MISC, wacom->id[0]);
input_report_key(input, wacom->tool[0], 1);
}
input_report_key(input, BTN_STYLUS, data[1] & 0x02);
input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
- input_report_abs(input, ABS_X, wacom_le16_to_cpu(&data[2]));
- input_report_abs(input, ABS_Y, wacom_le16_to_cpu(&data[4]));
+ input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
+ input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
pressure = ((data[7] & 0x01) << 8) | data[6];
if (pressure < 0)
pressure = features->pressure_max + pressure + 1;