Commit 882aba01 authored by Jiri Kosina's avatar Jiri Kosina

Merge branches 'upstream-fixes' and 'magicmouse' into for-linus

...@@ -277,6 +277,7 @@ ...@@ -277,6 +277,7 @@
#define USB_DEVICE_ID_PENPOWER 0x00f4 #define USB_DEVICE_ID_PENPOWER 0x00f4
#define USB_VENDOR_ID_GREENASIA 0x0e8f #define USB_VENDOR_ID_GREENASIA 0x0e8f
#define USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD 0x3013
#define USB_VENDOR_ID_GRETAGMACBETH 0x0971 #define USB_VENDOR_ID_GRETAGMACBETH 0x0971
#define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005 #define USB_DEVICE_ID_GRETAGMACBETH_HUEY 0x2005
......
...@@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie ...@@ -81,6 +81,28 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie
#define NO_TOUCHES -1 #define NO_TOUCHES -1
#define SINGLE_TOUCH_UP -2 #define SINGLE_TOUCH_UP -2
/* Touch surface information. Dimension is in hundredths of a mm, min and max
* are in units. */
#define MOUSE_DIMENSION_X (float)9056
#define MOUSE_MIN_X -1100
#define MOUSE_MAX_X 1258
#define MOUSE_RES_X ((MOUSE_MAX_X - MOUSE_MIN_X) / (MOUSE_DIMENSION_X / 100))
#define MOUSE_DIMENSION_Y (float)5152
#define MOUSE_MIN_Y -1589
#define MOUSE_MAX_Y 2047
#define MOUSE_RES_Y ((MOUSE_MAX_Y - MOUSE_MIN_Y) / (MOUSE_DIMENSION_Y / 100))
#define TRACKPAD_DIMENSION_X (float)13000
#define TRACKPAD_MIN_X -2909
#define TRACKPAD_MAX_X 3167
#define TRACKPAD_RES_X \
((TRACKPAD_MAX_X - TRACKPAD_MIN_X) / (TRACKPAD_DIMENSION_X / 100))
#define TRACKPAD_DIMENSION_Y (float)11000
#define TRACKPAD_MIN_Y -2456
#define TRACKPAD_MAX_Y 2565
#define TRACKPAD_RES_Y \
((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
/** /**
* struct magicmouse_sc - Tracks Magic Mouse-specific data. * struct magicmouse_sc - Tracks Magic Mouse-specific data.
* @input: Input device through which we report events. * @input: Input device through which we report events.
...@@ -406,17 +428,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h ...@@ -406,17 +428,31 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
* inverse of the reported Y. * inverse of the reported Y.
*/ */
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
input_set_abs_params(input, ABS_MT_POSITION_X, -1100, input_set_abs_params(input, ABS_MT_POSITION_X,
1358, 4, 0); MOUSE_MIN_X, MOUSE_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, input_set_abs_params(input, ABS_MT_POSITION_Y,
2047, 4, 0); MOUSE_MIN_Y, MOUSE_MAX_Y, 4, 0);
input_abs_set_res(input, ABS_MT_POSITION_X,
MOUSE_RES_X);
input_abs_set_res(input, ABS_MT_POSITION_Y,
MOUSE_RES_Y);
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0); input_set_abs_params(input, ABS_X, TRACKPAD_MIN_X,
input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0); TRACKPAD_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_X, -2909, input_set_abs_params(input, ABS_Y, TRACKPAD_MIN_Y,
3167, 4, 0); TRACKPAD_MAX_Y, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, input_set_abs_params(input, ABS_MT_POSITION_X,
2565, 4, 0); TRACKPAD_MIN_X, TRACKPAD_MAX_X, 4, 0);
input_set_abs_params(input, ABS_MT_POSITION_Y,
TRACKPAD_MIN_Y, TRACKPAD_MAX_Y, 4, 0);
input_abs_set_res(input, ABS_X, TRACKPAD_RES_X);
input_abs_set_res(input, ABS_Y, TRACKPAD_RES_Y);
input_abs_set_res(input, ABS_MT_POSITION_X,
TRACKPAD_RES_X);
input_abs_set_res(input, ABS_MT_POSITION_Y,
TRACKPAD_RES_Y);
} }
input_set_events_per_packet(input, 60); input_set_events_per_packet(input, 60);
...@@ -501,9 +537,17 @@ static int magicmouse_probe(struct hid_device *hdev, ...@@ -501,9 +537,17 @@ static int magicmouse_probe(struct hid_device *hdev,
} }
report->size = 6; report->size = 6;
/*
* Some devices repond with 'invalid report id' when feature
* report switching it into multitouch mode is sent to it.
*
* This results in -EIO from the _raw low-level transport callback,
* but there seems to be no other way of switching the mode.
* Thus the super-ugly hacky success check below.
*/
ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature),
HID_FEATURE_REPORT); HID_FEATURE_REPORT);
if (ret != sizeof(feature)) { if (ret != -EIO && ret != sizeof(feature)) {
hid_err(hdev, "unable to request touch data (%d)\n", ret); hid_err(hdev, "unable to request touch data (%d)\n", ret);
goto err_stop_hw; goto err_stop_hw;
} }
......
...@@ -353,11 +353,7 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -353,11 +353,7 @@ static int wacom_probe(struct hid_device *hdev,
if (ret) { if (ret) {
hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
ret); ret);
/* goto err_battery;
* battery attribute is not critical for the tablet, but if it
* failed then there is no need to create ac attribute
*/
goto move_on;
} }
wdata->ac.properties = wacom_ac_props; wdata->ac.properties = wacom_ac_props;
...@@ -371,14 +367,8 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -371,14 +367,8 @@ static int wacom_probe(struct hid_device *hdev,
if (ret) { if (ret) {
hid_warn(hdev, hid_warn(hdev,
"can't create ac battery attribute, err: %d\n", ret); "can't create ac battery attribute, err: %d\n", ret);
/* goto err_ac;
* ac attribute is not critical for the tablet, but if it
* failed then we don't want to battery attribute to exist
*/
power_supply_unregister(&wdata->battery);
} }
move_on:
#endif #endif
hidinput = list_entry(hdev->inputs.next, struct hid_input, list); hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
input = hidinput->input; input = hidinput->input;
...@@ -416,6 +406,13 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -416,6 +406,13 @@ static int wacom_probe(struct hid_device *hdev,
return 0; return 0;
#ifdef CONFIG_HID_WACOM_POWER_SUPPLY
err_ac:
power_supply_unregister(&wdata->battery);
err_battery:
device_remove_file(&hdev->dev, &dev_attr_speed);
hid_hw_stop(hdev);
#endif
err_free: err_free:
kfree(wdata); kfree(wdata);
return ret; return ret;
...@@ -426,6 +423,7 @@ static void wacom_remove(struct hid_device *hdev) ...@@ -426,6 +423,7 @@ static void wacom_remove(struct hid_device *hdev)
#ifdef CONFIG_HID_WACOM_POWER_SUPPLY #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
struct wacom_data *wdata = hid_get_drvdata(hdev); struct wacom_data *wdata = hid_get_drvdata(hdev);
#endif #endif
device_remove_file(&hdev->dev, &dev_attr_speed);
hid_hw_stop(hdev); hid_hw_stop(hdev);
#ifdef CONFIG_HID_WACOM_POWER_SUPPLY #ifdef CONFIG_HID_WACOM_POWER_SUPPLY
......
...@@ -47,6 +47,7 @@ static const struct hid_blacklist { ...@@ -47,6 +47,7 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL }, { USB_VENDOR_ID_AFATECH, USB_DEVICE_ID_AFATECH_AF9016, HID_QUIRK_FULLSPEED_INTERVAL },
{ USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH, HID_QUIRK_MULTI_INPUT },
{ USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT },
{ USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
{ USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
{ USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment