Linux:Apple Wireless A1314 Fn 鍵未註冊,看起來像軟體錯誤

Linux:Apple Wireless A1314 Fn 鍵未註冊,看起來像軟體錯誤

我正在嘗試使用我的 Kubuntu 系統來設定我的 Apple 無線鍵盤。這些是分別由 Intel Atom 和 Intel i5 提供支援的 PC 硬體。鍵盤採用美式鍵盤佈局,背面寫著型號 A1314。它需要兩顆 AA 電池。我這麼說是因為 A1314 型號似乎有多種類型。

我在 10.04、11.04、11.10 和 12.04 系統上嘗試過此操作,但沒有成功。每次使用藍牙轉接器和 KDE 藍牙通知托盤小程式時,都可以連接鍵盤。在這兩種情況下,它都顯示為“Apple Wireless Keyboard”。

幾乎一切都按預期進行,事實上,我現在正在打字。但有一件事沒有:Fn 鍵。我想使用 Fn + 向下箭頭作為 PgDn / Page Down,我知道這是 Apple 鍵盤上的預設行為。當然,我希望 Page Up、Home 和 End 也能如此。在我的範例中,我將堅持使用 Page Down。

我使用 xev 工具查看系統接收到的鍵碼,如果我按 Fn,則不會發生任何事情,也不會註冊任何內容。如果我按 Fn + 向下箭頭,xev 僅記錄向下箭頭。下面是我的 11.04 系統的輸出來說明:

僅按 Fn 鍵:無輸出

按下向下箭頭鍵:KeyPress 事件,序列36,合成NO,視窗0x4400001,根0x15d,子w 0x4400002,時間2699773,(44,45),根:(1352,298),狀態0x10,鍵碼116(keysym 0xff54,向下), same_screen YES, XLookupString 給出 0 個位元組: XmbLookupString 給定 0 個位元組: XFilterEvent 回傳: False

KeyRelease event, serial 36, synthetic NO, window 0x4400001,
    root 0x15d, subw 0x4400002, time 2699860, (44,45), root:(1352,298),
    state 0x10, keycode 116 (keysym 0xff54, Down), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

同時按下 Fn+向下箭頭鍵:

KeyPress event, serial 36, synthetic NO, window 0x4400001,
    root 0x15d, subw 0x4400002, time 2701548, (44,45), root:(1352,298),
    state 0x10, keycode 116 (keysym 0xff54, Down), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x4400001,
    root 0x15d, subw 0x4400002, time 2701623, (44,45), root:(1352,298),
    state 0x10, keycode 116 (keysym 0xff54, Down), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

我已經在這個論壇和其他 Linux 相關論壇中搜尋了幾個小時,但仍然沒有找到解決方案。我主要找到了有關如何在使用實際的蘋果筆記型電腦或桌上型電腦時解決此問題的建議,但我沒有。他們說嘗試如下

echo 2 > /sys/module/hid_apple/ ...但由於我的系統上沒有 hid_apple 目錄,所以我需要先這樣做modprobe hid_apple。那也沒有幫助。

我很樂意更改一些配置文件,或者在必要時編譯我自己的修補內核。

我目前有 10.04 和 12.04 系統可供測試。

連接到 Windows 7 時也會出現相同的問題。透過一些 AutoHotkey 擺弄,我能夠確認該鍵已註冊為按下狀態,但預設會被忽略。自訂 AutoHotkey 腳本可以解決這個問題。但 AutoHotkey 僅適用於 Windows,我希望在 Linux 上解決我的問題。

連接到 iPad 2 時,它只能與 F1-F12 鍵結合使用。不是用箭頭鍵。如果 ipad 的螢幕關閉,而我只按 Fn 鍵,螢幕就會亮起,因此該鍵本身會被註冊為按下。

總結一下我的問題:當我需要使用目前未註冊的 Fn 鍵時,任何人都可以幫助我在這個鍵盤上使用 Page Up、Page Down、Home 和 End 嗎?

2012 年 7 月 4 日編輯:仍然沒有運氣。我以為 KDE 可能會幹擾某些東西,但在 XFCE 中問題仍然存在。

以下是 Syslog 的一些輸出:

