lkml.org 
[lkml]   [2012]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[34-longterm 158/196] HID: add MacBookAir 3,1 and 3,2 support
    Date
    From: "Edgar (gimli) Hucek" <gimli@dark-green.com>

    -------------------
    This is a commit scheduled for the next v2.6.34 longterm release.
    If you see a problem with using this for longterm, please comment.
    -------------------

    commit 99b9f758bbc904f22faffcf4d83205f4a5e7bc0c upstream.

    This patch add support for the MacBookAir3,1 and MacBookAir3,2 to the hid
    driver.

    Signed-off-by: Edgar (gimli) Hucek <gimli@dark-green.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    ---
    drivers/hid/hid-apple.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
    drivers/hid/hid-core.c | 12 ++++++++++++
    drivers/hid/hid-ids.h | 6 ++++++
    3 files changed, 60 insertions(+), 4 deletions(-)

    diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
    index bba05d0..1a2bb2a 100644
    --- a/drivers/hid/hid-apple.c
    +++ b/drivers/hid/hid-apple.c
    @@ -59,6 +59,27 @@ struct apple_key_translation {
    u8 flags;
    };

    +static const struct apple_key_translation macbookair_fn_keys[] = {
    + { KEY_BACKSPACE, KEY_DELETE },
    + { KEY_ENTER, KEY_INSERT },
    + { KEY_F1, KEY_BRIGHTNESSDOWN, APPLE_FLAG_FKEY },
    + { KEY_F2, KEY_BRIGHTNESSUP, APPLE_FLAG_FKEY },
    + { KEY_F3, KEY_SCALE, APPLE_FLAG_FKEY },
    + { KEY_F4, KEY_DASHBOARD, APPLE_FLAG_FKEY },
    + { KEY_F6, KEY_PREVIOUSSONG, APPLE_FLAG_FKEY },
    + { KEY_F7, KEY_PLAYPAUSE, APPLE_FLAG_FKEY },
    + { KEY_F8, KEY_NEXTSONG, APPLE_FLAG_FKEY },
    + { KEY_F9, KEY_MUTE, APPLE_FLAG_FKEY },
    + { KEY_F10, KEY_VOLUMEDOWN, APPLE_FLAG_FKEY },
    + { KEY_F11, KEY_VOLUMEUP, APPLE_FLAG_FKEY },
    + { KEY_F12, KEY_EJECTCD, APPLE_FLAG_FKEY },
    + { KEY_UP, KEY_PAGEUP },
    + { KEY_DOWN, KEY_PAGEDOWN },
    + { KEY_LEFT, KEY_HOME },
    + { KEY_RIGHT, KEY_END },
    + { }
    +};
    +
    static const struct apple_key_translation apple_fn_keys[] = {
    { KEY_BACKSPACE, KEY_DELETE },
    { KEY_ENTER, KEY_INSERT },
    @@ -157,10 +178,15 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
    if (fnmode) {
    int do_translate;

    - trans = apple_find_translation((hid->product < 0x21d ||
    - hid->product >= 0x300) ?
    - powerbook_fn_keys : apple_fn_keys,
    - usage->code);
    + if(hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI &&
    + hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) {
    + trans = apple_find_translation(macbookair_fn_keys, usage->code);
    + } else if (hid->product < 0x21d || hid->product >= 0x300) {
    + trans = apple_find_translation(powerbook_fn_keys, usage->code);
    + } else {
    + trans = apple_find_translation(apple_fn_keys, usage->code);
    + }
    +
    if (trans) {
    if (test_bit(usage->code, asc->pressed_fn))
    do_translate = 1;
    @@ -439,6 +465,18 @@ static const struct hid_device_id apple_devices[] = {
    .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
    .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI),
    + .driver_data = APPLE_HAS_FN },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO),
    + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS),
    + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI),
    + .driver_data = APPLE_HAS_FN },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO),
    + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS),
    + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
    .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
    diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
    index 0010efa..07ddda5 100644
    --- a/drivers/hid/hid-core.c
    +++ b/drivers/hid/hid-core.c
    @@ -1284,6 +1284,12 @@ static const struct hid_device_id hid_blacklist[] = {
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
    @@ -1715,6 +1721,12 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_ISO) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4_JIS) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO) },
    + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
    { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
    { }
    diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
    index b681cbf..fe054d6 100644
    --- a/drivers/hid/hid-ids.h
    +++ b/drivers/hid/hid-ids.h
    @@ -92,6 +92,12 @@
    #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
    #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
    #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI 0x023f
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4_ISO 0x0240
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4_JIS 0x0241
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ANSI 0x0242
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_ISO 0x0243
    +#define USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS 0x0244
    #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
    #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
    #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
    --
    1.7.9.3


    \
     
     \ /
      Last update: 2012-03-13 01:27    [W:0.032 / U:0.032 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site