“UbuntuHelp:AppleKeyboard”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第4行: | 第4行: | ||
Since Ubuntu 8.04 (Hardy Heron) the USB aluminium Apple Keyboard has not worked correctly. A change was added to the Ubuntu Linux kernel to make Apple [[UbuntuHelp:MacBook|MacBook]] keyboards gain additional functionality to their limited laptop style keyboard (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/162083 #162083]). Unfortunately this code change has some side effects for owners of the full size USB aluminium Apple Keyboard: | Since Ubuntu 8.04 (Hardy Heron) the USB aluminium Apple Keyboard has not worked correctly. A change was added to the Ubuntu Linux kernel to make Apple [[UbuntuHelp:MacBook|MacBook]] keyboards gain additional functionality to their limited laptop style keyboard (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/162083 #162083]). Unfortunately this code change has some side effects for owners of the full size USB aluminium Apple Keyboard: | ||
* Function keys have media functions as default. The "fn" key must be pressed and held to access the F-key functionality (except F5 and F6, which are inverted in this respect). (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/201711 #201711]) | * Function keys have media functions as default. The "fn" key must be pressed and held to access the F-key functionality (except F5 and F6, which are inverted in this respect). (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/201711 #201711]) | ||
− | |||
* Two keys are swapped on international (non-US) keyboard with respect to the printing on the keycaps. (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786 #214786]) | * Two keys are swapped on international (non-US) keyboard with respect to the printing on the keycaps. (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786 #214786]) | ||
− | * Bug | + | * Num lock key will when pressed render the keyboard seemingly unusable. The keyboard will simulate a numeric keypad on the alphabet keys. Pressing F6 twice will exit this mode. (Ubuntu bug [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/201887 #201887]) '''(This has been fixed)''' |
+ | * Bug filed in the main kernel bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=10818. Please help if you think that the kernel developers are wrong, assuming that the keyboard have to behave like under MacOS. | ||
+ | https://help.ubuntu.com/community/AppleKeyboard?action=AttachFile&do=get&target=a+AppleKeyboard0220.jpg | ||
+ | == Default Behavior == | ||
+ | This section describe the default behavior of every Apple keyboard. | ||
+ | === Apple slim aluminium keyboard (0220) === | ||
+ | https://help.ubuntu.com/community/AppleKeyboard?action=AttachFile&do=get&target=wired_1_20070813a.jpg | ||
+ | * 'fn'+'Enter' -> Insert | ||
+ | * 'fn'+'Backspace' -> Delete | ||
+ | * 'fn'+'Up' -> PageUp | ||
+ | * 'fn'+'Down' -> PageDown | ||
+ | * 'fn'+'Left' -> Home | ||
+ | * 'fn'+'Right' -> End | ||
+ | * 'Clear' behave like '[[UbuntuHelp:NumLock|NumLock]]' | ||
+ | (See [https://bugs.launchpad.net/bugs/262408 #262408] as there is patch submit to map F13, F14 and F15 to PrintScreen, ScrollLock and Pause.) | ||
== Corrections == | == Corrections == | ||
− | === | + | === Change Function Key behavior === |
− | * Edit the file '''/etc/modprobe.d/options''', e.g.: | + | This section of the document describe how to change the behavior of 'fn' key to better match what user expect. (See [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/201711 #201711], [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/162083 #162083]) |
+ | Here a description of each behavior : | ||
+ | * 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8' | ||
+ | * 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8. | ||
+ | * 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause). | ||
+ | ==== Ubuntu 9.04 (Jaunty Jakalope) ==== | ||
+ | ===== Temporarily ===== | ||
+ | This section describe how to change the behavior of 'fn' with immediate effect (Restarting will reset the configuration). | ||
+ | Execute the following commands to change the fnmode parameters. See section above for a description of available value. | ||
+ | <pre><nowiki> | ||
+ | $ sudo bash | ||
+ | # echo 2 > /sys/module/hid_apple/parameters/fnmode | ||
+ | # exit | ||
+ | </nowiki></pre> | ||
+ | ===== Permanently ===== | ||
+ | This section describe how to change the behavior of 'fn' permanently. There is many way to proceed with this modification. Each sub section describe one way to permanently change the configuration. | ||
+ | ====== With .conf file (Recommended) ====== | ||
+ | 1. Edit or create the file '''/etc/modprobe.d/hid_apple.conf''', e.g.: | ||
+ | |||
+ | <pre><nowiki> | ||
+ | sudo gedit /etc/modprobe.d/hid_apple.conf | ||
+ | </nowiki></pre> | ||
+ | 2. Add this line to the previously open file. | ||
+ | |||
+ | <pre><nowiki> | ||
+ | options hid_apple fnmode=2 | ||
+ | </nowiki></pre> | ||
+ | 3. Save the file and execute the following command to notify hid_apple module to reload it's configuration. | ||
+ | |||
+ | <pre><nowiki> | ||
+ | sudo update-initramfs -u | ||
+ | </nowiki></pre> | ||
+ | 4. Reboot | ||
+ | |||
+ | ====== With rc.local ====== | ||
+ | 1. Edit the '''/etc/rc.local''' file. | ||
+ | |||
+ | <pre><nowiki> | ||
+ | sudo gedit /etc/rc.local | ||
+ | </nowiki></pre> | ||
+ | 2. Add this line near the end of the file, before the "exit" line: | ||
+ | |||
+ | <pre><nowiki> | ||
+ | echo 2 > /sys/module/hid_apple/parameters/fnmode | ||
+ | </nowiki></pre> | ||
+ | 3. Reboot | ||
+ | |||
+ | ====== With sysfs.conf ====== | ||
+ | 1. Edit the '''/etc/sysfs.conf''' file. | ||
+ | |||
+ | <pre><nowiki> | ||
+ | sudo gedit /etc/sysfs.conf | ||
+ | </nowiki></pre> | ||
+ | 2. Add this lines to the end of the file. | ||
+ | |||
+ | <pre><nowiki> | ||
+ | module/hid_apple/parameters/fnmode = 2 | ||
+ | </nowiki></pre> | ||
+ | 3. Reboot | ||
+ | |||
+ | ==== Ubuntu 8.10 (Intrepid Ibex) ==== | ||
+ | ===== Temporarily ===== | ||
+ | With immediate effect, try | ||
+ | <pre><nowiki> | ||
+ | sudo bash | ||
+ | echo 2 > /sys/module/hid/parameters/pb_fnmode | ||
+ | exit | ||
+ | </nowiki></pre> | ||
+ | ===== Permanently ===== | ||
+ | 1. Edit the file '''/etc/modprobe.d/options''', e.g.: | ||
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo gedit /etc/modprobe.d/options | sudo gedit /etc/modprobe.d/options | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | 2. Add the line: | |
− | + | ||
+ | <pre><nowiki> | ||
+ | options hid pb_fnmode=2 | ||
+ | </nowiki></pre> | ||
+ | 3. Save the file and execute the following command: | ||
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
sudo update-initramfs -u | sudo update-initramfs -u | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | 4. Reboot | |
+ | |||
Alternatively, you can modify '''/etc/rc.local''' to similar effect. | Alternatively, you can modify '''/etc/rc.local''' to similar effect. | ||
* Edit the '''/etc/rc.local''' file: | * Edit the '''/etc/rc.local''' file: | ||
第28行: | 第117行: | ||
echo 2 > /sys/module/hid/parameters/pb_fnmode | echo 2 > /sys/module/hid/parameters/pb_fnmode | ||
</nowiki></pre> | </nowiki></pre> | ||
− | === | + | Alternatively, you can modify '''/etc/sysfs.conf''' to similar effect. |
− | + | * Edit the '''/etc/sysfs.conf''' file: | |
− | + | <pre><nowiki> | |
+ | sudo gedit /etc/sysfs.conf | ||
+ | </nowiki></pre> | ||
+ | * Add this lines to the end of the file: | ||
+ | <pre><nowiki> | ||
+ | module/hid/parameters/pb_fnmode = 2 | ||
+ | </nowiki></pre> | ||
+ | === Correcting the two swapped keys for international (non-US) keyboards === | ||
+ | This section describe how to fix the issue related to the swapped key when using international keyboard. (See [https://bugs.launchpad.net/ubuntu/+source/linux/+bug/214786 #214786]) | ||
+ | ==== Ubuntu 9.04 (Jaunty Jakalope) ==== | ||
+ | Need to confirm if the problem persist as there is modification done in the kernel to fix the problem. | ||
+ | ==== Ubuntu 8.10 (Intrepid Ibex) ==== | ||
+ | 1. Open the 'System->Preferences->Keyboard' dialog | ||
+ | 2. Choose the 'Layouts' tab | ||
+ | 3. Press 'Layout Options...' | ||
+ | 4. Navigate to 'Miscellaneous compatibility options' | ||
+ | 5. Enable the option: '''Swap keycodes of two keys when Mac keyboards are misdetected by kernel.''' | ||
+ | |||
+ | === Mapping keys (Insert, Alt, Cmd, etc.) === | ||
+ | This section describe how to change the mapping of key to better match PC's keyboard. e.g.: Swap the Alt key and Command key. The idea is to make the keyboard work more like a normal PC keyboard. | ||
+ | ==== Ubuntu 9.04 (Jaunty Jakalope) ==== | ||
+ | Since Xmodmap have been replace by X Keyboard Extension, it's impossible to use Xmodmap to proceed with the mapping. Configuration can be done using the '''Keyboard''' preference tool. | ||
+ | ==== Ubuntu 8.10 (Intrepid Ibex) ==== | ||
<pre><nowiki> | <pre><nowiki> | ||
! Configure F13 as Insert key, F14 as PrintScr, F15 as ScrollLock | ! Configure F13 as Insert key, F14 as PrintScr, F15 as ScrollLock | ||
! and F16 as Pause/Break. | ! and F16 as Pause/Break. | ||
− | keycode | + | keycode 191 = Insert |
− | keycode | + | keycode 192 = Print Sys_Req |
− | keycode | + | keycode 193 = Scroll_Lock |
− | keycode | + | keycode 194 = Pause Break |
+ | keycode 195 = XF86AudioMute | ||
+ | keycode 196 = XF86AudioPrev | ||
+ | keycode 197 = XF86AudioNext | ||
! Swap Alt and Cmd keys. | ! Swap Alt and Cmd keys. | ||
− | keycode | + | keycode 37 = Control_L |
− | keycode | + | keycode 133 = Alt_L Meta_L |
− | keycode | + | keycode 64 = Super_L |
− | keycode | + | keycode 108 = Super_R |
− | keycode | + | keycode 134 = ISO_Level3_Shift Multi_key |
− | keycode | + | keycode 105 = Control_R Multi_key |
− | + | ||
clear Shift | clear Shift | ||
clear Lock | clear Lock | ||
第58行: | 第171行: | ||
add Lock = Caps_Lock | add Lock = Caps_Lock | ||
add Control = Control_L Control_R | add Control = Control_L Control_R | ||
− | add Mod1 = | + | add Mod1 = Alt_L 0x007D |
add Mod2 = Num_Lock | add Mod2 = Num_Lock | ||
add Mod4 = Super_L Super_R | add Mod4 = Super_L Super_R | ||
第64行: | 第177行: | ||
! Configure '=' key on numpad as '='. | ! Configure '=' key on numpad as '='. | ||
− | keycode | + | keycode 0x7D = equal |
</nowiki></pre> | </nowiki></pre> | ||
− | + | 2. Load the configuration by executing a command similar to the following. | |
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
− | + | xmodmap ~/.Xmodmap | |
− | + | </nowiki></pre> | |
− | + | Note : The configuration should be load on next logon. | |
− | + | ==== Ubuntu 8.04 (Hardy Heron) ==== | |
− | + | This section describe how to change the mapping for Ubuntu 8.04 (Hardy Heron) with kernel >= 2.6.27. | |
− | + | 1. Edit or create '''~/.Xmodmap''' file with a content similar to the following. | |
− | + | ||
− | + | ||
− | + | ||
− | ! Swap Alt and | + | <pre><nowiki> |
− | keycode | + | ! Configure F13 as Insert key |
− | keycode | + | ! F14 as PrintScr |
− | keycode | + | | F15 as ScrollLock |
− | keycode | + | ! F16 as Pause/Break |
− | keycode | + | keycode 182 = Insert |
− | keycode | + | keycode 183 = Print Sys_Req |
+ | keycode 184 = Scroll_Lock | ||
+ | keycode 93 = Pause Break | ||
+ | |||
+ | ! Swap Alt and Command keys | ||
+ | keycode 0x25 = Control_L | ||
+ | keycode 0x73 = Alt_L Meta_L | ||
+ | keycode 0x40 = Super_L | ||
+ | keycode 0x71 = Super_R | ||
+ | keycode 0x74 = ISO_Level3_Shift Multi_key | ||
+ | keycode 0x75 = NoSymbol | ||
+ | keycode 0x6D = Control_R Multi_key | ||
clear Shift | clear Shift | ||
clear Lock | clear Lock | ||
第96行: | 第218行: | ||
add Lock = Caps_Lock | add Lock = Caps_Lock | ||
add Control = Control_L Control_R | add Control = Control_L Control_R | ||
− | add Mod1 = | + | add Mod1 = Alt_L 0x007D |
add Mod2 = Num_Lock | add Mod2 = Num_Lock | ||
add Mod4 = Super_L Super_R | add Mod4 = Super_L Super_R | ||
第102行: | 第224行: | ||
! Configure '=' key on numpad as '='. | ! Configure '=' key on numpad as '='. | ||
− | keycode | + | keycode 0x9D = equal |
</nowiki></pre> | </nowiki></pre> | ||
− | + | 2. Load the configuration by executing a command similar to the following. | |
+ | |||
<pre><nowiki> | <pre><nowiki> | ||
xmodmap ~/.Xmodmap | xmodmap ~/.Xmodmap | ||
</nowiki></pre> | </nowiki></pre> | ||
− | + | Note : The configuration should be load on next logon. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
=== Belgian Macintosh Keyboard Layout === | === Belgian Macintosh Keyboard Layout === | ||
Take a look at https://help.ubuntu.com/community/Macbook_Air#head-5fd0bcf04cc7da0b5241950916bab5d58cdb84da in the Belgian Keyboard section | Take a look at https://help.ubuntu.com/community/Macbook_Air#head-5fd0bcf04cc7da0b5241950916bab5d58cdb84da in the Belgian Keyboard section |
2009年5月14日 (四) 14:34的版本
目录
Preface
Since Ubuntu 8.04 (Hardy Heron) the USB aluminium Apple Keyboard has not worked correctly. A change was added to the Ubuntu Linux kernel to make Apple MacBook keyboards gain additional functionality to their limited laptop style keyboard (Ubuntu bug #162083). Unfortunately this code change has some side effects for owners of the full size USB aluminium Apple Keyboard:
- Function keys have media functions as default. The "fn" key must be pressed and held to access the F-key functionality (except F5 and F6, which are inverted in this respect). (Ubuntu bug #201711)
- Two keys are swapped on international (non-US) keyboard with respect to the printing on the keycaps. (Ubuntu bug #214786)
- Num lock key will when pressed render the keyboard seemingly unusable. The keyboard will simulate a numeric keypad on the alphabet keys. Pressing F6 twice will exit this mode. (Ubuntu bug #201887) (This has been fixed)
- Bug filed in the main kernel bugzilla http://bugzilla.kernel.org/show_bug.cgi?id=10818. Please help if you think that the kernel developers are wrong, assuming that the keyboard have to behave like under MacOS.
Default Behavior
This section describe the default behavior of every Apple keyboard.
Apple slim aluminium keyboard (0220)
- 'fn'+'Enter' -> Insert
- 'fn'+'Backspace' -> Delete
- 'fn'+'Up' -> PageUp
- 'fn'+'Down' -> PageDown
- 'fn'+'Left' -> Home
- 'fn'+'Right' -> End
- 'Clear' behave like 'NumLock'
(See #262408 as there is patch submit to map F13, F14 and F15 to PrintScreen, ScrollLock and Pause.)
Corrections
Change Function Key behavior
This section of the document describe how to change the behavior of 'fn' key to better match what user expect. (See #201711, #162083) Here a description of each behavior :
- 0 = disabled : Disable the 'fn' key. Pressing 'fn'+'F8' will behave like you only press 'F8'
- 1 = fkeyslast : Function keys are used as last key. Pressing 'F8' key will act as a special key. Pressing 'fn'+'F8' will behave like a F8.
- 2 = fkeysfirst : Function keys are used as first key. Pressing 'F8' key will behave like a F8. Pressing 'fn'+'F8' will act as special key (play/pause).
Ubuntu 9.04 (Jaunty Jakalope)
Temporarily
This section describe how to change the behavior of 'fn' with immediate effect (Restarting will reset the configuration). Execute the following commands to change the fnmode parameters. See section above for a description of available value.
$ sudo bash # echo 2 > /sys/module/hid_apple/parameters/fnmode # exit
Permanently
This section describe how to change the behavior of 'fn' permanently. There is many way to proceed with this modification. Each sub section describe one way to permanently change the configuration.
With .conf file (Recommended)
1. Edit or create the file /etc/modprobe.d/hid_apple.conf, e.g.:
sudo gedit /etc/modprobe.d/hid_apple.conf
2. Add this line to the previously open file.
options hid_apple fnmode=2
3. Save the file and execute the following command to notify hid_apple module to reload it's configuration.
sudo update-initramfs -u
4. Reboot
With rc.local
1. Edit the /etc/rc.local file.
sudo gedit /etc/rc.local
2. Add this line near the end of the file, before the "exit" line:
echo 2 > /sys/module/hid_apple/parameters/fnmode
3. Reboot
With sysfs.conf
1. Edit the /etc/sysfs.conf file.
sudo gedit /etc/sysfs.conf
2. Add this lines to the end of the file.
module/hid_apple/parameters/fnmode = 2
3. Reboot
Ubuntu 8.10 (Intrepid Ibex)
Temporarily
With immediate effect, try
sudo bash echo 2 > /sys/module/hid/parameters/pb_fnmode exit
Permanently
1. Edit the file /etc/modprobe.d/options, e.g.:
sudo gedit /etc/modprobe.d/options
2. Add the line:
options hid pb_fnmode=2
3. Save the file and execute the following command:
sudo update-initramfs -u
4. Reboot
Alternatively, you can modify /etc/rc.local to similar effect.
- Edit the /etc/rc.local file:
sudo gedit /etc/rc.local
- Add this line to the end of the file:
echo 2 > /sys/module/hid/parameters/pb_fnmode
Alternatively, you can modify /etc/sysfs.conf to similar effect.
- Edit the /etc/sysfs.conf file:
sudo gedit /etc/sysfs.conf
- Add this lines to the end of the file:
module/hid/parameters/pb_fnmode = 2
Correcting the two swapped keys for international (non-US) keyboards
This section describe how to fix the issue related to the swapped key when using international keyboard. (See #214786)
Ubuntu 9.04 (Jaunty Jakalope)
Need to confirm if the problem persist as there is modification done in the kernel to fix the problem.
Ubuntu 8.10 (Intrepid Ibex)
1. Open the 'System->Preferences->Keyboard' dialog 2. Choose the 'Layouts' tab 3. Press 'Layout Options...' 4. Navigate to 'Miscellaneous compatibility options' 5. Enable the option: Swap keycodes of two keys when Mac keyboards are misdetected by kernel.
Mapping keys (Insert, Alt, Cmd, etc.)
This section describe how to change the mapping of key to better match PC's keyboard. e.g.: Swap the Alt key and Command key. The idea is to make the keyboard work more like a normal PC keyboard.
Ubuntu 9.04 (Jaunty Jakalope)
Since Xmodmap have been replace by X Keyboard Extension, it's impossible to use Xmodmap to proceed with the mapping. Configuration can be done using the Keyboard preference tool.
Ubuntu 8.10 (Intrepid Ibex)
! Configure F13 as Insert key, F14 as PrintScr, F15 as ScrollLock ! and F16 as Pause/Break. keycode 191 = Insert keycode 192 = Print Sys_Req keycode 193 = Scroll_Lock keycode 194 = Pause Break keycode 195 = XF86AudioMute keycode 196 = XF86AudioPrev keycode 197 = XF86AudioNext ! Swap Alt and Cmd keys. keycode 37 = Control_L keycode 133 = Alt_L Meta_L keycode 64 = Super_L keycode 108 = Super_R keycode 134 = ISO_Level3_Shift Multi_key keycode 105 = Control_R Multi_key clear Shift clear Lock clear Control clear Mod1 clear Mod2 clear Mod3 clear Mod4 clear Mod5 add Shift = Shift_L Shift_R add Lock = Caps_Lock add Control = Control_L Control_R add Mod1 = Alt_L 0x007D add Mod2 = Num_Lock add Mod4 = Super_L Super_R add Mod5 = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift ! Configure '=' key on numpad as '='. keycode 0x7D = equal
2. Load the configuration by executing a command similar to the following.
xmodmap ~/.Xmodmap
Note : The configuration should be load on next logon.
Ubuntu 8.04 (Hardy Heron)
This section describe how to change the mapping for Ubuntu 8.04 (Hardy Heron) with kernel >= 2.6.27. 1. Edit or create ~/.Xmodmap file with a content similar to the following.
! Configure F13 as Insert key ! F14 as PrintScr | F15 as ScrollLock ! F16 as Pause/Break keycode 182 = Insert keycode 183 = Print Sys_Req keycode 184 = Scroll_Lock keycode 93 = Pause Break ! Swap Alt and Command keys keycode 0x25 = Control_L keycode 0x73 = Alt_L Meta_L keycode 0x40 = Super_L keycode 0x71 = Super_R keycode 0x74 = ISO_Level3_Shift Multi_key keycode 0x75 = NoSymbol keycode 0x6D = Control_R Multi_key clear Shift clear Lock clear Control clear Mod1 clear Mod2 clear Mod3 clear Mod4 clear Mod5 add Shift = Shift_L Shift_R add Lock = Caps_Lock add Control = Control_L Control_R add Mod1 = Alt_L 0x007D add Mod2 = Num_Lock add Mod4 = Super_L Super_R add Mod5 = Mode_switch ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift ! Configure '=' key on numpad as '='. keycode 0x9D = equal
2. Load the configuration by executing a command similar to the following.
xmodmap ~/.Xmodmap
Note : The configuration should be load on next logon.
Belgian Macintosh Keyboard Layout
Take a look at https://help.ubuntu.com/community/Macbook_Air#head-5fd0bcf04cc7da0b5241950916bab5d58cdb84da in the Belgian Keyboard section
Postscript
These issues may also apply for the Bluetooth aluminium Apple Wireless Keyboard.