Jul  4 13:15:31 comp kernel: [ 1561.377849] usb 1-1.4: new full-speed USB device number 8 using ehci_hcd
Jul  4 13:15:31 comp kernel: [ 1561.449864] usb 1-1.4: device descriptor read/64, error -32
Jul  4 13:15:31 comp kernel: [ 1561.629402] usb 1-1.4: device descriptor read/64, error -32
Jul  4 13:15:32 comp kernel: [ 1561.805100] usb 1-1.4: new full-speed USB device number 9 using ehci_hcd
Jul  4 13:15:32 comp bluetoothd[911]: HCI dev 0 registered
Jul  4 13:15:32 comp bluetoothd[911]: Listening for HCI events on hci0
Jul  4 13:15:33 comp bluetoothd[911]: HCI dev 0 up
Jul  4 13:15:33 comp bluetoothd[911]: Adapter /org/bluez/911/hci0 has been enabled
Jul  4 13:15:44 comp kernel: [ 1573.712323] input: Apple Wireless Keyboard as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:42/input8
Jul  4 13:15:44 comp kernel: [ 1573.712569] generic-bluetooth 0005:05AC:0255.0006: input,hidraw3: BLUETOOTH HID v0.50 Keyboard [Apple Wireless Keyboard] on 00:09:DD:50:75:A1

答案1

我終於可以使用 fn 鍵了!我必須編譯自己的核心模組才能做到這一點。我想我可以用更簡單的方式解決它,但這就是我所做的:

我發現了這個錯誤:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/942184

該頁面上發布的第一個補丁有我的解決方案:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/942184/+attachment/2788714/+files/alu2011.patch

然後我按照文章繼續修補和修改我的模組並首先發表評論 http://www.codewhirl.com/2012/04/how-to-compile-a-single-module-in-ubuntu-linux/

我沒有應用整個補丁,只應用了USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSIID 為 0x0255 的行,因為我得到的核心原始碼中缺少這個 ID。我嘗試這樣做是因為我之前註意到系統日誌中的數字 0255:generic-bluetooth 0005:05AC:0255.0006: input,hi...

我不太明白我是怎麼做到的,但它確實有效!

這是一些 Xev 輸出,按下左箭頭鍵,先使用 fn 鍵,然後不使用 fn 鍵:

KeyPress event, serial 34, synthetic NO, window 0x3000001,
    root 0x15d, subw 0x3000002, time 1502136, (40,28), root:(1235,427),
    state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x3000001,
    root 0x15d, subw 0x3000002, time 1502635, (40,28), root:(1235,427),
    state 0x0, keycode 110 (keysym 0xff50, Home), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 34, synthetic NO, window 0x3000001,
    root 0x15d, subw 0x3000002, time 1504023, (40,28), root:(1235,427),
    state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 34, synthetic NO, window 0x3000001,
    root 0x15d, subw 0x3000002, time 1504235, (40,28), root:(1235,427),
    state 0x0, keycode 113 (keysym 0xff51, Left), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Fn 鍵沒有註冊為單獨的鍵,我可以使用 xmodmapping 進行有趣的操作,但這足以實現我的目標,透過重新映射幾個鍵將蘋果鍵盤變成類似駭客的鍵盤。

看來這都是已知的錯誤:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/911064

答案2

我的鍵盤也是一樣的。這是我針對 Linux 核心 3.4 製作的補丁,以使「fn」鍵運作。

diff -aur linux-3.4.pristine/drivers/hid/hid-apple.c linux-3.4.new/drivers/hid/hid-apple.c
--- linux-3.4.pristine/drivers/hid/hid-apple.c  2012-07-15 04:45:54.489209371 -0300
+++ linux-3.4.new/drivers/hid/hid-apple.c   2012-07-15 04:41:46.986193078 -0300
@@ -455,6 +455,8 @@
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO),
        .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
            APPLE_ISO_KEYBOARD },
+   { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
+       .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO),
        .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
            APPLE_ISO_KEYBOARD },
diff -aur linux-3.4.pristine/drivers/hid/hid-core.c linux-3.4.new/drivers/hid/hid-core.c
--- linux-3.4.pristine/drivers/hid/hid-core.c   2012-07-15 04:45:54.489209371 -0300
+++ linux-3.4.new/drivers/hid/hid-core.c    2012-07-15 04:41:46.986193078 -0300
@@ -1382,6 +1382,7 @@
    { 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) },
+   { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
    { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
    { 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) },

相關內容