@@ -700,6 +700,54 @@
};
MODULE_DEVICE_TABLE(hid, magic_mice);
+static int magicmouse_hdev_resume(struct hid_device *hdev)
+{
+ int ret;
+ int feature_size;
+ u8 *buf;
+ const u8 *feature;
+ const u8 feature_mt[] = { 0xD7, 0x01 };
+ const u8 feature_mt_trackpad2_usb[] = { 0x02, 0x01 };
+ const u8 feature_mt_trackpad2_bt[] = { 0xF1, 0x02, 0x01 };
+
+ if (hdev->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+ if (hdev->vendor == BT_VENDOR_ID_APPLE) {
+ feature_size = sizeof(feature_mt_trackpad2_bt);
+ feature = feature_mt_trackpad2_bt;
+ } else { /* USB_VENDOR_ID_APPLE */
+ feature_size = sizeof(feature_mt_trackpad2_usb);
+ feature = feature_mt_trackpad2_usb;
+ }
+ } else {
+ feature_size = sizeof(feature_mt);
+ feature = feature_mt;
+ }
+
+ buf = kmemdup(feature, feature_size, GFP_KERNEL);
+ if (!buf) {
+ ret = -ENOMEM;
+ goto err_stop_hw;
+ }
+
+ ret = hid_hw_raw_request(hdev, buf[0], buf, feature_size,
+ HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
+ kfree(buf);
+ if (ret != -EIO && ret != feature_size) {
+ hid_err(hdev, "unable to request touch data (%d)\n", ret);
+ goto err_stop_hw;
+ }
+ return 0;
+ err_stop_hw:
+ hid_hw_stop(hdev);
+ return ret;
+ }
+
+static int magicmouse_hdev_suspend(
+ struct hid_device *hdev,
+ struct pm_message ignored
+){
+ return 0;
+}
static struct hid_driver magicmouse_driver = {
.name = "magicmouse",
.id_table = magic_mice,
@@ -707,6 +755,8 @@
.raw_event = magicmouse_raw_event,
.input_mapping = magicmouse_input_mapping,
.input_configured = magicmouse_input_configured,
+ .reset_resume = magicmouse_hdev_resume,
+ .suspend = magicmouse_hdev_suspend,
};
module_hid_driver(magicmouse_driver);