diff options
author | Jaikumar Ganesh <jaikumarg@android.com> | 2011-09-20 16:47:43 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-02-14 11:31:07 -0800 |
commit | d6039d941c408a5db7ba78a178ed7b771503108f (patch) | |
tree | 55d68fc65c61133289f02a02ca9fbe8d73196f85 /drivers/hid | |
parent | f4f47cda9f9543626d5f495f3306e3ba51211b5b (diff) |
HID: magicmouse: Add input_register callback.
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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-magicmouse.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 2ab71758e2e..00acc4ee9d7 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c @@ -387,8 +387,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) { @@ -469,6 +471,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, @@ -521,12 +525,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); @@ -591,6 +589,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) |