https://wiki.archlinux.org/api.php?action=feedcontributions&user=Joaking&feedformat=atomArchWiki - User contributions [en]2024-03-28T11:41:23ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Hadoop&diff=570018Hadoop2019-03-29T02:35:23Z<p>Joaking: fix java path.</p>
<hr />
<div>[[Category:Distributed computing]]<br />
[[Category:Apache]]<br />
{{Related articles start}}<br />
{{Related|Apache spark}}<br />
{{Related articles end}}<br />
[[ja:Hadoop]]<br />
[[zh-hans:Hadoop]]<br />
[https://hadoop.apache.org Apache Hadoop] is a framework for running applications on large cluster built of commodity hardware. The Hadoop framework transparently provides applications both reliability and data motion. Hadoop implements a computational paradigm named Map/Reduce, where the application is divided into many small fragments of work, each of which may be executed or re-executed on any node in the cluster. In addition, it provides a distributed file system (HDFS) that stores data on the compute nodes, providing very high aggregate bandwidth across the cluster. Both MapReduce and the Hadoop Distributed File System are designed so that node failures are automatically handled by the framework. <br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{AUR|hadoop}} package.<br />
<br />
== Configuration ==<br />
<br />
By default, hadoop is already configured for pseudo-distributed operation. Some environment variables are set in {{ic|/etc/profile.d/hadoop.sh}} with different values than traditional hadoop.<br />
<br />
{| class="wikitable"<br />
|-<br />
! ENV<br />
! Value<br />
! Description <br />
! Permission <br />
|-<br />
| HADOOP_CONF_DIR<br />
| {{ic|/etc/hadoop}}<br />
| Where configuration files are stored.<br />
| Read<br />
|-<br />
| HADOOP_LOG_DIR<br />
| {{ic|/tmp/hadoop/log}}<br />
| Where log files are stored.<br />
| Read and Write<br />
|-<br />
| HADOOP_SLAVES<br />
| {{ic|/etc/hadoop/slaves}}<br />
| File naming remote slave hosts.<br />
| Read <br />
|-<br />
| HADOOP_PID_DIR<br />
| {{ic|/tmp/hadoop/run}}<br />
| Where pid files are stored.<br />
| Read and Write<br />
|}<br />
<br />
You also should set up the following files correctly. <br />
<br />
/etc/hosts<br />
/etc/hostname <br />
/etc/locale.conf<br />
<br />
You need to tell hadoop your JAVA_HOME in {{ic|/etc/hadoop/hadoop-env.sh}} because it doesn't assume the location where it's installed to in Arch Linux by itself:<br />
<br />
{{hc|1=/etc/hadoop/hadoop-env.sh|2=<br />
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk/jre<br />
}}<br />
<br />
Check installation with:<br />
<br />
hadoop version<br />
<br />
If you get warning message "WARNING: HADOOP_SLAVES has been replaced by HADOOP_WORKERS. Using value of HADOOP_SLAVES." Then replace {{ic|1=export HADOOP_SLAVES=/etc/hadoop/slaves}} in {{ic|/etc/profile.d/hadoop.sh}} with:<br />
<br />
export HADOOP_WORKERS=/etc/hadoop/workers<br />
<br />
== Single Node Setup ==<br />
{{Note|This section is based on the [http://hadoop.apache.org/docs/stable/ Hadoop Official Documentation] }}<br />
<br />
=== Standalone Operation ===<br />
<br />
By default, Hadoop is configured to run in a non-distributed mode, as a single Java process. This is useful for debugging.<br />
<br />
The following example copies the unpacked conf directory to use as input and then finds and displays every match of the given regular expression. Output is written to the given output directory.<br />
<br />
$ HADOOP_CONF_DIR=/usr/lib/hadoop/orig_etc/hadoop/<br />
$ mkdir input<br />
$ cp /etc/hadoop/*.xml input<br />
$ hadoop jar /usr/lib/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.0.0.jar grep input output 'dfs[a-z.]+'<br />
$ cat output/*<br />
<br />
=== Pseudo-Distributed Operation ===<br />
<br />
Hadoop can also be run on a single-node in a pseudo-distributed mode where each Hadoop daemon runs in a separate Java process.<br />
<br />
By default, Hadoop will run as the user root. You can change the user in {{ic|/etc/conf.d/hadoop}}:<br />
<br />
HADOOP_USERNAME="<your user name>"<br />
<br />
==== Set up passphraseless ssh ====<br />
<br />
Make sure you have [[sshd]] [[enabled]]. Now check that you can connect to localhost without a passphrase:<br />
<br />
$ ssh localhost<br />
<br />
If you cannot ssh to localhost without a passphrase, execute the following commands:<br />
<br />
$ ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa<br />
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys<br />
$ chmod 0600 ~/.ssh/authorized_keys<br />
<br />
Also make sure this line is commented in {{ic|/etc/ssh/sshd_config}}<br />
<br />
{{hc|/etc/ssh/sshd_config|<br />
#AuthorizedKeysFile .ssh/authorized_keys}}<br />
<br />
==== Execution ====<br />
Format a new distributed-filesystem:<br />
$ hadoop namenode -format<br />
<br />
Edit {{ic|/etc/hadoop/core-site.xml}} and add below configuration:<br />
<configuration><br />
<property><br />
<name>fs.defaultFS</name><br />
<value>hdfs://localhost:9000</value><br />
</property><br />
</configuration><br />
<br />
Start the hadoop namenode:<br />
$ hadoop namenode<br />
<br />
You may access the web GUI via http://localhost:9870/<br />
<br />
{{Accuracy|Instructions for older versions of Hadoop}}<br />
[[Start]] the following hadoop systemd units: {{ic|hadoop-datanode}}, {{ic|hadoop-jobtracker}}, {{ic|hadoop-namenode}}, {{ic|hadoop-secondarynamenode}}, {{ic|hadoop-tasktracker}}.<br />
<br />
The hadoop daemon log output is written to the {{ic|<nowiki>${HADOOP_LOG_DIR}</nowiki>}} directory (defaults to {{ic|/var/log/hadoop}}).<br />
<br />
Browse the web interface for the NameNode and the JobTracker; by default they are available at:<br />
<br />
* NameNode - http://localhost:50070/<br />
* JobTracker - http://localhost:50030/<br />
<br />
Copy the input files into the distributed filesystem:<br />
$ hadoop fs -put /etc/hadoop input<br />
<br />
Run some of the examples provided:<br />
$ hadoop jar /usr/lib/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar grep input output 'dfs[a-z.]+'<br />
<br />
Examine the output files:<br />
<br />
Copy the output files from the distributed filesystem to the local filesystem and examine them:<br />
$ hadoop fs -get output output<br />
$ cat output/*<br />
<br />
or<br />
<br />
View the output files on the distributed filesystem:<br />
$ hadoop fs -cat output/*<br />
<br />
When you're done, [[stop]] the daemons {{ic|hadoop-datanode}}, {{ic|hadoop-jobtracker}}, {{ic|hadoop-namenode}}, {{ic|hadoop-secondarynamenode}}, {{ic|hadoop-tasktracker}}.</div>Joakinghttps://wiki.archlinux.org/index.php?title=Xmodmap&diff=540525Xmodmap2018-09-09T22:10:59Z<p>Joaking: Correct Typos and Clarify.</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Keyboard configuration]]<br />
[[Category:X server]]<br />
[[de:Xmodmap]]<br />
[[fr:Xmodmap]]<br />
[[ja:Xmodmap]]<br />
[[ru:Xmodmap]]<br />
[[zh-hans:Xmodmap]]<br />
{{Related articles start}}<br />
{{Related|Xorg}}<br />
{{Related|Extra keyboard keys}}<br />
{{Related|Extra keyboard keys in console}}<br />
{{Related|Xbindkeys}}<br />
{{Related articles end}}<br />
''xmodmap'' is a utility for modifying keymaps and pointer button mappings in [[Xorg]].<br />
<br />
''xmodmap'' is not directly related to [[X keyboard extension]] (XKB), as it uses different (pre-XKB) ideas on how ''keycodes'' are processed within X. Generally, it is only recommended for the simplest tasks. See [[X keyboard extension]] for advanced layout configuration.<br />
<br />
{{Note|''xmodmap'' settings are reset by ''setxkbmap'', which not only alters the alphanumeric keys to the values given in the map, but also resets all other keys to the startup default. [http://wiki.linuxquestions.org/wiki/Configuring_keyboards]}}<br />
<br />
== Introduction == <br />
<br />
There are two types of keyboard values in [[Xorg]]: ''keycodes'' and ''keysyms''.<br />
<br />
; keycode <br />
: The ''keycode'' is the numeric representation received by the kernel when a key or a mouse button is pressed.<br />
; keysym<br />
: The ''keysym'' is the value assigned to the ''keycode''. For example, pressing {{ic|a}} generates the {{ic|keycode 38}}, which is mapped to the {{ic|keysym 0×61}}, which matches {{ic|a}} in the [[Wikipedia:ASCII|ASCII table]](Note that {{ic|keysym}} uses hexadecimal representation).<br />
: The ''keysyms'' are managed by [[Xorg]] in a table of ''keycodes'' defining the ''keycode''-''keysym'' relations, which is called the [[#Keymap table|keymap table]]. This can be shown by running {{ic|xmodmap}}.<br />
<br />
== Installation ==<br />
<br />
''xmodmap'' can be [[pacman|installed]] through the {{Pkg|xorg-xmodmap}} package.<br />
<br />
Optionally, install {{Pkg|xkeycaps}}, which is a graphical front-end to ''xmodmap''.<br />
<br />
== Keymap table ==<br />
<br />
Print the current keymap table formatted into expressions:<br />
<br />
{{hc|$ xmodmap -pke|2=<br />
[...]<br />
keycode 57 = n N<br />
[...]<br />
}}<br />
<br />
Each ''keycode'' is followed by the ''keysym'' it is mapped to. The above example indicates that the ''keycode'' {{ic|57}} is mapped to the lowercase {{ic|n}}, while the uppercase {{ic|N}} is mapped to ''keycode'' {{ic|57}} plus {{ic|Shift}}.<br />
<br />
Each ''keysym'' column in the table corresponds to a particular combination of modifier keys:<br />
# {{ic|Key}}<br />
# {{ic|Shift+Key}}<br />
# {{ic|Mode_switch+Key}}<br />
# {{ic|Mode_switch+Shift+Key}}<br />
# {{ic|ISO_Level3_Shift+Key}}<br />
# {{ic|ISO_Level3_Shift+Shift+Key}}<br />
<br />
Not all ''keysyms'' have to be set, but to assign only a latter ''keysym'', use the {{ic|NoSymbol}} value.<br />
<br />
To see which ''keycode'' corresponds to a key, see [[Extra keyboard keys#In Xorg]] for details on the ''xev'' utility which will output relevant keycode/keysym information about a key when you press it.<br />
<br />
{{Tip|There are predefined descriptive ''keysyms'' for multimedia keys, e.g. {{ic|XF86AudioMute}} or {{ic|XF86Mail}}. These ''keysyms'' can be found in {{ic|/usr/include/X11/XF86keysym.h}}. Many multimedia programs are designed to work with these ''keysyms'' out-of-the-box, without the need to configure any third-party application.<br />
}}<br />
<br />
Note that xmodmap is influenced by xkbd settings, so all eight keysym are available for the US(intl) xkbd layout but not for the default US (it is missing the ralt_switch symbol defined in level3). To have all 8 keysyms available you should configure the ''(intl)'' variant of the keyboard. Using US layout as an example, {{ic|$ setxkbmap -layout 'us(intl)'}} before calling xmodmap to test your changes in the current X session. To permanently make this change, edit the xorg configuration or your .xprofile or .xinitrc file. See [[Keyboard configuration in Xorg#Setting keyboard layout]] for a full explanation.<br />
<br />
== Custom table ==<br />
<br />
To create a key map (i.e. {{ic|~/.Xmodmap}}):<br />
$ xmodmap -pke > ~/.Xmodmap<br />
<br />
To test the changes:<br />
$ xmodmap ~/.Xmodmap<br />
<br />
=== Activating the custom table ===<br />
<br />
With [[GDM]], [[XDM]] or [[LightDM]] there is no need to source {{ic|~/.Xmodmap}}. For [[startx]], use:<br />
<br />
{{hc|~/.xinitrc|<nowiki><br />
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap<br />
</nowiki>}}<br />
<br />
Alternatively, edit the global startup script {{ic|/etc/X11/xinit/xinitrc}}.<br />
<br />
=== Test changes ===<br />
<br />
To make temporary changes:<br />
$ xmodmap -e "keycode 46 = l L l L lstroke Lstroke lstroke"<br />
$ xmodmap -e "keysym a = e E"<br />
<br />
== Modifier keys ==<br />
<br />
''xmodmap'' can also be used to override [[Wikipedia:Modifier key|modifier keys]], e.g. to swap {{ic|Control}} and {{ic|Super}} (the [[Wikipedia:Windows key|Windows key]]).<br />
<br />
Print the current modifier table verbosely (full sample):<br />
{{hc|$ xmodmap -pm|2=<br />
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):<br />
<br />
shift Shift_L (0x32), Shift_R (0x3e)<br />
lock Caps_Lock (0x42)<br />
control Control_L (0x25), Control_R (0x69)<br />
mod1 Alt_L (0x40), Meta_L (0xcd)<br />
mod2 Num_Lock (0x94)<br />
mod3 <br />
mod4 Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)<br />
mod5 ISO_Level3_Shift (0x5c), ISO_Level3_Shift (0x6c), Mode_switch (0x85), Mode_switch (0xcb)<br />
}} <br />
<br />
=== Finding the keysym column modifier keys ===<br />
<br />
{{Merge|#Keymap table|The point of this section does not seem to be ''finding'' anything. The meaning of the modifier keys should be explained in [[#Keymap table]] where they are mentioned first.}}<br />
<br />
;ISO_Level3_Shift<br />
:The AltGr key on non-US keyboards calls modifier ISO_Level3_Shift. (On US keyboards, the right-alt {{ic|Alt_R}} has the same function as the left-alt {{ic|Alt_L}}, which makes setting the layout as US international preferable. See [[#Keymap table]].) <br />
;Mode_switch<br />
:The Mode_switch modifier may be mapped by default to a key that is not on your keyboard.<br />
<br />
{{Note|The usage of the modifier names {{ic|ISO_Level3_Shift}} and {{ic|Mode_switch}} is different between xmodmap and [[X keyboard extension#xmodmap|X Keyboard Extension]]. See also [https://unix.stackexchange.com/questions/55076/what-is-the-mode-switch-modifier-for].}}<br />
<br />
=== Reassigning modifiers to keys on your keyboard ===<br />
<br />
{{Note|xmodmap is ''case-sensitive''. Using incorrect case, such as {{ic|Mode_Switch}} instead of the correct {{ic|Mode_switch}} will cause errors.}}<br />
<br />
Before assignment, the modifier keys need to be cleared. This applies to both modifiers you intend to assign and modifiers on keys that you intend to use. For example, if you intend to assign {{ic|Caps_Lock}} to your A key and {{ic|B}} to your NumLock key, you need to first clear the modifiers for both {{ic|Caps_Lock}} and {{ic|Num_Lock}}, then assign the keysyms, and finally add back the modifiers.<br />
<br />
{{hc|~/.Xmodmap|2=<br />
[...]<br />
clear lock<br />
clear mod2<br />
keycode 38 = Caps_Lock<br />
keycode 77 = Num_Lock<br />
add lock = Caps_Lock<br />
add mod2 = Num_Lock<br />
}}<br />
<br />
{{ic|!}} is a comment, so only the modifiers {{ic|Control}} and {{ic|Mod4}} get cleared in the following example. Then the ''keysyms'' {{ic|Control_L}}, {{ic|Control_R}}, {{ic|Super_L}} and {{ic|Super_R}} are assigned to the opposite modifier. Assigning both left and right to the same modifier means that both keys are treated the same way.<br />
<br />
{{hc|~/.Xmodmap|2=<br />
[...]<br />
!clear Shift<br />
!clear Lock<br />
clear Control<br />
!clear Mod1<br />
!clear Mod2<br />
!clear Mod3<br />
clear Mod4<br />
!clear Mod5<br />
!add Shift = Shift_L Shift_R<br />
!add Lock = Caps_Lock<br />
add Control = Super_L Super_R<br />
!add Mod1 = Alt_L Alt_R<br />
!add Mod2 = Mode_switch<br />
!add Mod3 =<br />
add Mod4 = Control_L Control_R<br />
!add Mod5 =<br />
}}<br />
<br />
{{Note|The example assumes that the {{ic|Control_L}} and {{ic|Control_R}} keysyms were assigned to the {{ic|Control}} modifier, and {{ic|Super_L}} and {{ic|Super_R}} keysyms to the {{ic|Mod4}} modifier. If you get the following error message {{ic|X Error of failed request: BadValue (integer parameter out of range for operation)}}, you will need to adapt accordingly. Running {{ic|xmodmap}} produces a list of modifiers and keys that are assigned to them.}}<br />
<br />
The following example modifies {{ic|CapsLock}} to {{ic|Control}}, and {{ic|Shift+CapsLock}} to {{ic|CapsLock}}:<br />
{{hc|~/.Xmodmap|2=<br />
clear lock<br />
clear control<br />
add control = Caps_Lock Control_L Control_R<br />
keycode 66 = Control_L Caps_Lock NoSymbol NoSymbol<br />
}}<br />
<br />
== Reverse scrolling ==<br />
<br />
{{Merge|Mouse buttons|xmodmap is not the only way to do this.}}<br />
<br />
The [http://who-t.blogspot.com/2011/09/natural-scrolling-in-synaptics-driver.html natural scrolling] feature available in OS X Lion (mimicking smartphone or tablet scrolling) can be [https://bbs.archlinux.org/viewtopic.php?id=126258 replicated] with ''xmodmap''. Since the synaptics driver uses the buttons 4/5/6/7 for up/down/left/right scrolling, you simply need to swap the order of how the buttons are declared in {{ic|~/.Xmodmap}}:<br />
<br />
{{hc|~/.Xmodmap|2=<br />
pointer = 1 2 3 '''5 4''' 7 6 8 9 10 11 12<br />
}}<br />
<br />
Then update ''xmodmap'':<br />
$ xmodmap ~/.Xmodmap<br />
<br />
== Swapping mouse buttons ==<br />
<br />
{{Merge|Mouse buttons|xmodmap is not the only way to do this.}}<br />
<br />
The left, middle and right mouse buttons correspond to buttons 1,2 and 3 respectively in the synaptics driver. To swap left and right mouse buttons, again simply reverse the order in which they are listed in your {{ic|~/.Xmodmap}}:<br />
<br />
{{hc|~/.Xmodmap|2=<br />
pointer = '''3 2 1'''<br />
}}<br />
<br />
This should suffice for a simple mouse setup. Again, update ''xmodmap'':<br />
$ xmodmap ~/.Xmodmap<br />
<br />
== Templates ==<br />
<br />
=== Spanish === <br />
<br />
{{hc|~/.Xmodmap|<br />
keycode 24 &#61; a A aacute Aacute ae AE ae<br />
keycode 26 &#61; e E eacute Eacute EuroSign cent EuroSign<br />
keycode 30 &#61; u U uacute Uacute downarrow uparrow downarrow<br />
keycode 31 &#61; i I iacute Iacute rightarrow idotless rightarrow<br />
keycode 32 &#61; o O oacute Oacute oslash Oslash oslash<br />
keycode 57 &#61; n N ntilde Ntilde n N n<br />
keycode 58 &#61; comma question comma questiondown dead_acute dead_doubleacute dead_acute<br />
keycode 61 &#61; exclam section exclamdown section dead_belowdot dead_abovedot dead_belowdot<br />
!Maps the Mode key to the Alt key<br />
keycode 64 &#61; Mode_switch<br />
}}<br />
<br />
=== Turn CapsLock into Control ===<br />
<br />
Simplest example of changing {{ic|CapsLock}} into {{ic|Control}}.<br />
<br />
{{hc|~/.Xmodmap|<nowiki><br />
clear lock<br />
clear control<br />
keycode 66 = Control_L<br />
add control = Control_L Control_R<br />
</nowiki>}}<br />
<br />
=== Turn CapsLock into Control, and LeftControl into Hyper ===<br />
<br />
Laptop users may prefer having {{ic|CapsLock}} as {{ic|Control}}. The {{ic|Left Control}} key can be used as a {{ic|Hyper}} modifier (an additional modifier for emacs or openbox or i3).<br />
<br />
{{hc|~/.Xmodmap|<nowiki><br />
clear lock <br />
clear control<br />
clear mod1<br />
clear mod2<br />
clear mod3<br />
clear mod4<br />
clear mod5<br />
keycode 37 = Hyper_L<br />
keycode 66 = Control_L<br />
add control = Control_L Control_R<br />
add mod1 = Alt_L Alt_R Meta_L<br />
add mod2 = Num_Lock<br />
add mod3 = Hyper_L<br />
add mod4 = Super_L Super_R<br />
add mod5 = Mode_switch ISO_Level3_Shift<br />
</nowiki>}}<br />
<br />
=== Switch every number key N with Shift-N and vice-versa, for Croatian layout ===<br />
<br />
Should work fine for layouts similar to Croatian as well.<br />
<br />
{{hc|~/.Xmodmap|<nowiki><br />
keycode 10 = exclam 1 1 exclam asciitilde dead_tilde asciitilde<br />
keycode 11 = quotedbl 2 2 quotedbl dead_caron caron dead_caron<br />
keycode 12 = numbersign 3 3 numbersign asciicircum dead_circumflex asciicircum<br />
keycode 13 = dollar 4 4 dollar dead_breve breve dead_breve<br />
keycode 14 = percent 5 5 percent degree dead_abovering degree<br />
keycode 15 = ampersand 6 6 ampersand dead_ogonek ogonek dead_ogonek<br />
keycode 16 = slash 7 7 slash grave dead_grave grave<br />
keycode 17 = parenleft 8 8 parenleft dead_abovedot abovedot dead_abovedot<br />
keycode 18 = parenright 9 9 parenright dead_acute apostrophe dead_acute<br />
keycode 19 = equal 0 0 equal dead_doubleacute doubleacute dead_doubleacute<br />
</nowiki>}}<br />
<br />
== See also ==<br />
<br />
* {{man|1|xmodmap}}<br />
*[http://cweiske.de/howto/xmodmap/allinone.html Multimediakeys with .Xmodmap HOWTO] by Christian Weiske<br />
*[http://dev-loki.blogspot.com/2006/04/mapping-unsupported-keys-with-xmodmap.html Mapping unsupported keys with xmodmap] by Pascal Bleser<br />
*[http://wiki.linuxquestions.org/wiki/List_of_Keysyms_Recognised_by_Xmodmap List of Keysyms Recognised by Xmodmap] on [http://linuxquestions.org LinuxQuestions]</div>Joakinghttps://wiki.archlinux.org/index.php?title=User:Joaking&diff=511682User:Joaking2018-02-22T19:33:29Z<p>Joaking: </p>
<hr />
<div>Hey!</div>Joakinghttps://wiki.archlinux.org/index.php?title=Keyboard_backlight&diff=507645Keyboard backlight2018-01-16T21:29:30Z<p>Joaking: Adding dependency and improving the explanation of the use</p>
<hr />
<div>[[Category:Keyboards]]<br />
[[ja:キーボードバックライト]]<br />
== Any vendor ==<br />
<br />
You can control your computer keyboard backlight via the [[D-Bus]] interface.<br />
The benefits of using it are that no modification to device files is required<br />
and it is vendor agnostic.<br />
<br />
Here is an example implementation in [[Python]] 3.<br />
[[Install]] {{pkg|upower}} and {{pkg|python-dbus}} packages then place the following script in {{ic|/usr/local/bin/}} and make it executable.<br />
You can then map your keyboard shortcuts to run {{ic|/usr/local/bin/kb-light.py + x}}<br />
and {{ic|/usr/local/bin/kb-light.py - x}} to increase and decrease your keyboard<br />
backlight level by {{ic|x}}.<br />
<br />
{{Tip|1=You should try with an x = 1 to determine the limits of the keyboard backlight levels}}<br />
<br />
{{hc|/usr/local/bin/kb-light.py|<nowiki><br />
#!/usr/bin/env python3<br />
<br />
import dbus<br />
import sys<br />
<br />
def kb_light_set(delta):<br />
bus = dbus.SystemBus()<br />
kbd_backlight_proxy = bus.get_object('org.freedesktop.UPower', '/org/freedesktop/UPower/KbdBacklight')<br />
kbd_backlight = dbus.Interface(kbd_backlight_proxy, 'org.freedesktop.UPower.KbdBacklight')<br />
<br />
current = kbd_backlight.GetBrightness()<br />
maximum = kbd_backlight.GetMaxBrightness()<br />
new = max(0, min(current + delta, maximum))<br />
<br />
if 0 <= new <= maximum:<br />
current = new<br />
kbd_backlight.SetBrightness(current)<br />
<br />
# Return current backlight level percentage<br />
return 100 * current / maximum<br />
<br />
if __name__ == '__main__':<br />
if len(sys.argv) == 2 or len(sys.argv) == 3:<br />
if sys.argv[1] == "--up" or sys.argv[1] == "+":<br />
if len(sys.argv) == 3:<br />
print(kb_light_set(int(sys.argv[2])))<br />
else:<br />
print(kb_light_set(17))<br />
elif sys.argv[1] == "--down" or sys.argv[1] == "-":<br />
if len(sys.argv) == 3:<br />
print(kb_light_set(-int(sys.argv[2])))<br />
else:<br />
print(kb_light_set(-17))<br />
else:<br />
print("Unknown argument:", sys.argv[1])<br />
else:<br />
print("Script takes one or two argument.", len(sys.argv) - 1, "arguments provided.")<br />
<br />
</nowiki>}}<br />
<br />
<br />
== Asus ==<br />
<br />
{{Warning|The following way is not recommended. It provides world-writeable permissions to the keyboard backlight device file meaning that any and every user can control it.}}<br />
The keyboard backlight file is usually locked out from editing. To unlock this file at bootup, you will need to create a [[systemd]] service.<br />
<br />
{{hc|/usr/lib/systemd/system/asus-kbd-backlight.service|<nowiki><br />
[Unit]<br />
Description=Asus Keyboard Backlight<br />
Wants=systemd-backlight@leds:asus::kbd_backlight.service<br />
After=systemd-backlight@leds:asus::kbd_backlight.service<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/bin/chmod 666 /sys/class/leds/asus::kbd_backlight/brightness<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
You are now able to use a keyboard backlight changer script. For an example, see [[ASUS G55VW#keyboard backlight script]].<br />
<br />
For an example of how you might set up a tiny daemon (running as root) that edits these files, hook it up to [[dbus]], and map the keyboard brightness keys to [[dbus]] method calls, see [https://github.com/GambolingPangolin/KbdBacklight].</div>Joakinghttps://wiki.archlinux.org/index.php?title=Keyboard_input&diff=507632Keyboard input2018-01-16T18:36:30Z<p>Joaking: Improving redirect</p>
<hr />
<div>[[Category:Keyboards]]<br />
[[ja:特別なキーボードキー]]<br />
[[ru:Extra keyboard keys]]<br />
[[zh-hans:Extra keyboard keys]]<br />
{{Related articles start}}<br />
{{Related|Extra keyboard keys in Xorg}}<br />
{{Related|Extra keyboard keys in console}}<br />
{{Related|Keyboard configuration in Xorg}}<br />
{{Related|Keyboard configuration in console}}<br />
{{Related|Map scancodes to keycodes}}<br />
{{Related|Xmodmap}}<br />
{{Related articles end}}<br />
Many keyboards include some ''special keys'' (also called ''hotkeys'' or ''multimedia keys''), which are supposed to execute an application or print special characters (not included in the standard national keymaps). [[udev]] contains a large database of mappings specific to individual keyboards, so common keyboards usually work out of the box. If you have very recent or uncommon piece of hardware, you may need to adjust the mapping manually.<br />
<br />
Prerequisite for modifying the key mapping is knowing how the keys are identified on the system. There are multiple levels: <br />
<br />
* A [[Wikipedia:Scancode|scancode]] is the lowest identification number for a key, it is the value that a keyboard sends to a computer.<br />
* A '''keycode''' is the second level of identification for a key, a ''keycode'' corresponds to a function.<br />
* A '''keysym''' is the third level of identification for a key, it corresponds to a ''symbol''. It may depend on whether the Shift key or another [[Wikipedia:Modifier key|modifier key]] was also pressed.<br />
<br />
''Scancodes'' are mapped to ''keycodes'', which are then mapped to ''keysyms'' depending on used keyboard layout. Most of your keys should already have a ''keycode'', or at least a ''scancode''. Keys without a ''scancode'' are not recognized by the kernel; these can include additional keys from 'gaming' keyboards, etc.<br />
<br />
In Xorg, some ''keysyms'' (e.g. {{ic|XF86AudioPlay}}, {{ic|XF86AudioRaiseVolume}} etc.) can be mapped to actions (i.e. launching an external application). See [[Extra keyboard keys in Xorg#Mapping keysyms to actions]] for details.<br />
<br />
In Linux console, some ''keysyms'' (e.g. {{ic|F1}} to {{ic|F246}}) can be mapped to certain actions (e.g. switch to other console or print some sequence of characters). See [[Extra keyboard keys in console]] for details.<br />
<br />
== Identifying key codes ==<br />
<br />
=== Scancodes ===<br />
<br />
==== Using showkey ====<br />
<br />
The traditional way to get a ''scancode'' is to use the ''showkey'' utility. ''showkey'' waits for a key to be pressed, or exits if no keys are pressed within 10 seconds. For ''showkey'' to work you need to be in a [[Wikipedia:Virtual console|virtual console]], not in a graphical environment or logged in via a network connection. Run the following command:<br />
<br />
# showkey --scancodes<br />
<br />
and try to push keyboard keys; you should see ''scancodes'' being printed to the output.<br />
<br />
==== Using evtest ====<br />
<br />
For USB keyboards, it is apparently necessary to use ''evtest'' from the {{Pkg|evtest}} package instead of ''showkey'':[https://ask.fedoraproject.org/en/question/46201/how-to-map-scancodes-to-keycodes/]<br />
<br />
# evtest /dev/input/event12<br />
...<br />
Event: time 1434666536.001123, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70053<br />
Event: time 1434666536.001123, type 1 (EV_KEY), code 69 (KEY_NUMLOCK), value 0<br />
Event: time 1434666536.001123, -------------- EV_SYN ------------<br />
<br />
Use the "value" field of {{ic|MSC_SCAN}}. This example shows that NumLock has scancode 70053 and keycode 69.<br />
<br />
==== Using dmesg ====<br />
<br />
{{Note|This method does not provide ''scancodes'' for all keys, it only identifies the unknown keys.}}<br />
<br />
You can get the ''scancode'' of a key by pressing the desired key and looking the output of {{ic|dmesg}} command. For example, if you get:<br />
<br />
Unknown key pressed (translated set 2, code 0xa0 on isa0060/serio0<br />
<br />
then the ''scancode'' you need is {{ic|0xa0}}.<br />
<br />
=== Keycodes ===<br />
<br />
{{Warning|Note that the ''keycodes'' are different for Linux console and Xorg. Use the appropriate tool to determine the desired value.}}<br />
<br />
==== In console ====<br />
<br />
The ''keycodes'' for [[Wikipedia:Virtual console|virtual console]] are reported by the ''showkey'' utility. ''showkey'' waits for a key to be pressed and if none is during 10 seconds it quits. To execute ''showkey'' you need to be in a virtual console, not in a graphical environment. Run the following command<br />
<br />
# showkey --keycodes<br />
<br />
and try to push keyboard keys, you should see ''keycodes'' being printed to the output.<br />
<br />
==== In Xorg ====<br />
<br />
The ''keycodes'' used by [[Xorg]] are reported by a utility called ''xev'', which is provided by the {{Pkg|xorg-xev}} package. Of course to execute ''xev'', you need to be in a graphical environment, not in the console.<br />
<br />
With the following command you can start ''xev'' and show only the relevant parts:<br />
<br />
$ xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'<br />
<br />
Here is an example output:<br />
<br />
38 a<br />
55 v<br />
54 c<br />
50 Shift_L<br />
133 Super_L<br />
135 Menu<br />
<br />
[[Xbindkeys#Identifying keycodes]]<br />
is another wrapper to "xev" that reports keycodes.<br />
<br />
If you press a key and nothing appears in the terminal, it means that either the key does not have a ''scancode'', the ''scancode'' is not mapped to a ''keycode'', or some other process is capturing the keypress. If you suspect that a process listening to X server is capturing the keypress, you can try running xev from a clean X session: <br />
<br />
$ xinit /usr/bin/xterm -- :1<br />
<br />
== Mapping scancodes to keycodes ==<br />
<br />
See the main article: [[Map scancodes to keycodes]].<br />
<br />
== Mapping keycodes to keysyms ==<br />
<br />
=== In console ===<br />
<br />
See the main article: [[Extra keyboard keys in console]].<br />
<br />
=== In Xorg ===<br />
<br />
See the main article: [[xmodmap]].<br />
<br />
== Laptops ==<br />
<br />
=== Apple MacBooks ===<br />
<br />
All the required information is available on the [[Apple Keyboard]] dedicated article.<br />
<br />
=== Asus M series ===<br />
<br />
In order to have control over the light sensor and the multimedia keys on your Asus machine, you should use the following command:<br />
<br />
# echo 1 > /sys/devices/platform/asus_laptop/ls_switch<br />
<br />
To have it run on boot create a [[Systemd#Temporary_files|Systemd tmpfile]]:<br />
{{hc|/etc/tmpfiles.d/local.conf|<br />
w /sys/devices/platform/asus_laptop/ls_switch - - - - 1<br />
}}<br />
<br />
{{Note|This may work also for other Asus notebook models.}}<br />
<br />
=== Asus N56VJ (or possibly others) ===<br />
<br />
If most of your special keys do not work, try loading the asus-nb-wmi kernel module with<br />
# modprobe asus-nb-wmi<br />
<br />
then check xev again. If you combine this with the acpi_osi="!Windows 2012" boot option, you may get weird results in xev, so try not using it. If this did fix things, make sure to make the module load at boot with methods described [[Kernel_modules#Automatic_module_handling|here]].<br />
<br />
=== Lenovo T460p (or possibly others) ===<br />
Out of the box, the backlight keys (on F5, F6) might not be available, even via the {{ic|/dev/input}} interface. To fix this, follow [[Backlight#Kernel command-line options]].<br />
<br />
== Gaming Keyboards ==<br />
<br />
Gaming keyboards have some special features which may cause them to "misbehave" in Linux.<br />
<br />
===Cooler Master CM Storm QuickFire TK===<br />
<br />
This keyboard has two features that could cause confusion in Linux: N-Key Rollover and the Win-Lock Key.<br />
<br />
N-Key Rollover can [https://bbs.archlinux.org/viewtopic.php?id=170877 cause problems with the Function keys]. To disable N-key rollover, hold down the FN lock key (next to right-ctrl) until it lights up, then hold Escape and press 6 to switch to 6-key rollover. Hold down the FN lock key to disable the Fn lock.<br />
<br />
The Win-Lock Key completely disables the Super (Windows) keys. Simply press the FN lock key and F12 together to toggle Win-Lock on and off.<br />
<br />
=== Corsair K series keyboards ===<br />
<br />
There is a winlock button on these keyboards that can disable the use of the Super (Windows) keys. This button is located at the top right of the keyboard next to the num and capslock buttons. CKB can be used to disable this functionality entirely preventing further locking. However, in a default state, simply pressing the button would enable the Super (Windows) keys again. <br />
<br />
=== Logitech G series G710 and 710+ ===<br />
<br />
This keyboard has a row of 6 programmable G keys. In order to use them as intended by Logitech, you need to install {{aur|sidewinderd}} and [[start]] {{ic|sidewinderd.service}}.<br />
<br />
== See also ==<br />
<br />
* [http://wiki.linuxquestions.org/wiki/Configuring_keyboards#Enabling_Keyboard_Multimedia_Keys Enabling Keyboard Multimedia Keys] - guide on LinuxQuestions wiki<br />
* [http://www.gentoo-wiki.info/HOWTO_Use_Multimedia_Keys Multimedia Keys] on [http://www.gentoo-wiki.info/ Gentoo Wiki Archives]</div>Joakinghttps://wiki.archlinux.org/index.php?title=User:Joaking&diff=506229User:Joaking2018-01-06T05:40:40Z<p>Joaking: Resume v0.1</p>
<hr />
<div>Hey, I like hot showers!</div>Joakinghttps://wiki.archlinux.org/index.php?title=Talk:ArchMap&diff=506228Talk:ArchMap2018-01-06T05:39:08Z<p>Joaking: /* Broken Link */ new section</p>
<hr />
<div>== Broken Link ==<br />
<br />
Subsection of [https://wiki.archlinux.org/index.php/ArchMap#Maps ArchMap#Map] named User Generated Maps has broken links in the second line, someone can repair it? or maybe we should delete it? [[User:Joaking|Joaking]] ([[User talk:Joaking|talk]]) 05:39, 6 January 2018 (UTC)</div>Joaking