diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-03-09 23:05:04 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-03-09 23:05:04 +0100 |
| commit | 82370112d36f1d70916e4ccd94a901f0d11f72ea (patch) | |
| tree | f109b1077a66932efeedafeea3a17624c35f4f23 /usr/src/dkms_source_tree/hid-apple.c | |
| parent | 190861c304f308f624bbd0f97840f72aeff19de7 (diff) | |
Update to natty (2.6.38-5)
Diffstat (limited to 'usr/src/dkms_source_tree/hid-apple.c')
| -rw-r--r-- | usr/src/dkms_source_tree/hid-apple.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/usr/src/dkms_source_tree/hid-apple.c b/usr/src/dkms_source_tree/hid-apple.c index 9a5f485..61aa712 100644 --- a/usr/src/dkms_source_tree/hid-apple.c +++ b/usr/src/dkms_source_tree/hid-apple.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | * any later version. | 16 | * any later version. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 20 | |||
| 19 | #include <linux/device.h> | 21 | #include <linux/device.h> |
| 20 | #include <linux/hid.h> | 22 | #include <linux/hid.h> |
| 21 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| @@ -167,7 +169,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
| 167 | struct hid_usage *usage, __s32 value) | 169 | struct hid_usage *usage, __s32 value) |
| 168 | { | 170 | { |
| 169 | struct apple_sc *asc = hid_get_drvdata(hid); | 171 | struct apple_sc *asc = hid_get_drvdata(hid); |
| 170 | const struct apple_key_translation *trans; | 172 | const struct apple_key_translation *trans, *table; |
| 171 | 173 | ||
| 172 | if (usage->code == KEY_FN) { | 174 | if (usage->code == KEY_FN) { |
| 173 | asc->fn_on = !!value; | 175 | asc->fn_on = !!value; |
| @@ -178,14 +180,16 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, | |||
| 178 | if (fnmode) { | 180 | if (fnmode) { |
| 179 | int do_translate; | 181 | int do_translate; |
| 180 | 182 | ||
| 181 | if(hid->product >= 0x023f && hid->product <= 0x0244 ) { | 183 | if (hid->product >= USB_DEVICE_ID_APPLE_WELLSPRING4_ANSI && |
| 182 | trans = apple_find_translation(macbookair_fn_keys, usage->code); | 184 | hid->product <= USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS) |
| 183 | } else { | 185 | table = macbookair_fn_keys; |
| 184 | trans = apple_find_translation((hid->product < 0x21d || | 186 | else if (hid->product < 0x21d || hid->product >= 0x300) |
| 185 | hid->product >= 0x300) ? | 187 | table = powerbook_fn_keys; |
| 186 | powerbook_fn_keys : apple_fn_keys, | 188 | else |
| 187 | usage->code); | 189 | table = apple_fn_keys; |
| 188 | } | 190 | |
| 191 | trans = apple_find_translation (table, usage->code); | ||
| 192 | |||
| 189 | if (trans) { | 193 | if (trans) { |
| 190 | if (test_bit(usage->code, asc->pressed_fn)) | 194 | if (test_bit(usage->code, asc->pressed_fn)) |
| 191 | do_translate = 1; | 195 | do_translate = 1; |
| @@ -278,8 +282,8 @@ static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
| 278 | 282 | ||
| 279 | if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && | 283 | if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && |
| 280 | rdesc[53] == 0x65 && rdesc[59] == 0x65) { | 284 | rdesc[53] == 0x65 && rdesc[59] == 0x65) { |
| 281 | dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " | 285 | hid_info(hdev, |
| 282 | "descriptor\n"); | 286 | "fixing up MacBook JIS keyboard report descriptor\n"); |
| 283 | rdesc[53] = rdesc[59] = 0xe7; | 287 | rdesc[53] = rdesc[59] = 0xe7; |
| 284 | } | 288 | } |
| 285 | return rdesc; | 289 | return rdesc; |
| @@ -349,7 +353,7 @@ static int apple_probe(struct hid_device *hdev, | |||
| 349 | 353 | ||
| 350 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); | 354 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); |
| 351 | if (asc == NULL) { | 355 | if (asc == NULL) { |
| 352 | dev_err(&hdev->dev, "can't alloc apple descriptor\n"); | 356 | hid_err(hdev, "can't alloc apple descriptor\n"); |
| 353 | return -ENOMEM; | 357 | return -ENOMEM; |
| 354 | } | 358 | } |
| 355 | 359 | ||
| @@ -359,7 +363,7 @@ static int apple_probe(struct hid_device *hdev, | |||
| 359 | 363 | ||
| 360 | ret = hid_parse(hdev); | 364 | ret = hid_parse(hdev); |
| 361 | if (ret) { | 365 | if (ret) { |
| 362 | dev_err(&hdev->dev, "parse failed\n"); | 366 | hid_err(hdev, "parse failed\n"); |
| 363 | goto err_free; | 367 | goto err_free; |
| 364 | } | 368 | } |
| 365 | 369 | ||
| @@ -370,7 +374,7 @@ static int apple_probe(struct hid_device *hdev, | |||
| 370 | 374 | ||
| 371 | ret = hid_hw_start(hdev, connect_mask); | 375 | ret = hid_hw_start(hdev, connect_mask); |
| 372 | if (ret) { | 376 | if (ret) { |
| 373 | dev_err(&hdev->dev, "hw start failed\n"); | 377 | hid_err(hdev, "hw start failed\n"); |
| 374 | goto err_free; | 378 | goto err_free; |
| 375 | } | 379 | } |
| 376 | 380 | ||
| @@ -510,7 +514,7 @@ static int __init apple_init(void) | |||
| 510 | 514 | ||
| 511 | ret = hid_register_driver(&apple_driver); | 515 | ret = hid_register_driver(&apple_driver); |
| 512 | if (ret) | 516 | if (ret) |
| 513 | printk(KERN_ERR "can't register apple driver\n"); | 517 | pr_err("can't register apple driver\n"); |
| 514 | 518 | ||
| 515 | return ret; | 519 | return ret; |
| 516 | } | 520 | } |
