Linux:Apple Wireless A1314 Fn 键未注册,看起来像软件错误

ram*_*ank 5 linux bluetooth apple

我正在尝试使用我的 Kubuntu 系统设置我的 Apple 无线键盘。这些是分别由英特尔凌动和英特尔 i5 驱动的 PC 硬件。键盘采用美式键盘布局,背面写有型号 A1314。它需要两节 AA 电池。我这么说是因为看起来有多种类型的 A1314。

我已经在 10.04、11.04、11.10 和 12.04 系统上尝试过这个,但没有成功。每次使用蓝牙加密狗和KDE蓝牙通知托盘小程序,都可以连接键盘。在这两种情况下,它都显示为“Apple 无线键盘”。

几乎一切都按预期工作,事实上,我现在正在打字。但有一件事没有:Fn 键。我想使用 Fn + 向下箭头作为 PgDn / Page Down,我知道这是 Apple 键盘上的默认行为。当然,我希望 Page Up、Home 和 End 也是如此。在我的示例中,我将坚持使用 Page Down。

我使用 xev 工具查看系统接收到的键码,如果我按下 Fn 没有任何反应,也没有注册任何内容。如果我按 Fn + 向下箭头, xev 只会注册向下箭头。这是我的 11.04 系统的输出来说明:

只按 Fn 键:无输出

按向下箭头键:KeyPress 事件,串行 36,合成 NO,窗口 0x4400001,root 0x15d,subw 0x4400002,时间 2699773,(44,45),root:(1352,298),状态 0x10,keycode 10xff54sym ), 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
Run Code Online (Sandbox Code Playgroud)

同时按下 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
Run Code Online (Sandbox Code Playgroud)

我已经在这个论坛和其他与 Linux 相关的论坛上搜索了几个小时,但我仍然没有找到解决方案。在使用实际的苹果笔记本电脑或台式机时,我主要找到了有关如何解决此问题的建议,但我没有。他们说要尝试以下操作

echo 2 > /sys/module/hid_apple/ ...但是由于我的系统上没有 hid_apple 目录,所以我需要modprobe hid_apple先。那也没有帮助。

如果有必要,我很乐意更改一些配置文件,或者编译我自己的补丁内核。

我目前有一个 10.04 和 12.04 系统可供测试。

连接到 Windows 7 时也会出现同样的问题。 Fn 键仍然没有任何作用,它本身或与其他键的组合都不起作用。通过一些 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
Run Code Online (Sandbox Code Playgroud)

ram*_*ank 2

我终于可以使用 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/上发表评论

我没有应用整个补丁,只应用了 ID 为 0x0255 的行USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI,因为我得到的内核源代码中缺少这个 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
Run Code Online (Sandbox Code Playgroud)

Fn 键没有注册为单独的键,我可以使用 xmodmapping 进行有趣的操作,但这对于我的目标来说已经足够了,通过重新映射几个键将苹果键盘变成一个快乐的黑客键盘。

看来这都是一个已知的错误:https://bugs.launchpad.net/ubuntu/+source/linux/+bug/911064