Jiri Kosina schrieb:
> We can't just change powerbook_fn_keys[], as that would break other 
> models. These models might possibly need a different table.
I added an powerbook_alternative_fn_keys with that definitions. In hid.h
I added a define for this quirk, called
HID_QUIRK_POWERBOOK_ALTERNATIVE_FN. hid-input.c checks for this and use
the right table.

> As you are obviously able to do C coding, do you think you could prepare 
> fully working and tested patch and send it to me?
macbook3rd.patch implements the above and is working gracefully on my
desktop and my macbook.

appletouch.patch is the patch for the Apple Touchpad driver "appletouch.c"

Regards
  Tobias

PS: Why there are 2 mailing lists: [EMAIL PROTECTED] and
[EMAIL PROTECTED]
--- linux-2.6.24-rc8/include/linux/hid.h        2008-01-17 14:44:36.000000000 
+0100
+++ linux-2.6.24-rc8-twam/include/linux/hid.h   2008-01-17 15:09:37.000000000 
+0100
@@ -281,6 +281,7 @@
 #define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL        0x00400000
 #define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP     0x00800000
 #define HID_QUIRK_IGNORE_HIDINPUT              0x01000000
+#define HID_QUIRK_POWERBOOK_ALTERNATIVE_FN     0x02000000
 
 /*
  * Separate quirks for runtime report descriptor fixup
--- linux-2.6.24-rc8/drivers/hid/usbhid/hid-quirks.c    2008-01-17 
14:44:33.000000000 +0100
+++ linux-2.6.24-rc8-twam/drivers/hid/usbhid/hid-quirks.c       2008-01-17 
16:12:40.000000000 +0100
@@ -59,6 +59,8 @@
 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI       0x021a
 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO        0x021b
 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS        0x021c
+#define USB_DEVICE_ID_APPLE_KEYBOARD_MB100ZA   0x0221
+#define USB_DEVICE_ID_APPLE_KEYBOARD_MACBOOK3  0x022a
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY   0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY    0x030b
 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
@@ -553,6 +555,8 @@
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, 
HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, 
HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
        { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, 
HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_MB100ZA, 
HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | 
HID_QUIRK_POWERBOOK_ISO_KEYBOARD | HID_QUIRK_POWERBOOK_ALTERNATIVE_FN},
+       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_KEYBOARD_MACBOOK3, 
HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | 
HID_QUIRK_POWERBOOK_ISO_KEYBOARD | HID_QUIRK_POWERBOOK_ALTERNATIVE_FN},
 
        { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
        { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, 
HID_QUIRK_RESET_LEDS },
--- linux-2.6.24-rc8/drivers/hid/hid-input.c    2008-01-17 14:44:33.000000000 
+0100
+++ linux-2.6.24-rc8-twam/drivers/hid/hid-input.c       2008-01-17 
15:23:45.000000000 +0100
@@ -119,6 +119,27 @@
        { }
 };
 
+static struct hidinput_key_translation powerbook_alternative_fn_keys[] = {
+       { KEY_BACKSPACE, KEY_DELETE },
+       { KEY_F1,       KEY_BRIGHTNESSDOWN,     POWERBOOK_FLAG_FKEY },
+       { KEY_F2,       KEY_BRIGHTNESSUP,       POWERBOOK_FLAG_FKEY },
+       { KEY_F3,       KEY_PROG1,              POWERBOOK_FLAG_FKEY },
+       { KEY_F4,       KEY_PROG2,              POWERBOOK_FLAG_FKEY },
+       { KEY_F5,       KEY_FN_F5,              POWERBOOK_FLAG_FKEY },
+       { KEY_F6,       KEY_FN_F6,              POWERBOOK_FLAG_FKEY },
+       { KEY_F7,       KEY_BACK,               POWERBOOK_FLAG_FKEY },
+       { KEY_F8,       KEY_PLAY,               POWERBOOK_FLAG_FKEY },
+       { KEY_F9,       KEY_FASTFORWARD,        POWERBOOK_FLAG_FKEY },
+       { KEY_F10,      KEY_MUTE,               POWERBOOK_FLAG_FKEY },
+       { KEY_F11,      KEY_VOLUMEDOWN,         POWERBOOK_FLAG_FKEY },
+       { KEY_F12,      KEY_VOLUMEUP,           POWERBOOK_FLAG_FKEY },
+       { KEY_UP,       KEY_PAGEUP },
+       { KEY_DOWN,     KEY_PAGEDOWN },
+       { KEY_LEFT,     KEY_HOME },
+       { KEY_RIGHT,    KEY_END },
+       { }
+};
+
 static struct hidinput_key_translation powerbook_numlock_keys[] = {
        { KEY_J,        KEY_KP1 },
        { KEY_K,        KEY_KP2 },
@@ -177,7 +198,12 @@
        if (hid_pb_fnmode) {
                int do_translate;
 
-               trans = find_translation(powerbook_fn_keys, usage->code);
+               if (hid->quirks & HID_QUIRK_POWERBOOK_ALTERNATIVE_FN) {
+                       trans = find_translation(powerbook_alternative_fn_keys, 
usage->code);
+               } else {        
+                       trans = find_translation(powerbook_fn_keys, 
usage->code);
+               }
+
                if (trans) {
                        if (test_bit(usage->code, hid->pb_pressed_fn))
                                do_translate = 1;
@@ -238,6 +264,9 @@
        for (trans = powerbook_fn_keys; trans->from; trans++)
                set_bit(trans->to, input->keybit);
 
+       for (trans = powerbook_alternative_fn_keys; trans->from; trans++)
+               set_bit(trans->to, input->keybit);
+
        for (trans = powerbook_numlock_keys; trans->from; trans++)
                set_bit(trans->to, input->keybit);
 
--- linux-2.6.24-rc8/drivers/input/mouse/appletouch.c   2008-01-17 
14:44:33.000000000 +0100
+++ linux-2.6.24-rc8-twam/drivers/input/mouse/appletouch.c      2008-01-17 
15:32:31.000000000 +0100
@@ -62,6 +62,9 @@
 #define GEYSER4_ISO_PRODUCT_ID 0x021B
 #define GEYSER4_JIS_PRODUCT_ID 0x021C
 
+/* 3rd Generation MacBook */
+#define GEYSER5_ISO_PRODUCT_ID 0x022A
+
 #define ATP_DEVICE(prod)                                       \
        .match_flags = USB_DEVICE_ID_MATCH_DEVICE |             \
                       USB_DEVICE_ID_MATCH_INT_CLASS |          \
@@ -92,6 +95,7 @@
        { ATP_DEVICE(GEYSER4_ANSI_PRODUCT_ID) },
        { ATP_DEVICE(GEYSER4_ISO_PRODUCT_ID) },
        { ATP_DEVICE(GEYSER4_JIS_PRODUCT_ID) },
+       { ATP_DEVICE(GEYSER5_ISO_PRODUCT_ID) },
 
        /* Terminating entry */
        { }
@@ -217,7 +221,8 @@
                (productId == GEYSER3_JIS_PRODUCT_ID) ||
                (productId == GEYSER4_ANSI_PRODUCT_ID) ||
                (productId == GEYSER4_ISO_PRODUCT_ID) ||
-               (productId == GEYSER4_JIS_PRODUCT_ID);
+               (productId == GEYSER4_JIS_PRODUCT_ID) ||
+               (productId == GEYSER5_ISO_PRODUCT_ID);
 }
 
 /*

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to