HID: magicmouse: Add input_register callback.
authorJaikumar Ganesh <jaikumarg@android.com>
Tue, 20 Sep 2011 23:47:43 +0000 (16:47 -0700)
committerJaikumar Ganesh <jaikumarg@android.com>
Wed, 21 Sep 2011 20:52:27 +0000 (13:52 -0700)
The magicmouse driver needs to setup the input mapping
after reports are parsed but before device is registered.

Change-Id: Ic3a0ff4fc056f5d374bb7ea1bd831a175c690b0b
Signed-off-by: Jaikumar Ganesh <jaikumarg@android.com>
drivers/hid/hid-magicmouse.c

index 56d0539f2a3e6e986942439a700a0ddfda355b62..c696f7f20e4733d93344e9bc6e3bef57d7506adb 100644 (file)
@@ -365,8 +365,10 @@ static int magicmouse_raw_event(struct hid_device *hdev,
        return 1;
 }
 
-static void magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev)
+static int magicmouse_setup_input(struct hid_device *hdev, struct hid_input *hi)
 {
+       struct input_dev *input = hi->input;
+
        __set_bit(EV_KEY, input->evbit);
 
        if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
@@ -426,6 +428,8 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
                __set_bit(EV_MSC, input->evbit);
                __set_bit(MSC_RAW, input->mscbit);
        }
+
+       return 0;
 }
 
 static int magicmouse_input_mapping(struct hid_device *hdev,
@@ -478,12 +482,6 @@ static int magicmouse_probe(struct hid_device *hdev,
                goto err_free;
        }
 
-       /* We do this after hid-input is done parsing reports so that
-        * hid-input uses the most natural button and axis IDs.
-        */
-       if (msc->input)
-               magicmouse_setup_input(msc->input, hdev);
-
        if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
                report = hid_register_report(hdev, HID_INPUT_REPORT,
                        MOUSE_REPORT_ID);
@@ -548,6 +546,7 @@ static struct hid_driver magicmouse_driver = {
        .remove = magicmouse_remove,
        .raw_event = magicmouse_raw_event,
        .input_mapping = magicmouse_input_mapping,
+       .input_register = magicmouse_setup_input,
 };
 
 static int __init magicmouse_init(void)