date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,368,727,644,000 |
I just bought the keyboard in the title. As in all Linux distros it works great without any drivers. Unfortunately as in all Linux distros there's no software to configure the RGB lighting. I tried plugging in another Windows 7 pc i have to configure it but the software is W10 or later.There is also OpenRgb which sounds great,but their current build is broken on Arch linux which I run.I ended up reading this. And there one man recommends running the software in a w10 VM to configure it, which sounds great since the keyboard has an on board memory to store profiles,but the OP in the post says that plugging the keyboard in a W7 OS broke it because the firmware wasn't updated properly. I spent the whole day looking for any solutions and can't find anything that I can trust. What are my other options? I don't care about crazy lighting effects,I just want the colors to be stable instead of waving.
|
Update: Solved
I contacted the developers of OpenRGB and we worked a fix on their Arch build.
The software works ok,it has a small delay on light swiching. It has a delay when using Media keys as well.
| HyperX Alloy Elite 2 keyboard RGB issue |
1,639,855,708,000 |
This is NOT a duplicate of Changing the keyboard layout/mapping on both the console (tty) and X in an X/console agnostic way?, where a system-wide /etc/default/keyboard is discussed.
I'm looking to use a user-specific file, ~/.keyboard, with xkb settings that is used by both X (e.g., + LXDE), as well as by the (kernel) virtual consoles (VTs/TTYs).
As may be seen from cat $(which setupcon), virtual consoles can pick up a user-specific ~/.keyboard file (or a VARIANT thereof) if user's environment is preserved when setupcon is run:
sudo -E setupcon
where setupcon will (more or less) convert the xkb-based ~/.keyboard settings (XKBMODEL, XKBLAYOUT, XKBOPTIONS, etc.) into console keymap type (via ckbcomp) and loadkeys the result into consoles. If user's environment is NOT preserved,
sudo setupcon
then /etc/default/keyboard is picked up.
However, as far I can see, in X setxkbmap only picks up the system-wide /etc/default/keyboard file. The user-specific ~/.keyboard is not picked up by setxkbmap. But that is what I need. In other words, I'm trying to feed ~/.keyboard to setxkbmap. I would like to be able to have this done both at X login (e.g., with a line in ~/.xsessionrc), as well as to be able to make changes to ~/.keyboard while in X and have them applied through setxkbmap (without sudo), much like setxkbmap -option provides.
Note that I'm NOT trying to manually create a user-specific xkb directory hierarchy and use that with xkbcomp -I. However, if there is an automated way of doing that with ~/.keyboard as the input, that could be an acceptable workaround.
As of now, the only way I see is a hack: manually parse ~/.keyboard, extracting XKBOPTIONS and then write an equivalent setxkbmap -option for each. I cannot believe for this hack to be the only way, although seeing https://who-t.blogspot.com/2020/02/user-specific-xkb-configuration-part-1.html makes me question that belief.
As of now I'm using Debian with X (+ LXDE). I don't think it makes a difference for Wayland, but if it does, please explain.
|
In case it is useful to someone else, here is the hack I mentioned
above that I ended up using for now.
~/bin/setxkbmap.sh parses ~/.keyboard, extracting the xkb
settings, and runs equivalent setxkbmap command(s) in X.
~/bin/setxkbmap.sh may be called manually, or
automatically at X startup through a line in, e.g.,
~/.xsessionrc.
~/bin/setxkbmap.sh:
#!/bin/bash
# Parse ~/.keyboard, extracting the xkb settings, and run equivalent
# setxkbmap command(s) in X.
source ~/.keyboard
setxkbmap_cmd=(setxkbmap -model "${XKBMODEL}")
setxkbmap_cmd+=(-layout "${XKBLAYOUT}")
# Clear previously-set options first; otherwise, these will be
# appended to whatever is already there.
setxkbmap_cmd+=(-option)
# -r : do not allow backslashes to escape any characters
# -a array: assign the words read to sequential indices of the array
# variable ARRAY, starting at zero
IFS=',' read -r -a xkbopts <<< "${XKBOPTIONS}"
for opt in "${xkbopts[@]}"; do
setxkbmap_cmd+=(-option "${opt}")
done
"${setxkbmap_cmd[@]}"
~/.keyboard:
XKBMODEL="pc105"
XKBLAYOUT="us"
# ctrl: specifies options coming from /usr/share/X11/xkb/symbols/ctrl
# file.
XKBOPTIONS="ctrl:menu_rctrl,ctrl:nocaps,ctrl:swap_rwin_rctl,terminate:ctrl_alt_bksp"
~/.xsessionrc:
# ~/.xsessionrc is sourced by Xsession (a sh script), everytime an X
# session is started. See 'man xsession' for details.
# Explicitly use bash, as ~/.xsessionrc is called by sh (dash in
# Debian 9 GNU/Linux).
bash ~/bin/setxkbmap.sh
| In Debian, how to change keyboard mapping in a single USER-SPECIFIC file to be used by X (via setxkbmap) and (kernel) virtual consoles (TTYs)? |
1,639,855,708,000 |
I am installing arch linux, and I have the following problem:
I changed the keyboard mapping to fr_CH as I am using a swiss french keyboard. A lot of keys work, but a lot don't, including the "<" key, which is pretty essential to use in a terminal.
Some other keys behave strangely, in the general form that they simply aren't recognized, i.e. they type nothing.
It is pretty natural that the accented keys don't work in the terminal (at least I hope so), but for the others, how can I fix the keyboard layout?
|
What I omitted to mention, as I thought it was irrelevant, was that I was running linux on QEMU. The fact that the angle brackets and the accented keys were ignored seems to have been caused by a bug in it. Switching to Virtualbox has fixed the problem.
| Fix missing "<" key in swiss french keyboard layout |
1,557,474,098,000 |
I am using the following ~/.Xmodmap
keycode 133 = Mode_switch
keycode 134 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
keysym w = w W Prior
keysym s = s S Next
keysym a = a A Home
keysym d = d D End
keysym BackSpace = BackSpace BackSpace Delete
and it works as expected (eg. Win+D for End) for almost all applications, but not for PyCharm or IntelliJ. I suppose not for Java. How can that be fixed?
|
It's a plugin (IdeaVim) that gets in the way. It works as expected with the plugin disabled.
| Some applications ignore Xmodmap settings |
1,557,474,098,000 |
After messing with Keyboard settings and searching the net I haven't been able to find a solution. I am trying to include a header file in a program which is kinda hard if you can't close the angle brackets. Every time I try to type it a black rectangle shows up on my screen with a circle crossed through and it doesn't type the character. After trying all the other symbols on my keyboard, it seems this is the only one doing this.
I also used showkey to make sure it captured the key being pressed and it did.
keycode 42 press
keycode 52 press
keycode 52 release
keycode 42 release
I have a Vaio laptop and the keyboard is built in and my Input Source is English (US)
|
As it turned out, unbeknownst to me, there was a global keyboard shortcut mapped to > that wasn't working and that's why I would get that error message. I had to edit my shortcuts and take it off.
| Unable to type closing angle bracket in Kali Linux [closed] |
1,557,474,098,000 |
Mozc works and I am almost perfectly fine with it. The only problem is, that for some reason the system assumes that I had the US hardware layout whereby it actually is German.
This means, when I type yu, I get ず. ? leads to _.
What can I do for my system to use the correct hardware layout? (I.e. yu → ゆ and ? → ?)
|
The assumed layout of the hardware-keyboard does not change, if you switch from German or English to Mozc. This means, if you switch from English to Japanese, the assumed layout would still be English. But if you switch from German to Japanese, the assumed layout will be German even in Japanese.
So if you have a list of languages arranged in an order like German, English, Japanese, then Super+Space will bring you from German to English and then from English to Japanese resulting in Japanese having English as assumed hardware layout.
These are my solutions. Choose one:
remove any other languages but German and Japanese from the list
arrange the list in an order such that Japanese directly follows after German
don't use Super+Space but instead click on the icon and switch to Japanese directly from German
I assume, that this method works for any language just as it does with German but I didn't try it with other languages and can not guarantee anything.
| Japanese input with German hardware keyboard layout on Ubuntu |
1,473,853,467,000 |
So I use the following Zathura version under FreeBSD 10.3
$ zathura --version
zathura 0.3.4
(plugin) pdf-mupdf (0.2.9) (/usr/local/lib/zathura/pdf.so)
I remember that some time ago an earlier version of Zathura under Linux worked fine. But now I have the following extremely annoying problem:
If I open a pdf document and search it with / and type the search term fast1 then some of the letters of the search term go missing.
So this is not like the usual mildly annoying keyboard stuttering in which case the letters appear after some delay. It is far worse: it stuttering and the letters don't appear anymore.
1 well not really fast, the problem happens well before 300 kpm. And it depends on the document. If it is a heavy 20 MB pdf file, the problem already exists with extremely slow typing.
|
It is a bug in the Girara library, which Zathura uses. It is still present in the version 0.2.5.
So to fix the problem, download version 0.2.6 of Girara from here, compile and install.
| Missing letters in zathura's search |
1,473,853,467,000 |
I'm trying to remap the buttons on a peripheral that incorrectly has its buttons mapped to F keys. To remedy this I'm trying to use a udev hwdb file to remap keys only on specif devices.
So far my rule looks like:
keyboard:usb:v11AAp*
[remapping rules]
This rule works, but both the keyboard and peripheral are made by the same manufacturer, so I need to fill in the product as well. I've tried using the product specified in /proc/bus/input/devices and udevadm info --attribute-walk --name=[path to input device] | grep idProduct (these are both the same id, which is a good sign) but then the rule applies to neither the keyboard or peripheral.
The resulting looks like:
keyboard:usb:v11AAp11AA
[remapping rules]
Is there something wrong with my syntax here? How does one properly define a hwdb rule for only a specific product?
|
The only issue was that after the product ID the '*' is still required, so in the end the rule looked like:
keyboard:usb:v11AAp11AA*
[remapping rules]
Simple syntax error.
| How to specify a specific product in udev hwdb file? |
1,473,853,467,000 |
I am trying to follow this guide to using a Logitech G600. I have (using a windows computer) mapped each key combo on the mouse to something on a normal keyboard. I have set up some rules in /etc/udev/hwdb.d/ to map the scancodes to some extended keycodes (found here). All of this works fine, except that X doesn't recognize keycodes greater than 255. So, the line
KEYBOARD_KEY_7001d=zenkakuhankaku
causes the mouse button to spit out keycode 400 (via showkey) and xev doesn't recognize the key at all.
I have also tried running xmodmap -pke | grep "= XF86" to show the keycodes that are less than 255 that should be available, but can't figure out how to map the scancode to those keycodes (i.e. KEYBOARD_KEY_7001d=XF86Explorer leaves the key mapped to "z").
Is there a way to map a scancode directly to a numeric keycode (in the hwdb file - I have no desire to map everything that issues the letter "a" to XF86Calculator)?
Is there some other way to map the scan code to one of the unused XF86 codes?
|
Okay, so here's what I ended up doing. I pulled the actual key names from /usr/include/linux/input.h. There's a section where the keycode names are defined that looks like:
#define KEY_RIGHTMETA 126
#define KEY_COMPOSE 127
#define KEY_STOP 128 /* AC Stop */
#define KEY_AGAIN 129
#define KEY_PROPS 130 /* AC Properties */
I used the lowercase xxx in KEY_xxx (so, "compose", "stop", etc.) as the key names. I picked things that looked like they wouldn't really be used elsewhere (like KEY_LEFTCTRL).
Then, like the article linked suggested, I used xbindkeys -km to get the appropriate keycode numbers and used xbindkeys to map them.
| How to map extended buttons on mouse? |
1,473,853,467,000 |
I'm not necessarily looking for a solution, although that would be great... mainly an explanation.
On a MacBook 1.1 using rEFInd boot manager, if I boot Mint 17 Cinnamon 32-bit via the Grub bootloader, my keyboard works fine. If instead, I use rEFInd to select the vmlinuz kernel (with EFIstub support) for Mint 17, the keyboard doesn't work at the Mint login screen.
I've tried passing various individual parameters to the kernel, via rEFInd based on recommendations for other hardware:
iommu=soft
iommu=pt
acpi=off
I noticed that grub seems to pass $vt_handoff so I tried that as well.
All had no apparent effect on the keyboard; it still didn't work.
Of possible relevance, the kernel and initrd live on a ext4 partition, so rEFInd is using additional drivers to read them for EFI-stub booting. grub.efi is on my ESP (Fat32) and my firmware requires no additional drivers to read it.
What can I do to diagnose this problem? What might be the cause?
|
From tips on Booting Linux inside a MacBook using grub and EFI:
In Debian/squeeze you may need to load some modules quite early (in particular if you have a crypted root partition: otherwise the keyboard will not work at the moment when the initrd will ask you the password). To this end, append to the file /etc/initramfs-tools/modules these lines:
#as suggested by http://grub.enbug.org/TestingOnMacbook
fbcon
#and I would further add
hid_apple
hid
applesmc
input_polldev
#moreover Vladimir 'phi-coder/phcoder' Serbinenko
#told me also to add
uhci_hcd
ehci_hcd
ohci_hcd
then regenerate the initrd
update-initramfs -u
| Mint 17 via EFI stub on 32-bit MacBook, keyboard doesn't work; fine with Grub bootloader |
1,473,853,467,000 |
So I just installed Debian on my (other) computer, and I've run into an interesting problem: once I log in, the keyboard and mouse buttons don't work. I can move the mouse, but clicking does nothing, as do keyboard shortcuts. I installed from a 7.1.0 64x network CD, with /home, /, /usr, /var, etc. spread across multiple drives (I have a SSD and two HDD's). I know the mouse and keyboard work, as I've used them in Windows.
|
Probably won't like this answer, but I ended up skipping Debian and installing Window$ 7 instead for a multitude of reasons. This just happened to be the last straw.
That said, I have had numerous issues with network CD installs in the past, and a full installation disk may provide better results. Sorry to take your time!
| After I log in, Debian stops registering input |
1,505,584,976,000 |
Barcode scanners behaves like a usb keyboard device and my case was no different at the beginning. I opened a nano screen, plugged the scanner through usb port, read a barcode and saw the string what is written right under the barcode.
I don't know how, but right now it doesn't work that way. The scanner (the keyboard-like device) sends some garbage to the system.
I wrote a simple NodeJS code that dumps what is captured:
data: <Buffer 04 00 62 60 5b 00 00 00> string: b`[
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 5f 5b 00 00 00> string: b_[
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 60 62 00 00 00> string: b`b
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 5c 5d 00 00 00> string: b\]
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 5d 5a 00 00 00> string: b]Z
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 5c 5d 00 00 00> string: b\]
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 04 00 62 5c 61 00 00 00> string: b\a
data: <Buffer 00 00 00 00 00 00 00 00> string:
data: <Buffer 00 00 28 00 00 00 00 00> string: (
data: <Buffer 00 00 00 00 00 00 00 00> string:
I was expecting a string, like SIP-4-1. (Here is the showkey output of the same barcode)
Same scanner works correctly on Windows. I guess it's related with a keyboard mode or something. How can I change the mode for a specific USB keyboard device?
|
Your scanner is not sending garbage. Those are perfectly conventional input reports for a conventional USB HID keyboard device with the conventional 8-byte "boot" report descriptor.
Decoding them, it can be seen that your scanner is not sending the keys for "S", "I", and so forth directly. Rather, it is simulating entering them with the ⎇ Alt key. It is making several rather poor assumptions about the operating system in doing so, any or all of which could easily be faulty.
For example:
The input report 04 00 62 60 5b 00 00 00 is the keys with the USB HID usage codes E2, 62, 60, and 5B all pressed simultaneously.
E2, 62, 60, and 5B are the USB HID usage codes for ⎇ Left Alt, Ins/0, ↑/8, and PgDn/3.
08310 is the code for "S".
The input report 00 00 00 00 00 00 00 00 indicates that all of those keys have been released.
The rest does indeed decode to "I", "P", "-", "4", "-", and "1" all typed in this way as ⎇ Alt plus three decimal numbers. (The final two input reports are press and release of ⮠ Return.)
You can see the several broken assumptions here.
The scanner is assuming that the keyboard driver parses the input report in a particular direction. This is not guaranteed, and the scanner should properly be generating individual reports for Ins/0, ↑/8, and PgDn/3 being pressed and released in turn with the modifier key held down throughout. It is relying upon an accident of implementation, and what the scanner is actually sending is all four keys being pressed and released simultaneously.
The scanner is assuming that ⎇ Left Alt is the key to use for this. But in some operating systems and keyboard layouts it might be ⇮ Alt Gr/⎇ Right Alt instead, which is E6 (encoded as 40 in the first byte of the input report) not E2.Indeed, your current operating system, keyboard driver, and keyboard layout might not even support entering characters using codes like this at all. (FreeBSD's syscons kernel terminal emulator does, for example. So too does Microsoft Windows, of course. But the nosh toolkit's console-fb-realizer, GUIs like LXDE and XFCE4, and it seems all available GUIs on Ubuntu; do not.)
The scanner is assuming that NumLock is off. If NumLock is on, it should be faking one of the shift keys being pressed as well, in order to reverse the sense of the lock.
With some scanners, this stuff is modifiable by scanning special "control" barcodes. That is probably what happened here. You scanned a "control" barcode that switched the scanner into an operational mode that your operating system, keyboard driver, and keyboard layout cannot cope with. In which case, you need to consult your scanners' manual and find the control code that turns the behaviour back off.
For example: With an NLS-HR32 series scanner, this is the effect of putting the scanner into "ALT+Keypad mode 2" or "ALT+Keypad mode 3" and you would need to switch back to "disable ALT+Keypad" or "ALT+Keypad mode 1".
| How to put a specific keyboard device into ascii mode? |
1,505,584,976,000 |
ctrlshiftu followed by the hex value of a Unicode character enters that character. For example, ctrlshiftu41 enters 'A', whose value is 0x41 in hex and 65 in decimal.
There's also the compose key, which lets you enter digraphs (e.g. compose keye^ produces 'ê').
Unfortunately, neither of these works similarly to alt codes in Windows (where alt65 produces 'A'). As a result, it's challenging to develop muscle memory.
Is there a solution to this?
|
You could install a Compose Key utility on your Windows system. That's my preferred approach as I can create the same custom key combinations on my Linux-based and Windows platforms.
My preferred solution used to be AllChars (Sourceforge) but as it no longer works reliably on Windows 10 et seq, I moved to WinCompose (README) about six months ago.
As this is a Windows solution rather than a Linux/UNIX one I'll not go into more detail here, but suffice to say it works very well.
| Entering special characters the same way on Windows and Linux |
1,505,584,976,000 |
I'm using Debian 9 x64 with the dwm window manager. I don't use Gnome, KDE, Xfce, or any other desktop environment; it's just the window manager.
I configured my keyboard layout to use the Generic 105-key international keyboard. I've tried AltGr (the right Alt key) plus various alt codes, to no avail. I've also tried AltGr and then " u or u ", with similarly disappointing results.
Ideally I would be able to type these characters anywhere, including text editors (all of mine support Unicode), web browsers, etc. I don't use LibreOffice, so some of the LibreOffice-specific solutions I find aren't enough.
|
You're missing a step. You need to set a Compose key first. For example, to set the right Alt key as the Compose key:
setxkbmap -layout us -option compose:ralt
Then:
Press Compose (on my keyboard it's labelled Alt Gr) and release it.
Press the sequence of keys that correspond to the letter/diacritic you want. These are sometimes intuitive, sometimes not. Sometimes the order doesn't matter, either, e.g. in the case of accents.
To insert ß, press s s
For umlauts, e.g. ü, press u "
For accents, e.g. á, press a ' or ' a
For ñ, press n Shift ~
You can see the full list on Wikipedia or in the image below:
| How do I type German or Spanish characters in Linux when I don't use a desktop environment? |
1,505,584,976,000 |
I am trying to get this layout working
Should I put something in /etc/sway/inputs/default-keyboard ?
I tried to get the information with man 5 sway-input and swaymsg -t get_inputs but it did not help.
I am not even sure which configuration file the doc refers to.
I am tired of wasting my time on this issue and would really love some help
EDIT: My solution, even if I accepted the answer one that helped me the most:
In the file /etc/sway/inputs/default-keyboard
Add the following block
input type:keyboard {
xkb_layout us
xkb_variant intl
}
|
The configuration file referenced by man 5 sway-input is the sway configuration file in ~/.config/sway/config or ~/.sway/config or other allowed locations. You can find the default configuration in /etc/sway/config.
To set your chosen layout(s) it should be enough to add something similar to this in the configuration:
input type:keyboard {
xkb_layout fr,us # two layouts
xkb_variant oss,intl # their respective variants
xkb_options grp:sclk_toggle # toggle between layouts with the scroll-lock button
xkb_numlock enabled # enable numlock when logging in
}
You can find the codes for all layouts, variants and toggle keys listed in man xkeyboard-config.
| Sway input, how to get the 'us intl' layout (US keyboard international variant) |
1,505,584,976,000 |
What is the keyboard shortcut for taking a simple screenshot in Debian 9.12 Stretch with XFCE 4? I have tried different hotkey combinations suggested online, but none works:
PrntScrn
Ctrl + PrntScrn
Alt + PrntScrn
Shift + PrntScrn
Ctrl + Shift + PrntScrn
Ctrl + Alt + PrntScrn
etc.
|
I will be referencing this AskUbuntu post about how to create a keyboard shortcut for the purpose of creating screenshots using the XFCE desktop environment.
Go to:
XFCE Menu > Settings > Keyboard > Application Shortcuts
and add the xfce4-screenshooter -f command to use the Print Screen key in order to take fullscreen screenshots.
Looking at the xfce-screenshooter documentation, you can see all the different options for taking screenshots.
The -w option
The -w option allows you to take a screenshot of the active window.
The -f option
The -f option allows you to take a screenshot of the entire screen.
The -r option
The -r option allows you to select a region to be captured by clicking and dragging a rectangle over the area of screen that you wish to capture, before releasing the mouse button.
The -d option
The -d option followed by a positive integer allows you to set the delay before taking the screenshot when the -w, the -f or the -r option is given.
The -s option
The -s option followed by the path to an existing folder allows you to set where the screenshots are saved. This option only has an effect if the -w, the -f or the -r option is given.
The -o option
If the -o option is given, followed by an application name, the screenshot will be saved to the system's temporary directory and opened with the application whose name is to be given after -o. This option only has an effect if the -w, the -f or the -r option is given.
The -u option
If the -u option is given, the screenshot will be hosted on Imgur. See above for more details. This option only has an effect if the -w, the -f or the -r option is given.
There are a lot of different options available to you that you can quickly default to. You can also just have the hotkey of your choice launch xfce-screenshooter with no options to open up the application and allow you to choose between them in a graphical manner.
I will also include a link to the Debian Wiki on how to create a screenshot.
In Conclusion
Using the Keyboard > Application Shortcuts menu will allow you verify what your keyboard shortcuts are and allow you to add, remove, and edit them.
| Taking screenshots in XFCE 4 (Debian 9.12 Stretch) |
1,505,584,976,000 |
How can I send F1..F12 especially F10 in gtkterm?
I have to press F10 at the right moment to select the boot menu of an APU2 system.
|
This may not be the answer you're looking for, but don't use gtkterm.
Use eg. screen /dev/ttyS0 from a terminal, and if that terminal is the "GNOME Terminal", disable the F10 accelerator key from Edit -> Preferences.
If you insist on using gtkterm, you may try pressing ESC[21~ in order, but it may not work if don't press them fast enough ;-)
Update:
Alternatively, add a macros = F5::<literal-esc>[21~ line in the [default] section of ~/.gtktermrc and then press F5 in order to send an F10:
$ perl -ne 'print; print "macros = F5::\e[21~\n" if /^\[default/' -i ~/.gtktermrc
| How to send F10 with gtkterm? |
1,505,584,976,000 |
I have this macro keyboard.
On Windows it works as expected, but under Linux (both a Raspberry Pi 0w with the latest OS and a desktop installation of Debian 12) it doesn't. It is detected as far as I understand, but I get no events from it.
$ sudo dmesg | grep hid
[ 881.432956] hid-generic 0003:0483:5752.000E: hiddev0,hidraw1: USB HID v1.11 Device [Vaydeer 9-key Smart Keypad] on usb-0000:00:15.0-2/input0
[ 881.494769] hid-generic 0003:0483:5752.000F: input,hidraw2: USB HID v1.11 Keyboard [Vaydeer 9-key Smart Keypad] on usb-0000:00:15.0-2/input1
[ 881.496033] hid-generic 0003:0483:5752.0010: hiddev1,hidraw3: USB HID v1.11 Device [Vaydeer 9-key Smart Keypad] on usb-0000:00:15.0-2/input2
[ 881.559126] hid-generic 0003:0483:5752.0011: input,hidraw4: USB HID v1.11 Mouse [Vaydeer 9-key Smart Keypad] on usb-0000:00:15.0-2/input3
$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: AT Translated Set 2 keyboard
/dev/input/event1: Sleep Button
/dev/input/event10: HDA Digital PCBeep
/dev/input/event11: HDA Intel PCH Front Headphone
/dev/input/event12: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event13: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event14: HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event15: Vaydeer 9-key Smart Keypad
/dev/input/event16: Vaydeer 9-key Smart Keypad Mouse
/dev/input/event17: Vaydeer 9-key Smart Keypad Consumer Control
/dev/input/event18: Vaydeer 9-key Smart Keypad System Control
/dev/input/event2: Lid Switch
/dev/input/event3: Power Button
/dev/input/event4: ELAN0501:00 04F3:305B Mouse
/dev/input/event5: ELAN0501:00 04F3:305B Touchpad
/dev/input/event6: Video Bus
/dev/input/event7: Acer WMI hotkeys
/dev/input/event8: PC Speaker
/dev/input/event9: HD WebCam: HD WebCam
Select the device event number [0-18]: 15
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x483 product 0x5752 version 0x111
Input device name: "Vaydeer 9-key Smart Keypad"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 1 (KEY_ESC)
Event code 2 (KEY_1)
Event code 3 (KEY_2)
Event code 4 (KEY_3)
Event code 5 (KEY_4)
Event code 6 (KEY_5)
Event code 7 (KEY_6)
Event code 8 (KEY_7)
Event code 9 (KEY_8)
Event code 10 (KEY_9)
Event code 11 (KEY_0)
Event code 126 (KEY_RIGHTMETA)
...
Event code 127 (KEY_COMPOSE)
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Event type 17 (EV_LED)
Event code 0 (LED_NUML) state 0
Event code 1 (LED_CAPSL) state 0
Event code 2 (LED_SCROLLL) state 0
Event code 3 (LED_COMPOSE) state 0
Event code 4 (LED_KANA) state 0
Key repeat handling:
Repeat type 20 (EV_REP)
Repeat code 0 (REP_DELAY)
Value 250
Repeat code 1 (REP_PERIOD)
Value 33
Properties:
Testing ... (interrupt to exit)
If I try with any other keyboard, with evtest I can see the key pressed events, with this one I get nothing.
The product is not explicitly declared to be compatible with Linux, but I never encountered an incompatible keyboard before. Is there anything I could try to make it work, or at least to dig deeper into the problem?
|
I ran into the same problem
when trying out this thing on a Raspberry Pi.
After finding this post, I tried having a look at
the corresponding /dev/hidraw* inputs
to see whether data arrives there.
So I did a cat /dev/hidraw7
and actually saw some events being received.
And, to my total surprise,
the keyboard miraculously started to work as expected.
Turns out it just works
as soon as something is listening to the raw interface!
Run a simple cat /dev/hidrawX > /dev/null &
for the 4 inputs the keyboard provides after bootup,
and everything works.
Keyboard inputs, macros, mouse inputs
and even media and volume controls.
(Opening applications and web pages requires the software though,
unsurprisingly.)
I wrote this simple script to run cat on all relevant hidraw interfaces,
inspired by a blog post on how to map them to device names
by Arvanitis Christos:
#!/bin/bash
FILES=/dev/hidraw*
for f in $FILES
do
FILE=${f##*/}
DEVICE="$(cat /sys/class/hidraw/${FILE}/device/uevent | grep HID_NAME | cut -d '=' -f2)"
if [ "$DEVICE" == "Vaydeer 9-key Smart Keypad" ]
then
printf "%s \t %s\n" $FILE "$DEVICE"
cat /dev/${FILE} > /dev/null &
fi
done
When executed, it should output the four interfaces
belonging to the macro keyboard.
Either run it as root
or give your user access to the interfaces
with a udev rule like this:
SUBSYSTEM=="hidraw" ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5752", GROUP="yourgroup", OWNER="youruser", MODE="0660"
Of course this is still just a dirty hack, found by trying out random things,
and I have no idea why it works at all.
I would still be interested in the actual reason for this,
so if anyone who knows what he is doing wants to enlighten me – please do.
| keyboard detected but no keys events are received |
1,505,584,976,000 |
On X11, doing something like
xset r rate 120 240
it's possible to set the repeat rate for the entire keyboard.
But I wonder if it's possible to do the same thing for each individual key? (Ie. to have different keys have different repeat rates.)
Perhaps using some obscure XKB configuration, or the XKB C API, or some evdev/ioctl hack?
And, if not, how could you could do this if you have access to the keyboard firmware and can control the USB HID code that the keyboard sends?
I know this must be possible somehow because the modifier keys seem to have a zero repeat rate, while the rest of the keys have a non-zero repeat rate.
One idea that comes to mind is to register different sets of keys as different USB devices, and then set different repeat rates for different devices, if that can be done at the USB level.
|
Unfortunately, this doesn't seem to be possible without some serious effort.
I'm not sure of all the differences between PS/2 and USB keyboard communication protocols, but I imagine that they're likely pretty similar in the way that they operate. Given that assumption, what you're trying to do is not really possible at the hardware level and would be pretty difficult to do at the OS level.
At the hardware level, the problem is that the auto-repeat rate is set by sending a command to the keyboard and that command applies to all repeating keys. There is no command to set the repeat rate for individual keys.
At the OS level, you'd have to rewrite the keyboard input handler, which is either directly part of the kernel or a driver that gets loaded into the kernel. The keyboard sends an interrupt for every key press and key release, but it also sends an interrupt for each time the key auto-repeats when held down. So the driver would need to ignore the repeated key interrupts and artificially generate keypress events at the desired rate for that key until a key-release interrupt is received.
Alternatively, you could make code changes to Xorg to implement this functionality at the user level.
| Set individual auto-repeat rate for each key |
1,505,584,976,000 |
For the purposes of an app I'm developing, I need to temporarily disable autorepeat (with xset r off), and then restore it back to its original state. Can I easily (like with a terminal command) check if it is on or not? I wouldn't want to xset r on indiscriminately in case the user had disabled autorepeat on their own before.
|
if xset q | grep -q 'auto *repeat: *on'; then ...
| Check if autorepeat is enabled |
1,505,584,976,000 |
I just installed open SUSE tumbleweed in this hp 15-bs0xx, but the numerical keypad is not working as numerical, instead it moves the mouse cursor.
I have tested this in mate and xfce environments.
At the same time the Fn keys (Fn+any F key) did not work too.
|
If you're sure mouse keys isn't affecting your keyboard, the hacky way you could try is to manually set each key.
run xev to find the keycode for a key.
CtrlF this keycode in /usr/share/X11/xkb/keycodes/evdev to find corresponding key symbol (might be more than one, look for KP_4 for key 4, etc...).
add key <KEYSYM> { [ NUMBER ] }; to the xkb_symbols section of your keyboard layout file (eg. /usr/share/X11/xkb/symbols/us for default US layout).
repeat for each keypad key and reboot to apply changes.
Note: You might want to try mapping a key with xmodmap -e 'keycode KEYCODE = NUMBER' way first to see if it actually works before trying the steps above to make changes permanent.
| numerical keypad not working on laptop |
1,505,584,976,000 |
Is it technically possible to write a kernel module to physically connect a PS/2 keyboard to a USB port using a passive converter? If not, why?
(If I simply wanted my keyboard to work I would buy an active adapter, but the purpose of this question is to learn something)
|
No.
No USB standard implements backwards compatibility with PS/2. PS/2 mice which predate USB do not contain time-travelled USB descriptors. Nor can an arbitrary USB port be accessed as a GPIO.
USB descriptors: https://blog.digital-scurf.org/posts/stm32-and-rtfm/
https://en.wikipedia.org/wiki/Gpio & https://en.wikipedia.org/wiki/Bit_banging
(Wiki links aren't going to be great, but the introductions here should give the idea).
Converting the opposite way round, passive USB to PS/2 converters require USB support in the USB input device, and recent USB devices don't bother with it: https://en.wikipedia.org/wiki/PS/2_port#Conversion_between_PS.2F2_and_USB
| Kernel module to connect ps/2 keyboard to usb? |
1,505,584,976,000 |
I would like to implement some Greek characters into my keymap in the console (tty). I am using Arch Linux and the directory I am working in is /usr/share/kbd/i386/qwerty/uk.map, although I don't know if this is the right place to deal with the problem.
The expected result should be:
Key pressed: d
Shift (or Caps Lock) pressed + letter: D
Alt Gr + letter: δ
Shift (or Caps Lock) pressed + Alt Gr + letter: ∆
...just like this, but in the console.
Any clues?
|
You should be able to leave the original keymap alone and just do a second loadkeys with some extra explicit changes. For example, you may currently see
$ dumpkeys|grep ' 30'|tr -s ' '
keycode 30 = +a +A Hex_A Control_a Control_a Meta_a Meta_Control_a
So you want to change two columns of this to the greek alpha character, which is unicode U+03B1 and U+0391. If you do
$ sudo loadkeys - <<\!
alt keycode 30 = U+03B1
shift alt keycode 30 = U+0391
!
and run dumpkeys again you should see the change:
keycode 30 = +a +A Hex_A Control_a Control_a alpha Alpha Meta_Control_a
As you can see, my system even knows the unicodes as keysyms alpha and Alpha which I could have used instead. Simply create a file of all the changes you want to make and call loadkeys with that filename to make the modifications.
| Modify keymap to add Greek keys when AltGr + letter in the console |
1,505,584,976,000 |
I have a specific problem with keyboard shortcuts and haven't gotten a solution for it so far, so now i need to know which module within a Linux distribution is responsible for handling keyboard shortcuts.
By handling keyboard shortcuts, I mean, listening to the key pressing\releasing events.
|
That depends: on the Linux console, the responsible "module" is the kernel. In X, the X server interprets the underlying keyboard events and passes some of those on to clients as key press and release events.
That is as far as it goes. In a terminal emulator, applications do not read events (unless they open a special connection to the console). They read characters.
| Which module in a Linux distribution is responsible for keyboard shortcuts? [duplicate] |
1,505,584,976,000 |
When I boot Ubuntu, Arch Linux or so, the string ^[[6~ is printed very often. I suspect that a key is stuck, but I don’t know which.
|
The code ^[[6~ is generated by Page Down key.
You can check it at the command-line in bash by hitting Ctrl-v + Pg Dn.
| On boot `^[[6~` is printed |
1,505,584,976,000 |
I just installed Yellow Dog on my PowerBook G4, and it worked, and noticed my mac keyboard. Then, suddenly, the layout went wrong. Most keys don't do anything, and I have letters instead of arrow keys. I logged off to see if it helps, but then I couldn't even log on again (have to type my username). I'm writing this on OSX. Is there any way to get the layout back?
P.S.
I just rebooted a second time, and everything works - I'd still like to know what happened though...
|
You'll laugh at me for this one - so stupid!
It turns out I had num lock on, but the light was to weak to see it was on. I must have accidently pressed it at some point. #-o
| Why is my Yellow Dog keyboard layout wrong? [closed] |
1,505,584,976,000 |
I would like to have a way of switching the audio output device (internal speakers/headphones to bluetooth speakers etc) by keyboard actions (which I usually can do without searching, finding and putting my glasses on my nose).
Plasma tray elements can be activated with shortcuts, and thus I can connect, disconnect, switch between bluetooth devices by keyboard, because when the drop-down menu is visible, selection with arrow-keys and Enter to activate does the trick.
But that doesn't work when trying to switch between audio devices themselves. I can bring forth the audio volume tray element with a shortcut:
but further interaction by keyboard is limited to volume level.
There is a widget called audio device switcher which brings the options more to the front, but its shortcut does nothing. Overall, it lacks keyboard interaction.
The closest thing to what I want is to simply disable bluetooth by the first method IF that device is the one that is currently playing...
|
As a variant - you can go by way of scripts/launchers and set the hotkeys to run this scripts.
First you need to get a list of "sinks", which is how system knows audo devices:
pactl list sinks
One would have state "running" other in "suspended". Take a note of Name fields in this printout.
The script you will start from hotkey will execute a switch:
pactl set-default-sink SINK-NAME
Using the "Name" field from the list of sinks. This will switch all audio output to specified device.
Assuming you have just two sinks, you can do a script like this
#!/bin/bash
sink1=alsa_output.pci-0000_00_01.1.hdmi-stereo-extra1
sink2=alsa_output.usb-GeneralPlus_USB_Audio_Device-00.iec958-stereo
sink_current=`pactl get-default-sink`
case $sink_current in
$sink1) pactl set-default-sink $sink2 ;;
$sink2) pactl set-default-sink $sink1 ;;
*) pactl set-default-sink $sink1 ;;
esac
Put it into you personal bin, and add a hotkey launcher.
| Switch audio output by keyboard in KDE Plasma |
1,505,584,976,000 |
I am customizing a Linux system using a Linux kernel of 6.4.0. After booting, why is the keyboard not working? # 1. The disk is externally connected through a USB interface. If I enter the Linux live environment, the keyboard can be used.
I compiled the keyboard driver and USB interface driver into the kernel, such as # 2 and # 3.
#1
#2
#3
reply Spacerat:
add keyboard menu:
|
Looks like you're using gentoo (?)
anyway, check: CONFIG_USB_* (like for example: CONFIG_USB_XHCI_HCD=y for USB3) in your kernel config.
| Why can't keyboards be used in customized linux? |
1,505,584,976,000 |
I'm using NixOS 23.05.885.bb8b5735d6f. I usually configure two language selections set by input sources within GNOME Settings:
[x80486@uplink:~]$ gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'us'), ('xkb', 'es')]
I'm trying to see if there is any configuration within services.xserver to achieve the same result. So far the only key that looks like it might do it is services.xserver.extraLayouts, but I can't get it to work.
Any clues how to accomplish this?
|
This was as simple as adding another value for layout within services.xserver in /etc/nixos/configuration.nix:
{ config, pkgs, ... }:
{
...
services = {
...
xserver = {
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
enable = true;
excludePackages = with pkgs; [ xterm ];
layout = "es,us";
...
xkbOptions = "numpad:microsoft";
};
};
...
}
Initially, I had layout = "us". After adding es, rebuilding the configuration, and restarting the system (probably logging off and on could work as well), I can see both input sources in GNOME's top bar — and also verifiable with gsettings.
[x80486@uplink:~]$ gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'es'), ('xkb', 'us')]
NOTICE: I had to reset this settings previously (gsettings reset org.gnome.desktop.input-sources sources) in order to see the correct values applied when building a new NixOS configuration/generation.
| Declaratively configure multiple input sources under NixOS |
1,505,584,976,000 |
I've written a custom keyboard layout in xkb and I would like to incorporate volume and brightness control as well as the standby and maybe shutoff function into it so I don't have to reach for the highest row of keys when I want to change them. But I don't know the xkb names of these functions. Does someone know them so I can put them into my xkb-layout?
|
I think the Xorg keycodes you search are located in this file:
/usr/share/X11/xkb/symbols/inet
So in your case:
volume down --> XF86AudioLowerVolume
volume up --> XF86AudioRaiseVolume
brightness down --> XF86MonBrightnessDown
brightness up --> XF86MonBrightnessUp
standby --> XF86Standby
Here is some documentation if needed.
Hope this helps !
| Xkb names of brightness, volume control and standby functions |
1,505,584,976,000 |
So I made a simple Bash script that can use your keyboard LEDs (numlock and capslock) to transmit data (inspired by LTT from their "Do NOT Plug This USB In! – Hak5 Rubber Ducky" video). This is the script I have:
#!/bin/bash
for i in `cat /dev/stdin | perl -lpe '$_=unpack"B*"' | sed 's/./\ &/g'`
do export E=`expr $E + 1`
echo "Bit number $E has a value of $i"
if (( $i == 0 ))
then
xdotool key Caps_Lock
sleep 0.1
xdotool key Caps_Lock
else
xdotool key Num_Lock
sleep 0.1
xdotool key Num_Lock
fi
done
It does something different, and that is have the LEDs for the keyboard common low instead of common high (meaning the LEDs are off longer compared to Linus' video). However, it has a flaw. It waits until an EOF from stdin, which isn't what I'd like. I'd like it to act like minimodem, reading data while it's being written to stdin (well, after a newline, at least). Is there a way I can do this without:
changing programming languages, and
without breaking the entire script?
Thank you in advance.
|
There are many ways to do this. Since you're already using perl for part of the job, probably the easiest method is to do the entire thing in perl, with the Term::Readkey module. For example:
#!/usr/bin/perl -l
use Term::ReadKey;
# trap INT so we can reset the terminal on ^C
$SIG{INT} = sub { exit };
ReadMode 3;
while ($_ = ReadKey 0) {
last if m/\cD/;
@bits = split //, unpack "B*";
for my $i (0..$#bits) {
print "Bit number $i has a value of $bits[$i]";
if ($bits[$i] == 0) {
system("xdotool key Caps_Lock; sleep 0.1; xdotool key Caps_Lock");
} else {
system("xdotool key Num_Lock; sleep 0.1; xdotool key Num_Lock");
};
};
};
END {
ReadMode 0;
};
Alternatively, if you don't want to install a module from CPAN, you can use stty as described in perldoc -f getc to make getc read a single character at a time. Or use the setattr() function from the POSIX module (which is included with perl) instead of running stty.
However, since you want to do it in bash (and cat & perl & sed), you could try something based on this:
First, realise that you never need to use cat to pipe data into a program which can already read from stdin (as perl and sed and almost everything else can do).
Then realise that whenever you're piping perl's output into sed, you're probably doing it wrong and can do whatever you're doing in sed in the perl script instead. perl also has a s/// operator, just like sed.
Remember that bash has arrays, and you can read the output of a program into an array with the bash mapfile built-in and process substitution.
and
bash can read a single character at a time with read -n 1.
#!/bin/bash
while read -n 1 char ; do
case "$char" in
$'\004') break ;; # Ctrl-D
esac
# This uses perl to print each bit separated by a newline. we could do it with s/// in perl,
# but here i'm using split and join. the output from perl is read into bash array $bits.
mapfile -t bits < <(printf '%s' "$char" | perl -lne 'print join("\n", split //, unpack"B*")')
# that expr stuff is incredibly ugly. and decades obsolete for shell arithmetic.
# i'm going to use let instead because I also find (( i=i+1 )) to be incredibly ugly.
count=0
for i in "${bits[@]}" ; do
let count+=1
echo "Bit number $count has a value of $i"
if [ "$i" -eq 0 ] ; then
xdotool key Caps_Lock
sleep 0.1
xdotool key Caps_Lock
else
xdotool key Num_Lock
sleep 0.1
xdotool key Num_Lock
fi
done
done
| How to make Bash not wait for EOF? |
1,505,584,976,000 |
Alt+Backspace works in terminals which often leads to me mistakenly trying Alt+Delete which then adds a ~. What exactly is happening there?
|
It is a remnant of unrecognized scan-code.
A button on a keyboard sends one or several bytes indicating which button was pressed. These bytes are going through keyboard driver, which does some conversion, and eventually caught by the application (terminal in this case). The application is trying to recognize which hot key is that set of bytes is and act accordingly. If not recognized, application usually ignores such string, or you can have a "strange behavior".
To learn which bytes you are getting for which button or combination of buttons you can do cat /dev/tty. It will print you a set of symbols for each button - as the driver reports them to an application.
After you learn which combination of symbols are sent for that particular combination of buttons you can go to application's configuration file and add it, or fix it if the app is expecting different set of characters for a hotkey.
Due to a historically large variety of physical terminals with different keyboards, there are many variations of possible scan codes for the logically same keys. So the database terminfo came into being. It knows a lot of actual terminals (physical ones) and knows which string of characters is sent for which key combination. And if you want to teach your terminal a new hotkey, you would need to write you own terminfo entry, and choose with TERM environment variable.
The fact that you seeing just one symbol ~, means your current terminal with your current TERM somehow recognizes and does something with part of the string sent by keyboard driver to the terminal, and prints the remaining part of the sequence.
| What exactly is the output in my terminal when I try to use Alt+Delete to remove text? |
1,505,584,976,000 |
I am using MX GNU/Linux v19 (Patito feo). I have installed these three packages with apt.
ibus
ibus-mozc
ibus-anthy
I can confidently say that they got installed correctly as I can see this in the Japanese section of ibus-preferences.
I can see the ibus icon in my panel too!
but I still can't input Japanese. It is still using my xkb keyboards. So in this case How to temporarily switch to ibus?
I wanted to know if there is any commands for fully activating and fully deactivating ibus? I would need both of them as I very often need to switch to my xkb-layouts too. I am planning to add keyboard shortcuts for both of those commands which I believe will make my life very easy :)
GUI solutions are welcome as they will be useful for other users having similar issue.
Thanks in advance.
|
No, you do not toggle between xkb and ibus. You fully switch to ibus - it will support both multi-key and single-key languages.
Not sure how it is done on MX GNU, but in Debian derivatives there always an "Input Method" section in the settings, where you do a complete switch to ibus, fcitx, xim, etc (the option "none" there would a switch back to xkb).
Once you install ibus package, you should have a tool ibus-setup. It will allow you to set hotkeys to switch between layouts.
| How to toggle between ibus and xkb? |
1,505,584,976,000 |
I've written a file /etc/udev/hwdb.d/70-keyboard.hwdb to re-map some of my keyboard keys. There's an additional key that I want to re-map, but I can't figure out what identifier I should use for it.
Ordinarily, I run evtest and press keyboard keys to get an output like the following:
Event: time 1639158329.532434, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7000f
Event: time 1639158329.532434, type 1 (EV_KEY), code 38 (KEY_L), value 1
Then I use the hex "value" from the first line above (containing "EV_MSC") to compose a line like the following in my 70-keyboard.hwdb file:
KEYBOARD_KEY_7000f=rightctrl
The key that I want to re-map now is my KEY_KBDILLUMDOWN key, and when I run evtest to identify its hex value, I only get one line of output, and it's not the line that contains "EV_MSC":
Event: time 1639158417.741165, type 1 (EV_KEY), code 229 (KEY_KBDILLUMDOWN), value 1
How can I remap this key in udev?
|
Perhaps this key event is injected by ACPI driver (instead of real key press event) in which case you may handle it by acpid. Try acpi_listen (while acpid is running). Events handlers are at /etc/acpi/events/ which are calling handlers (default is right in /etc/acpi/).
If that is the case you can write a simple evdev wrapper script to generate keypress events as handler to acpi events. See here for examples.
| Udev hwdb to re-map a key when I don't know the key code |
1,505,584,976,000 |
In my .bashrc, I would like to add this line :
xmodmap -e "keycode 135 = Return"
where the keycode number is the one from my mouse's side button.
To find a keycode from the keyboard, I use xev, which gives me, for instance:
(the line that contains "keycode 135" is the one that matters)
KeyPress event, serial 38, synthetic NO, window 0x6400001,
root 0x7c3, subw 0x0, time 30530179, (-489,479), root:(1047,479),
state 0x0, keycode 135 (keysym 0xff0d, Return), same_screen YES,
XKeysymToKeycode returns keycode: 36 " XLookupString gives 1 bytes: (0d) " " XmbLookupString gives 1 bytes: (0d) "
XFilterEvent returns: False
However, for a mouse, it doesn't show the keycode:
ButtonRelease event, serial 38, synthetic NO, window 0x6400001,
root 0x7c3, subw 0x0, time 30661669, (35,100), root:(1571,100),
state 0x0, button 8, same_screen YES
How to get a keycode from my mouse's side button, to use the command xmodmap, to simulate a keyboard's key press from a mouse button? (for instance, pressing the side button would be as if I would press "a" on keyboard - and would show "a" in a text editor)
|
You can’t, at least not with only xmodmap — mice and keyboards are handled differently, and mice don’t produce keycodes.
There are however tools which can remap input events across different device types; try Key Mapper for example. (I’m a very minor contributor to the project.)
| How to get a keycode from my mouse's side button? |
1,505,584,976,000 |
Sorry for cross-posting (https://android.stackexchange.com/questions/239535/endless-updates-on-every-boot ) but trying to ask wider to get an answer.
How do I go about setting up a SSH connection to a remote device (a treadmill running Android 4.4.4 Ubuntu kernel 3.0.36+)? The remote device is connected via WiFi to the internet and I can run packages through the file manager (saved on USB thumb drive). The system seems very limited, both Google play and Opera don't work properly.
Manufacturer gone out of business so no support from that side. No other inputs (ethernet, RS232 etc.) At this stage USB is the only possible entry point. Guessing I need to load SSH client package, possibly bluetooth keyboard may be another entry point. Any suggestions, please.
|
I don't really know what you're trying to accomplish, but Termux is great as a client as well as ssh server. After the install you just need to install the openssh package with apt/pkg install openssh. (They use a wrapper so it doesn't matter if you use apt or pkg)
They even have a wiki about it https://wiki.termux.com/wiki/Remote_Access
A nice addition (if you want to use it as a ssh-server) is tmate. With that you don't need any kind of port-porwarding ;)
EDIT: Be sure to download Termux from F-Droid tho, as the GooglePlay version is severly outdated
| Setup SSH to Android device |
1,505,584,976,000 |
After one fall, my RF wireless keyboard keeps sending XF86Forward KeyPress and KeyRelease events to the system after each keypress/keyrelease I do :
$ xev -event keyboard | egrep -w "KeyPress|KeyRelease|keycode"
KeyRelease event, serial 34, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 37, synthetic NO, window 0x3c00001,
state 0x10, keycode 24 (keysym 0x61, a), same_screen YES,
KeyPress event, serial 37, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 38, synthetic NO, window 0x3c00001,
state 0x10, keycode 24 (keysym 0x61, a), same_screen YES,
KeyRelease event, serial 39, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 311, synthetic NO, window 0x3c00001,
state 0x10, keycode 56 (keysym 0x62, b), same_screen YES,
KeyPress event, serial 312, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 312, synthetic NO, window 0x3c00001,
state 0x10, keycode 56 (keysym 0x62, b), same_screen YES,
KeyRelease event, serial 313, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 313, synthetic NO, window 0x3c00001,
state 0x10, keycode 54 (keysym 0x63, c), same_screen YES,
KeyPress event, serial 313, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 314, synthetic NO, window 0x3c00001,
state 0x10, keycode 54 (keysym 0x63, c), same_screen YES,
KeyRelease event, serial 315, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyPress event, serial 315, synthetic NO, window 0x3c00001,
state 0x10, keycode 40 (keysym 0x64, d), same_screen YES,
KeyPress event, serial 315, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
KeyRelease event, serial 316, synthetic NO, window 0x3c00001,
state 0x10, keycode 40 (keysym 0x64, d), same_screen YES,
KeyRelease event, serial 317, synthetic NO, window 0x3c00001,
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
Because of this, I'm unable to log on to my tty[1-6] consoles because each character I type gets a ^@ character appended to it :
$ showkey -k
kb mode was UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 28 release
keycode 16 press
keycode 159 press
keycode 16 release
keycode 159 release
keycode 48 press
keycode 159 press
keycode 48 release
keycode 159 release
keycode 46 press
keycode 159 press
keycode 46 release
keycode 159 release
keycode 32 press
keycode 159 press
keycode 32 release
keycode 159 release
EDIT0 : According to /proc/bus/input/devices I have 2 /dev/input/eventX entries for my RAPOO wireless keyboard+mouse combo :
$ cat /proc/bus/input/devices | grep -P '^[NH]: ' | paste - - | grep RAPOO
N: Name="RAPOO RAPOO 5G Wireless Device" H: Handlers=sysrq kbd event2 leds
N: Name="RAPOO RAPOO 5G Wireless Device" H: Handlers=kbd mouse0 event3
Seems logical because the mouse uses the same RF channel as the keyboard to communicate with the USB mini-receiver.
EDIT1 : According to the Handlers value above /dev/input/event2 seems to receive events from the keyboard alone.
Here's an evtest output for /dev/input/event2 :
$ sudo evtest /dev/input/event2
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x24ae product 0x2003 version 0x110
Input device name: "RAPOO RAPOO 5G Wireless Device"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
...
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Event type 17 (EV_LED)
Event code 0 (LED_NUML) state 0
Event code 1 (LED_CAPSL) state 0
Event code 2 (LED_SCROLLL) state 0
Event code 3 (LED_COMPOSE) state 0
Event code 4 (LED_KANA) state 0
Key repeat handling:
Repeat type 20 (EV_REP)
Repeat code 0 (REP_DELAY)
Value 250
Repeat code 1 (REP_PERIOD)
Value 33
Properties:
Testing ... (interrupt to exit)
Event: time 1625417787.379951, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70058
Event: time 1625417787.379951, type 1 (EV_KEY), code 96 (KEY_KPENTER), value 0
Event: time 1625417787.379951, -------------- SYN_REPORT ------------
Event: time 1625417794.923958, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1625417794.923958, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1625417794.923958, -------------- SYN_REPORT ------------
qEvent: time 1625417795.051954, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1625417795.051954, type 1 (EV_KEY), code 30 (KEY_A), value 0
Event: time 1625417795.051954, -------------- SYN_REPORT ------------
Event: time 1625417797.083970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70005
Event: time 1625417797.083970, type 1 (EV_KEY), code 48 (KEY_B), value 1
Event: time 1625417797.083970, -------------- SYN_REPORT ------------
bEvent: time 1625417797.187973, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70005
Event: time 1625417797.187973, type 1 (EV_KEY), code 48 (KEY_B), value 0
Event: time 1625417797.187973, -------------- SYN_REPORT ------------
Event: time 1625417798.363970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417798.363970, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1625417798.363970, -------------- SYN_REPORT ------------
cEvent: time 1625417798.459960, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417798.459960, type 1 (EV_KEY), code 46 (KEY_C), value 0
Event: time 1625417798.459960, -------------- SYN_REPORT ------------
Event: time 1625417799.195958, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1625417799.195958, type 1 (EV_KEY), code 32 (KEY_D), value 1
Event: time 1625417799.195958, -------------- SYN_REPORT ------------
dEvent: time 1625417799.259976, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70007
Event: time 1625417799.259976, type 1 (EV_KEY), code 32 (KEY_D), value 0
Event: time 1625417799.259976, -------------- SYN_REPORT ------------
Event: time 1625417801.379970, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1625417801.379970, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1625417801.379970, -------------- SYN_REPORT ------------
Event: time 1625417801.587964, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1625417801.587964, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1625417801.587964, -------------- SYN_REPORT ------------
EDIT2: Whereas /dev/input/event3 seems to receive events from both the keyboard and the mouse.
Here's an evtest output for /dev/input/event3 (notice the KEY_FORWARD events after each keypress and keyrelease) :
$ sudo evtest /dev/input/event3
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x24ae product 0x2003 version 0x110
Input device name: "RAPOO RAPOO 5G Wireless Device"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
...
Event type 3 (EV_ABS)
Event code 32 (ABS_VOLUME)
Value 0
Min 0
Max 896
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1625418203.492208, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418203.492208, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418203.492208, -------------- SYN_REPORT ------------
Event: time 1625418205.620275, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418205.620275, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418205.620275, -------------- SYN_REPORT ------------
aEvent: time 1625418205.908189, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418205.908189, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418205.908189, -------------- SYN_REPORT ------------
Event: time 1625418207.076271, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418207.076271, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418207.076271, -------------- SYN_REPORT ------------
bEvent: time 1625418207.348222, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418207.348222, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418207.348222, -------------- SYN_REPORT ------------
Event: time 1625418208.356296, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418208.356296, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418208.356296, -------------- SYN_REPORT ------------
cEvent: time 1625418208.660204, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418208.660204, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418208.660204, -------------- SYN_REPORT ------------
Event: time 1625418209.636254, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418209.636254, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 1
Event: time 1625418209.636254, -------------- SYN_REPORT ------------
dEvent: time 1625418209.924202, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0225
Event: time 1625418209.924202, type 1 (EV_KEY), code 159 (KEY_FORWARD), value 0
Event: time 1625418209.924202, -------------- SYN_REPORT ------------
Event: time 1625418211.564204, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1625418211.564204, type 1 (EV_KEY), code 272 (BTN_LEFT), value 1
Event: time 1625418211.564204, -------------- SYN_REPORT ------------
Event: time 1625418211.620212, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1625418211.620212, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0
Event: time 1625418211.620212, -------------- SYN_REPORT ------------
Event: time 1625418216.572202, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1625418216.572202, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 1
Event: time 1625418216.572202, -------------- SYN_REPORT ------------
Event: time 1625418216.644212, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1625418216.644212, type 1 (EV_KEY), code 273 (BTN_RIGHT), value 0
Event: time 1625418216.644212, -------------- SYN_REPORT ------------
Event: time 1625418218.780207, type 2 (EV_REL), code 0 (REL_X), value -1
Event: time 1625418218.780207, -------------- SYN_REPORT ------------
Event: time 1625418218.788214, type 2 (EV_REL), code 0 (REL_X), value -1
Event: time 1625418218.788214, -------------- SYN_REPORT ------------
^C
EDIT3: sudo timeout 5s evtest --grab /dev/input/eventX works but the pb. is that :
/dev/input/event2 only receives all EV_KEY keyboard events WITHOUT extra KEY_FORWARD EV_KEY events and no mouse events.
And /dev/input/event3 seems to receive mouse events and ONLY KEY_FORWARD EV_KEY keyboard events (no other EV_KEY events).
So, I use only /dev/input/event2, the mouse will not work and if I use only /dev/input/event3, the keyboard will not work.
udevadm info confirms that /dev/input/event2 is used for the keyboard events and /dev/input/event3 is used for the mouse events:
$ udevadm info /dev/input/event2 | grep event-
S: input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-event-kbd
S: input/by-path/pci-0000:00:1d.3-usb-0:1:1.0-event-kbd
E: DEVLINKS=/dev/input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-event-kbd /dev/input/by-path/pci-0000:00:1d.3-usb-0:1:1.0-event-kbd
$ udevadm info /dev/input/event3 | grep event-
S: input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-if01-event-mouse
S: input/by-path/pci-0000:00:1d.3-usb-0:1:1.1-event-mouse
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1d.3-usb-0:1:1.1-event-mouse /dev/input/by-id/usb-RAPOO_RAPOO_5G_Wireless_Device-if01-event-mouse
How can I stop my RF keyboard from sending those XF86Forward KeyPress and KeyRelease events ?
|
Ok, let's sum up:
First step is to use evtest and see if this also happens on the kernel input layer. Also, RF keyboards sometimes have multiple input devices associated to them (use evtest on all of them to verify), so if the XF86Forward happens to come from a different device than the actual keypresses, ignoring that device would be an easy fix.
It turned out that there were indeed two devices.
Next step is to use evtest --grab on the key+mouse device to make events exclusively go to evtest, so they are not handled by X or the VT's. With VT's, this may be a bit tricky, because I don't know if switching VT's will keep the grab or not. Also have a look at /dev/input/by-* to identify the devices correctly across boots. If this works, you can try to launch an
evtest --grab /dev/input/... > /dev/null
or similar during boot.
That it's not an option, as the mouse which apparently part of the keyboard (or uses the same RF channel?) is also needed.
If this were for X only, one could try to use the "mouse" input device only as mouse and not as keyboard. But as you want to use the VT's, too, this is not an option.
So the only thing that remains is to write a custom filter that removes the XF86Forward events, while letting the mouse events through. And there was a question not long ago where I briefly described how to do that. You'll still need to be able to write a program in a language that has a library for uinput.
| My RF wireless keyboard keeps sending XF86Forward KeyPress and KeyRelease events to the system after each keypress/keyrelease I do |
1,505,584,976,000 |
How can I change key bindings for a single key? I know that there are software like xmodmap and so on, but with this I can't map my key bindings, because with xmodmap I first have to press the keys that I want to change, but I can't because the key f doesn't work anymore. So I just want to change f (which doesn't work) to another, more useless key.
How to do that?
Thx
|
Xmodmap doesn't need "to press the keys". Did you read man xmodmap(1)?
All you have to do is to set key, like for example F12 to f.
$ xmodmap -pke | grep F12
keycode 96 = F12 F12 F12 F12 F12 F12 XF86Switch_VT_12 F12 F12 XF86Switch_VT_12
$ xmodmap -e "keycode 96 = f F"
First line shows keycode for F12 and second (command) sets keycode 96 to be 'f'.
You can see all keycodes with -pke option. It can also be used as backup.
# save current key map to file:
$ xmodmap -pke > xmodmap.bak
# you can view it with:
$ less xmodmap.bak
# restore from backup:
$ xmodmap xmodmap.bak
Last thing you have to do is put it in ~/.Xmodmap so your setting will load automatically with X server start.
$ echo "keycode 96 = f F f F" >> ~/.Xmodmap
This should hopefully solve automatic load of the setting.
--
Check xmodmap Arch wiki or xmodmap tutorial for reference.
| Changing key binding one specific key |
1,505,584,976,000 |
I don't own a Linux computer, or even a Unix one, so I decided to ask.
In Windows, they have their own key named the Windows key (⊞). On its own, it opens the start menu and pressing it with another key will perform a certain function.
In Apple's macOS, they have their own key named the command key (⌘). It acts like Windows' Ctrl key. For Windows users, if they would use macOS, they can simply replace Ctrl with ⌘ for most functions, if not all.
As for Linux, I have no idea what keys they have that others don't.
So does Linux have their own keys?
|
The "special" keys of which you speak are not defined by Linux or Unix, but by the desktop environment in use on the specific machine. That said, this answer on AskUbuntu gives a short course on Unixy keyboard layouts.
| Does Linux have their own keys? |
1,505,584,976,000 |
The title says it all. What is the difference between the two and when should I choose one over another when creating a custom eight level layout?
For context, here is in an excerpt from partial alphanumeric_keys xkb_symbols "T3" from de xkb symbols file.
key.type[Group1] = "EIGHT_LEVEL_ALPHABETIC";
key <AB01> { [ y, Y, U203A, NoSymbol, U0292, U01B7, guillemotleft, NoSymbol ] };
key <AB02> { [ x, X, guillemotright, NoSymbol, doublelowquotemark, singlelowquotemark, guillemotright, NoSymbol ] };
key <AB03> { [ c, C, copyright, NoSymbol, cent, copyright, Greek_horizbar, NoSymbol ] };
key <AB04> { [ v, V, guillemotleft, NoSymbol, leftdoublequotemark, leftsinglequotemark, U2039, NoSymbol ] };
key <AB05> { [ b, B, U2039, NoSymbol, rightdoublequotemark, rightsinglequotemark, U203A, NoSymbol ] };
key <AB06> { [ n, N, endash, NoSymbol, U019E, U0220, endash, NoSymbol ] };
key <AB07> { [ m, M, Greek_mu, NoSymbol, mu, masculine, emdash, NoSymbol ] };
key.type[Group1] = "EIGHT_LEVEL";
key <AB08> { [ comma, semicolon, U02BB, NoSymbol, ellipsis, multiply, dollar, NoSymbol ] };
key <AB09> { [ period, colon, U200C, NoSymbol, periodcentered, division, numbersign, NoSymbol ] };
key <AB10> { [ minus, underscore, hyphen, NoSymbol, U0140, U013F, U2011, NoSymbol ] };
|
After some tests and looking at the definition of those levels the difference is that the ALPHABETIC type locks into the second level with CAPS LOCK, while the non ALPHABETIC the second level is achieved only while pressing SHIFT.
See the following section of /usr/share/X11/xkb/types/level5. Only in the ALPHABETIC you can find map[Lock] = Level2;, map[Lock+LevelFive] = Level6; and so on...
type "EIGHT_LEVEL" {
modifiers = Shift+LevelThree+LevelFive;
map[None] = Level1;
map[Shift] = Level2;
map[LevelThree] = Level3;
map[Shift+LevelThree] = Level4;
map[LevelFive] = Level5;
map[Shift+LevelFive] = Level6;
map[LevelThree+LevelFive] = Level7;
map[Shift+LevelThree+LevelFive] = Level8;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
level_name[Level3] = "Alt Base";
level_name[Level4] = "Shift Alt";
level_name[Level5] = "X";
level_name[Level6] = "X Shift";
level_name[Level7] = "X Alt Base";
level_name[Level8] = "X Shift Alt";
};
type "EIGHT_LEVEL_ALPHABETIC" {
modifiers = Shift+Lock+LevelThree+LevelFive;
map[None] = Level1;
map[Shift] = Level2;
map[Lock] = Level2;
map[LevelThree] = Level3;
map[Shift+LevelThree] = Level4;
map[Lock+LevelThree] = Level4;
map[Lock+Shift+LevelThree] = Level3;
map[LevelFive] = Level5;
map[Shift+LevelFive] = Level6;
map[Lock+LevelFive] = Level6;
map[LevelThree+LevelFive] = Level7;
map[Shift+LevelThree+LevelFive] = Level8;
map[Lock+LevelThree+LevelFive] = Level8;
map[Lock+Shift+LevelThree+LevelFive] = Level7;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
level_name[Level3] = "Alt Base";
level_name[Level4] = "Shift Alt";
level_name[Level5] = "X";
level_name[Level6] = "X Shift";
level_name[Level7] = "X Alt Base";
level_name[Level8] = "X Shift Alt";
};
| What is the difference between EIGHT_LEVEL_ALPHABETIC and EIGHT_LEVEL in xkb symbols files? |
1,505,584,976,000 |
I've been looking for keyboard:
slim
quiet (not mechanical)
tenkeyless
wireless
with standard layout (symetric control keys, full size arrow keys, page-up and page-down keys etc.)
And I cannot find anything for PC. But this keyboard is pretty much what I need:
https://matias.store/products/fk408btb
The problem is that I don't know how it works on Linux and cannot find anything interesting on google. What I'm especially interested in are diacritics. Does mac keyboards need some kind of remapping? If not then "option" and "command" keys work as "window key" and "alt" respectively? Does the right "command" key works as the right "alt" key (i.e. does it allow to make diacritics?)?
|
Basicly the command ⌘ works as ⊞ Win, left option ⌥ as Alt and right as AltGr. It should be possible to remap/swap ⌥ and ⌘.
If you're interested in altering your layout for diacritics I'm using my own layout heavily based on queria/vok which is CZ/SK typographic layout (qwerty and qwertz) containing even special punctuation characters and more … „ “ - – —.
Diacritics is available via Alt-LETTER and for letters having two different diacritics using Alt-Shift-LETTER. For example Alt-e results in é and Alt-Shfift-e is ě. Even though if you're not from CZ/SK, it could be a good starting point for inspiration how to create a custom layout. Here are my macOS layout variant screenshots jindraj/vok to show you how comfortably the diacritics could be mapped.
Ad keyboard, as a Matias Laptop Pro owner I can only recommend their boards. I was always tempted to buy their aluminium keyboard for their nice design, battery life and price.
| Mac keyboard on Ubuntu [closed] |
1,505,584,976,000 |
Is there a command-line tool that shows "key pressed"-events like xev, but is running in the background and doesn't need the input focus?
I want to record terminal input with asciinema, using tmux to split window and having one window showing the keys I pressed while the other shows the real console input and output.
I am using Linux nec 5.6.16-1-MANJARO and running dwm via xinit.
|
xinput may be just the right thing for your problem (xinput 1 man).
It has a wide range of options, but in your case, if available, I would probably use just the following on one of the splitted windows:
xinput test-xi2
| Command-line tool to show key events, but running in the background |
1,505,584,976,000 |
my keyboard write " insted of @
it will be Clear in this img
|
You have set the wrong keyboard layout. British has the double quote mark above the 2. US has it over near the Enter key
| My keyboard write double qoutes " insted of @ |
1,505,584,976,000 |
My keyboard and mouse are plugged into a seven-port USB hub. That hub is plugged into my PC.
My PC runs Arch and Windows 10. When I boot up, I can use my keyboard and mouse in my motherboard's BIOS menu, or to select Windows 10 at the bootup menu. If I select Windows 10, I can use the keyboard and mouse just fine when my PC boots to that OS.
But if I select Arch, my keyboard and mouse do not work once the PC boots to the desktop login screen.
But when I plug the keyboard and mouse directly into my PC, they work on Arch.
When I log into my desktop environment, KDE Plasma, and run lsusb in terminal, I see the USB listed.
Before a few days ago, when I updated all my installed packages, there was no issue. But now there is. Why?
|
Looks like a systemd error to me.
According to an open issue, systemd 244.2-1-arch can cause similar behavior : https://github.com/systemd/systemd/issues/14822
This should be fixed in 245. For now you might consider using a previous version.
| Arch won't recognize keyboard and mouse plugged into a USB hub |
1,561,314,301,000 |
In a linux terminal I use "cat > file.txt" to make a file one line at a time.
What I find is that per-line the delete key works but the arrow keys insert escape codes rather than moving left and right in the line.
Why is this? Is there a reason that the terminals basic action cannot do left and right arrow keys? I know there are things like GNU readline which do it but my question is not about those.
|
Because the line editing capabilities of the terminal driver are quite primitive and do not include things like moving the insertion point left and right.
What they do include:
deleting the last char (VERASE / erase, BackSpace)
deleting the last word (VWERASE / werase, Control-W)
deleting the whole line (VKILL / kill, Control-U)
They're also not able to bind multiple key sequences (as the escapes sent by the left- and right-arrow keys usually are) to its special actions.
And of course, VERASE and VWERASE are not Unicode-aware; Linux has a perfunctory IUTF8 flag (which works with simple data and is better than nothing), but it doesn't know about zero-width modifiers, directional marks, etc.
Look into the stty(1) and termios(3) manpages for more details.
| Why does delete work but not arrow keys in terminal? [duplicate] |
1,561,314,301,000 |
I am using ASUS VivoBook together with Fedora 29. Everything works except for a keyboard glitch. Pressing Tab increases volume, even though the entry for Volume up in Keyboard Shortcuts settings is Audio raise volume (fn key). The same happens with Ctrl+Tab and backtick.
|
After tracking it down it turned out to be hardware issue. Pressing Tab actually sent the code for Volume up, hence this can't be solved programmatically.
| Tab key increases volume in Fedora |
1,561,314,301,000 |
I can't find anything clear of how linux is handling the keyboard. (system based configurations not gui)
My problem is : I installed ibus on a linux mint with several languages but it just doesn't work, despite ibus-setup, ibus-daemon -rx...
Maybe my system is using another input method than ibus ?
Is there a command to know which input method my computer is actually using ?
|
The input method used (IM) is actually set in ~/.xinputrc.
Run the command im-config to choose your input method.
Or maybe simply add manually run_im ibus inside your ~/.xinputrc : It is what im-config is doing.
Of course you need to restart X.
| Switch to another input method |
1,561,314,301,000 |
My current keyboard config is quite complex, but the relevant line is:
setxkbmap -option -option 'grp:rshift_toggle, compose:rctrl' dmru,ru,ua &
Rshift now cycles through dmru, ru, and ua. When my screen gets locked, I have no way of knowing which layout am I using to type my password, and in general it would be awesome to have a shortcut which takes me back to english. (dmru in this case, it's a custom layout.) I can't run setxkbmap $language at every switch because it breaks my xcape and xmodmap settings; running them every time takes a couple of seconds and is not practical.
Would it be possible to switch to a particular language, without running setxkbmap every time?
|
The group-switch options operate with 4 keysyms: ISO_First_Group, ISO_Last_Group, ISO_Next_Group, and ISO_Prev_Group. The option you use, grp:rshift_toggle, only provides ISO_Next_Group, so cycling through the layouts is all you're seeing.
The behavior you're looking for (select a specific layout) exists on the ISO_First_Group or ISO_Last_Group keysyms. You want to find an existing (or write a new) option that supplies at least one of those keysyms.
Looking quickly through man xkeyboard-config, these existing options appear to include ISO_First_Group:
grp:shift_caps_switch: Caps Lock to first layout; Shift+Caps Lock to last layout
grp:win_menu_switch: Left Win to first layout; Right Win/Menu to last layout
grp:lctrl_rctrl_switch: Left Ctrl to first layout; Right Ctrl to last layout
grp:lctrl_lwin_rctrl_menu: Left Ctrl+Left Win to first layout; Right Ctrl+Menu to second layout
These options are defined in /usr/share/X11/xkb/symbols/group. One of them may be acceptable for your use. If they don't provide exactly what you want, you can use the definitions to tailor your keymap to your needs.
| Can I create additional keyboard shortcuts inside xkbconfig that switch to a particular language, instead of cycling? |
1,561,314,301,000 |
I have kali linux on my laptop.I have a problem with my keyboard . Whenever i open a terminal some key is pressed automatically and ^[[5~ this character is shown in terminal. Please tell me which key causes this issue.
|
Per the ECMA-48 standard, ␛ [ is the 7-bit equivalent to the 8-bit C1 control character CSI. Your terminal emulator, because of massive historical inertia, is acting as if it is not 8-bit clean.
Any terminal input control sequence of the form CSI Ps1 ; Ps2 ~ is a DECFNK control sequence. (Ps2, and thus the ;, are optional, defaulting in the usual ECMA-48 style to 1 if missing.) This is a de facto standard control sequence originating in DEC terminals and copied by other terminals and terminal emulators over the years.
The VT510 Video Terminal Programmer Information documents the DECFNK control sequence on pages 5—53 to 5—53, albeit not with the IBM PC key names that you are used to. It is the Prev Screen key. It is in the upper group of the editing keypad area of this VT320 keyboard:
You can guess what its IBM PC Model M keyboard equivalent is from that, but when still consulting the doco nonetheless you will also find CSI 5 ~ in table 8—3 on page 8—7 of VT520/VT525 Video Terminal Programmer Information. That table documents that it is engraved Page Up on an IBM PC style keyboard.
Use reference doco like this to look up keyboard control sequences.
Note that this applies to terminals that use the DEC VT protocols. Not all terminals and terminal emulators do. If you encounter an input control sequence beginning with CSI or SS3 that is not in the CSI Ps1 ; Ps2 ~ form, it will usually (unless it is an actual ECMA-48 control sequence) be employing the other widely used protocol, which is the protocol originally adopted for IBM PC keyboard keys on the SCO Xenix console.
The DEC VT doco documents some of these control sequences as its compatibility "SCO Console" mode. These are fully documented in the keyboard(HW) manual page in the SCO Unix System Administrators Reference.
You'll find them used, for example, by the FreeBSD kernel's built-in terminal emulator for function keys F13 and higher. (It uses the DEC VT control sequences for F1 to F12. There are DEC VT control sequences for function keys up to F22. The SCO Xenix console has documented control sequences for function keys F1 to F48, reflecting the common IBM PC convention of using modifier keys to quadruple the number of function keys.)
Further reading
VT510 Video Terminal Programmer Information. EK-VT510-RM. November 1993. DEC.
VT520/VT525 Video Terminal Programmer Information. EK-VT520-RM. July 1994. DEC.
"Hardware Dependent". SCO Unix System Administrators Reference. 1993-02-01. The Santa Cruz Operation. tenox.net.
Control Functions for Coded Character Sets. ECMA-48. 5th edition. 1991. ECMA International.
https://unix.stackexchange.com/a/289871/5132
| Problem in identifying key that causes random character in terminal |
1,561,314,301,000 |
I'm using IME/iBus to type Chinese characters using Pinyin (Intelligent Pinyin 1.6.92 in Debian Jessie with Gnome 3.14.1). Now, I'm trying to type the word 旅行 (lüxing = travel), but all I get is 路性 (luxing), because it doesn't seem to recognize the two dots over the u, which makes ü.
Is this a bug? Or am I missing something?
|
Have a look here
It is Mac oriented. It says to try: nv
And says
V is the standard convention to represent ü in pinyin input systems...
It refers to Wikipedia which says
Since the letter "v" is unused in Mandarin pinyin, it is universally used as an alias for ü. For example, typing "nv" into the input method would bring up the candidate list for pinyin: nǚ.
| How to type ü in Pinyin IME? |
1,561,314,301,000 |
I'm attempting to capture all keyboard input based on the code from this answer. The actual key capturing is working fine. However, running the code on Linux Mint Cinnamon causes other issues:
I'm unable to drag or resize any windows using the mouse
Clicking on the options in the menu bar in xed and nemo (file, view, etc...) doesn't bring up the submenu options
Clicking on the start menu brings up the list of applications but focus is retained by the window behind it so I can't hover, scroll or click on items from the application list.
A simplified but functional version of the code follows. I have narrowed down the cause to the presence of StructureNotifyMask event mask in XSelectInput. Without that event mask, none of above issues are present. But this also means the program isn't notified when the window is mapped and thus the capturing doesn't work.
How can I get capturing to work without any of the above issues? I've tried including a second XSelectInput after the program is notified of the mapping that only has the key press and release event masks. However, that does not seem to resolve the issue.
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
int main()
{
Display *display;
Window window, rootwindow;
XEvent event;
KeySym escape;
display = XOpenDisplay(NULL);
rootwindow = DefaultRootWindow(display);
window = XCreateWindow(display, rootwindow,
-99, -99, 1, 1, /* x, y, width, height */
0, 0, InputOnly, /* border, depth, class */
CopyFromParent, /* visual */
0, NULL); /* valuemask and attributes */
XSelectInput(display, window, StructureNotifyMask | KeyPressMask | KeyReleaseMask);
XMapWindow(display, window);
do {
XNextEvent(display, &event);
} while (event.type != MapNotify);
XGrabKeyboard(display, window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
escape = XKeysymToKeycode(display, XK_Escape);
printf("\nPress ESC to exit.\n\n");
fflush(stdout);
while (1) {
XNextEvent(display, &event);
if (event.type == KeyPress) {
printf("KeyPress: keycode %u state %u\n", event.xkey.keycode, event.xkey.state);
fflush(stdout);
} else
if (event.type == KeyRelease) {
printf("KeyRelease: keycode %u state %u\n", event.xkey.keycode, event.xkey.state);
fflush(stdout);
if (event.xkey.keycode == escape)
break;
} else {
printf("Event type %d\n", event.type);
fflush(stdout);
}
}
XUngrabKeyboard(display, CurrentTime);
XDestroyWindow(display, window);
XCloseDisplay(display);
return 0;
}
|
You can't do a permanent XGrabKeyboard. This grab is only meant to be used temporarily, as long as some kind of interaction is ongoing.
If you keep holding the grab, all other functions that need a grab themselves (like the WM operations you mention) are not going to work.
| StructureNotifyMask interferes with other windows on linux Mint |
1,561,314,301,000 |
I installed Fedora 25 as dual boot next to Windows 7. I have Turkish layout keyboard. And OS is in Turkish also. All the other buttons work and write normally, but buttons " i, ı, alt gr" dont function at all. These buttons work normally on Windows 7.
output of setxkbmap -print
xkb_keymap { xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" }; xkb_compat { include
"complete" }; xkb_symbols { include "pc+us+inet(evdev)" };
xkb_geometry { include "pc(pc105)" }; };
and when I run xev as normal user and type characters, everything works normally.
evtest did not work in root user.
And I noticed that , when I type on terminal everything is ok.
|
I run setxkbmap tr and It got fixed.
| Some letters on my Turkish-layout keyboard don't work on Fedora |
1,561,314,301,000 |
I recently moved from laptop to desktop. But I have a problem.
I bought a cheap chinamade keyboard. However, this keyboard package said, that is was good for german keymap. Upon inspection, it turns out, that it doesn't have the greater-than,less-than and pipe key .
See image,see the key between left shift and y key - that key is missing.
I know I can buy another keyboard, but in the spirit of unix, i would like to remap the capslock key to the missing key.
I looked at the file : /usr/share/X11/xkb/symbols/de
But, got pretty confused.please help.
|
If you are running X and not Wayland, using xmodmap instead of xkbd will be a lot easier (though people will tell you that xmodmap is deprecated, but people have been telling this for a decade, and it's still there).
Very briefly: Run xmodmap -pke, find keycode for capslock and greater/less key, run xmodmap -e 'keycode 123 = ..., where 123 is the keycode for capslock, and ... is the definition for the greater/less key.
If it works, put the line into ~/.Xmodmap, ~/.Xkeyboard or whatever your display manager reads upon login.
| remapping the caps lock key to less than greater than and pipe key |
1,561,314,301,000 |
I am using Arch Linux (installed from a Live CD) and I am having trouble with the keyboard in Xorg. I am mostly sure it's a matter of configuration, I'm attaching my 10-keyboard.conf file:
Section "InputClass"
Identifier "system-keyboard"
Driver "kbd"
MatchIsKeyboard "on"
Option "XkbRules" "xorg"
Option "XkbLayout" "gb"
Option "XkbModel" "pc104"
Option "XkbVariant" "latin"
EndSection
I need to have the GB layout every time I reboot my computer, but I don't know if I am missing something. I also don't know if I have to use pc104 or pc105, I have a ThinkPad T400.
|
I am mostly sure it's a matter of configuration, I'm attaching my 10-keyboard.conf file:
Modern Xorg does not require much configuring, and it is recommended to run without a configuration as the configuration language is very intricate and error-prone. Instead, try running setxkbmap gb once the X server has launched to see if the keyboard can be configured that way. If that works, place the command in your .xinitrc so that it is executed automatically every time you start the X server.
| No keyboard in Xorg |
1,561,314,301,000 |
I have recently added a Fedora 21 partition on my workplace machine, however i'm experiencing the curious issue that my mouse and keyboard "framerates" are incredibly slow. The mouse cursor is enormously laggy and jumps periodically and when i type at normal speed on the keyboard, it drops keypresses. Gnome itself seems to run perfectly fine (the animations when opening/closing windows are completely smooth and not choppy, glxgears runs at >1000fps).
I have done some Google-Fooing but couldn't really find anything. Looked at the howto debug site [1] and couldn't find a problem, although i don't really know what i'm supposed to look for (i'm only just starting out on Linux).
If anybody has pointers on where/how to start hunting this down, it would be greatly appreciated.
[1] https://fedoraproject.org/wiki/How_to_debug_Xorg_problems
|
It seems to be a problem with one of my USB controllers, plugging the devices in at the other controller resolved the issue.
| Low mouse and keyboard framerate in Fedora 21 |
1,561,314,301,000 |
I have a CM Storm Trigger Keyboard. This has some special keys, which can be programmed to trigger certain macros. There are special "M" keys for macros on the left-hand side, and there are two "Trigger" keys instead of the Super Key. When I click this key plus a numbered key, the whole keyboard lights up (it's a gaming keyboard).
However, I am not a gamer and do not care much about the lights. Rather, I want to use the "super key" functionality in its original format. Most importantly, I want to assign this as the "Mod1" modifier key in the i3 window manager. But currently, this is impossible to do. The key is not assigned any function, it appears. I used 'xev' and when I press this particular key, absolutely nothing happens. It shows no event, so I can not check out the name of the key. Xmodmap is not very useful either, I can not identify this key this way.
Any idea how to 'activate' / identify this key?
|
If xev doesn't register a response for a particular keypress, then you can try at the next level down with showkey, a command that must be issued from the console.
If showkey provides not information about a keypress, your final option is to see if it is registering with the kernel; follow the instructions on the Arch Linux Wiki multimedia keys page, and check for a scancode by seeing what is printed (if anything) to dmesg after a keypress.
If none of the above approaches return a result for the key, then it is not accessible in Linux.
| Overriding functionality of special keys on CM Storm Trigger keyboard |
1,707,711,379,000 |
I ever dislike the keyboards with lights, today after firmware update on my NS5x_NS7xPU the keyboard..become "with backlight".
How to turn off?
I have tried this command as root
sh -c "echo 0 > /sys/class/leds/system76_acpi::kbd_backlight/max_brightness"
sh: line 1: /sys/class/leds/system76_acpi::kbd_backlight/max_brightness: Permission denied
When I press fn+f7 it appear a "monitor configuration" of Xfce4
When I run this command
echo 0 > /sys/class/leds/system76_acpi\:\:kbd_backlight/brightness
the keyboard backlight is still on,
|
Solution found, waiting for controller by system i press two keyboard keys..
FN+*
| System76 Boring Backlight, how to control it? |
1,707,711,379,000 |
I have had this laptop (Asus Vivobook S14 M3402RA) for about a month now and I installed Linux on it without any major issues. However, a few days ago, when I plugged in an external keyboard, the laptop's built-in keyboard became unresponsive. I found that the keyboard was unresponsive even after unplugging the external one.
I tried reinstalling my system and I had high hopes as the keyboard worked in the BIOS menu. Unfortunately, this was not the case when the desktop environment loaded up. I tried this process with the following desktop environments (the keyboard did not function on either one): i3, hyprland, kde, gnome, lxde. I have tried a rolling-release distro (arch linux) and a stable one (linux mint) but the keyboard did not work on either.
I would like to note that the touchpad works everywhere, as do the Fn keys.
The problem is very similar to the one described in this post: Keyboard not working in ASUS Vivobook S 15 (2022) and Kubuntu 22.04
I have also tried the solutions in this post, but they did not work: https://askubuntu.com/questions/1360683/keyboard-not-working-after-shutdown-asus-zenbook-13-oled-um325s/1363587#1363587
Any help would be greatly appreciated!
|
After trying out some different solutions, I managed to solve the problem in the following steps:
Booted into a Windows installer
Followed the instructions listed here (I installed all the drivers available for my device): https://www.asus.com/support/FAQ/1048624
Rebooted
Since I still could not connect to my WiFi network, I used an ethernet-to-usb-c adapter
Proceeded to successfully install Windows
Installed linux (tried both Ubuntu and Arch) and both distros worked flawlessly
| Keyboard on Asus Laptop (M3402RA) not working after plugging in external keyboard |
1,707,711,379,000 |
I just migrated from Arch Linux to NixOS. I configured the system to install GNOME. Additionally, I spotted a setting where I can set XkbOptions within services.xserver:
// /etc/nixos/configuration.nix
...
services = {
xserver = {
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
enable = true;
excludePackages = with pkgs; [ xterm ];
layout = "us";
xkbVariant = "";
xkbOptions = "numpad:microsoft"; # ...err, not fully working
};
};
...
I'm under the assumption that setting XkbOptions should yield the same results than setting Num Lock on: ... under Compatibility options in GNOME Tweaks:
...but it's not quite working system-wide. For instance, Text Editor and some other applications aren't working working correctly. Moreover, I can verify that setting this in GNOME Tweaks (with and without setting XkbOptions) will make all applications I've tested work correctly, so I'm not sure if I'm doing something wrong in the NixOS configuration file, or if it's some bug with xkbOptions.
I would like, if possible, to configure this in NixOS declaratively. Any clues of what am I doing wrong?
|
I think somehow I got into a state where this wasn't set properly because I was configuring the system while trying GNOME Tweaks...all at the same time. I've read that NixOS wouldn't be able to apply the changes stated in the configuration if the setting (or related settings) is/are already configured.
So I went ahead and checked the current value with gsettings get org.gnome.desktop.input-sources xkb-options. Then I opened up GNOME Tweaks and unset the option. Additionally, I also did a reset for org.gnome.desktop.input-sources xkb-options via the command-line with: gsettings reset org.gnome.desktop.input-sources xkb-options — all of this while still having NixOS configured with xkbOptions = "numpad:microsoft".
I restarted the system...and everything seems to be working fine. Moreover, I also see GNOME Tweaks now, after the restart, with the option selected. So it appears that this is recognized system-wide indeed.
| XkbOptions not working system-wide in NixOS |
1,707,711,379,000 |
On Debian, I try to swap with setxkbmap pageDown with pageUp (and also Home and End), but I didn’t find options to do it in the -option option.
I try someting like setxkbmap -layout fr -variant bepo -option caps:swapescape compose:menu terminate:ctrl_alt_bksp pgup:pgdn, but <key0>:<key1> isn’t a syntax to swap keys.
So how to swap these keys?
|
Finaly, I found it. It is necessary to modify the /usr/share/X11/xkb/symbols/pc file.
The relevant lines are the folowing ones:
…
key <HOME> { [ End ] };
key <PGUP> { [ Next ] };
…
key <END> { [ Home ] };
key <PGDN> { [ Prior ] };
…
I just swap the definitions I found in HOME|END and PGDN|PGUP.
| Swap with setxkbmap pageUp and pageDown |
1,707,711,379,000 |
I am trying to achieve what the QMK firmware does for keyboards but using software. So, I would like to turn off keys, substitute some keys for others, layers and etc.
The first thing that appeared for me when searching was this example. The problem is, running the test it only works when the terminal that is executing the binary has focus, and I would like to overpass the windowing system.
Also the code presents this array that I don't have any idea how to fill.
static unsigned char rdesc[] = {
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x02, /* USAGE (Mouse) */
0xa1, 0x01, /* COLLECTION (Application) */
0x09, 0x01, /* USAGE (Pointer) */
0xa1, 0x00, /* COLLECTION (Physical) */
0x85, 0x01, /* REPORT_ID (1) */
0x05, 0x09, /* USAGE_PAGE (Button) */
0x19, 0x01, /* USAGE_MINIMUM (Button 1) */
0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
0x95, 0x03, /* REPORT_COUNT (3) */
0x75, 0x01, /* REPORT_SIZE (1) */
0x81, 0x02, /* INPUT (Data,Var,Abs) */
0x95, 0x01, /* REPORT_COUNT (1) */
0x75, 0x05, /* REPORT_SIZE (5) */
0x81, 0x01, /* INPUT (Cnst,Var,Abs) */
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x30, /* USAGE (X) */
0x09, 0x31, /* USAGE (Y) */
0x09, 0x38, /* USAGE (WHEEL) */
0x15, 0x81, /* LOGICAL_MINIMUM (-127) */
0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x95, 0x03, /* REPORT_COUNT (3) */
0x81, 0x06, /* INPUT (Data,Var,Rel) */
0xc0, /* END_COLLECTION */
0xc0, /* END_COLLECTION */
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x06, /* USAGE (Keyboard) */
0xa1, 0x01, /* COLLECTION (Application) */
0x85, 0x02, /* REPORT_ID (2) */
0x05, 0x08, /* USAGE_PAGE (Led) */
0x19, 0x01, /* USAGE_MINIMUM (1) */
0x29, 0x03, /* USAGE_MAXIMUM (3) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
0x95, 0x03, /* REPORT_COUNT (3) */
0x75, 0x01, /* REPORT_SIZE (1) */
0x91, 0x02, /* Output (Data,Var,Abs) */
0x95, 0x01, /* REPORT_COUNT (1) */
0x75, 0x05, /* REPORT_SIZE (5) */
0x91, 0x01, /* Output (Cnst,Var,Abs) */
0xc0, /* END_COLLECTION */
};
I could not find any more documentation on the matter. At this time, I am not even sure if it is possible to do what I want. I have seen things like KMonad that I could not get to work.
At the end, these are my questions:
How to fill the rdesc array to keyboards?
How to overpass the windowing system?
Where can I find documentation about UHID?
|
Was trying to solve this myself, and kept running across this post. I think I found it, the rdisc variable here is the HID Report Descriptor.
That kernel doc page states:
The format of HID report descriptors is described by two documents, available from the USB Implementers Forum HID web page...
and then the kernel doc links specifically to the HID USB Device Class Definition and to the HID Usage Tables.
That should take care of your first question. For your third question there's this documentation, which is sparse, because UHID is basically just the glue for a userspace HID driver, and you'll get more out of the regular HID documentation. Sorry, I don't really know enough to provide an answer to your second question.
| Virtual keyboard using UHID |
1,707,711,379,000 |
I've got kind of a weird problem.
I was trying to take a screenshot today, using PrintScr as usual, but it wasn't working. I went hunting for why and found that PrintScr is issuing the keys Option-Shift-4. In a text editor, it types "$".
I know why it might be doing this. At some point I was trying to map Option-Shift-4 to take a screenshot, so that my Mac muscle memory wouldn't have to shift across computers. Foolish, I know.
I'm on Pop!_OS 22.04 with a 6.2 kernel and Gnome, mostly default setup for Pop.
The problem is, I cannot for the life of me find where this is configured.
I looked in /usr/share/X11/xkb/symbols/, everywhere an Xmodmap config might be set or loaded, Gnome Tweaks, various GUI tools... I can't find anything that might be doing this.
So two questions:
1: Where are all the places I should look?
2: How might one completely reset the keyboard configuration? This was the only change I made, and I have no other changes I want to keep.
|
I discovered my own issue here-- my keyboard (a Keychron K8) has a Windows/Mac switch on it, and in general is a very mac-centric keyboard.
When that switch is set to "Mac," the keyboard itself sends "Cmd+Shift+4" when PrtScr is pressed.
I just had to switch the dumb guy switch to "Windows" and then swap the Ctrl and Opt keys using Xmodmap, which is a more common operation.
| Where might one look to find a wonky keymapping? |
1,707,711,379,000 |
I am using Debian desktop for Lichee Pi and I am new this platform(linux). I communicate serial with lichee pi using putty. I made the lichee pi connection with the keyboard using microusb to usb converter, but my keyboard is not working. How can I solve this? My setup looks like this:
|
after use a micro usb to usb converter, it worked. I think female-female usb cable is not supported for this ecosystem
| I can not use keyboard for Debian |
1,668,032,131,000 |
So I have had this strange issue for a while now (As long as I can remember). In most wine applications, my keyboard seems to be shifted one to the right: w is interpreted as e, s as d, a as s, etc.
Maybe my google-fu is just not good enough, but I haven't found anyone online with the same problem, and so, I just have no idea where to even start troubleshooting. The only thing I have noticed is that it seems to have something to do with how applications handle input. For example, osu will handle gameplay related inputs correctly, but not the ones in the menu, so I guess it uses a different input method for low latency gameplay stuff. Similar situation in ltspice, hotkeys are shifted, but text input fields work fine. This problem seems to persist between different wineprefixes.
So, my question is basically... does anyone here have any clue about what is going on here, and maybe how to fix it?
Edit:
I just tried this in sway (wayland), and the problem doesn't seem to be present there. So I guess it is X related? Either way, that isn't really a solution, since, I am not quite ready for wayland yet. But maybe a clue to what is happening.
|
It turns out that xmodmap was causing this (not entirely sure how). I switched to setxkbmap instead (apparently xmodmap is deprecated).
| Keyboard shifted left in wine |
1,668,032,131,000 |
Below is pavucontrol GUI. As you can see, volume is 100%.
I can use the knob of my Roccat external keyboard, to change it to any value between 0% and 100%.
Now I do the following
set it to something lower than 100%, say 69%,
suspend the system via systemctl suspend
wake the system up
At this point, the keyboard knob will allow me to reduce the volume below 69%, but not increase it above 69%.
I can pull up the volume to 100% using pavucontrol, at which point the knob can again span the whole 0-100% range.
Why is that the case? And how can I fix this?
|
The problem is that the knob was working because of a configuration done in the context of the i3 window manager that I use, and long long ago I had botched the configuration.
These are the culprits:
bindsym XF86AudioRaiseVolume exec amixer -q set Master 1%+ unmute && pkill -RTMIN+1 i3blocks
bindsym XF86AudioLowerVolume exec amixer -q set Master 1%- unmute && pkill -RTMIN+1 i3blocks
which need to be changed to this
bindsym XF86AudioRaiseVolume exec amixer -q -D pulse set Master 1%+ unmute && pkill -RTMIN+1 i3blocks
bindsym XF86AudioLowerVolume exec amixer -q -D pulse set Master 1%- unmute && pkill -RTMIN+1 i3blocks
i.e. by passing -D pulse to amixer. The idea came from line 112 of the code of the volume-pulseaudio i3 custom blocklet.
Not sure what the difference is between set and sset for amxier. From man amixer I deduce they are synonymous. And that also get and sget are synonymous with each other.
| Volume can't be increased via keyboard volume knob after suspend |
1,668,032,131,000 |
I wanted to utilize keyboard shortcuts Ctrl+Alt+Plus or Minus on the numerical part of the keyboard, but they are not working at all on any Linux I've tried (Manjaro and Debian and both Gnome and KDE).
My settings:
Standard full size keyboard
NumLock is ON
English layout set LANG=en_US.UTF-8
What works fine:
Ctrl + Plus
Alt + Plus
Shift + Plus
But Ctrl+Alt+Plus does nothing in any program where I assign this combination like Krusader, Dolphin, etc.
What I've found (probably the issue)
I tried to run xev and when pressing Ctrl+Alt+Plus or Minus, it gives me this
# For Ctrl+Alt+Plus
KeyRelease event, serial 28, synthetic NO, window 0x6c00001,
root 0x532, subw 0x0, time 3273638, (977,484), root:(1591,1348),
state 0x1c, keycode 86 (keysym 0x1008fe22, XF86Next_VMode), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
# For Ctrl+Alt+Minus
KeyRelease event, serial 28, synthetic NO, window 0x6c00001,
root 0x532, subw 0x0, time 3307298, (904,548), root:(1518,1412),
state 0x1c, keycode 82 (keysym 0x1008fe23, XF86Prev_VMode), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
So, it seems the Plus/Minus keys are mapped to symbols XF86Next_VMode/XF86Prev_VMode when you have Ctrl+Alt modifiers pressed, while with any other modifier (or none) they are mapped to KP_Add/KP_Subtract.
So, my questions is why it behaves this way and what are these XF86Next_VMode/XF86Prev_VMode supposed to mean?
I'm still a Linux beginner, but I'm used to utilize these shortcuts on Windows, so I wanna use them on Linux as well. I read somewhere you can use xmodmap to remap keycodes to diferent symbols, which I guess could solve my issue.
However when I read about xmodmap on Arch Wiki, I'm still confused. They say
Each keysym column in the table corresponds to a particular
combination of modifier keys:
Key
Shift+Key
Mode_switch+Key
Mode_switch+Shift+Key
ISO_Level3_Shift+Key
ISO_Level3_Shift+Shift+Key
but which column is supposed to represent the Ctrl+Alt combination in the above list? Also is it recommended to use the xmodmap to solve this issue?
|
Eventually I made the shortcuts working using the xmodmap utility.
1. I run xmodmap -pke to see the current mapping for each keycode:
$ xmodmap -pke
...
keycode 82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode
keycode 86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode
...
We can already see the problem: the last column contains those symbols XF86Next_VMode, XF86Prev_VMode. The 7th column seems to belong to the combination Ctr+Alt. Although I wasn't able to find what the 7th column means in any documentation.
2. Create a file .xmodmaprc in your home directory with this content to fix the 7th column:
keycode 82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract
keycode 86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add
3. Run the command xmodmap ~/.xmodmaprc in terminal and the shortcuts should start working for you immediately (until next login).
4. Obviously I wanted to make this fix working every time after login.
First, I tried to add this into the file .profile, which is supposed to be loaded after each login.
if [ -f $HOME/.xmodmaprc ]; then
sleep 5 && xmodmap $HOME/.xmodmaprc &
fi
Note, I had to add the sleep 5 command, otherwise it didn't work. However, it turned out it works only with KDE and Gnome on X11 display server. When I tried Gnome on Wayland it never worked for some reason (I believe the .profile was loaded, but the xmodmap command failed to execute, why?).
So, I tried another solution and went to the path ~/.config/autostart/, where I created a file with this content:
$ cat ~/.config/autostart/xmodmap.desktop
[Desktop Entry]
Name=Xmodmap
Type=Application
Exec=bash -c "sleep 5 && [[ -f $HOME/.xmodmaprc ]] && xmodmap $HOME/.xmodmaprc"
Terminal=false
Hidden=false
Finally, using the desktop autostart file, I was able to fix the desired keyboard shortcuts for any Linux session I've tried so far.
| Problem with shortcuts Ctrl+Alt+Plus or Minus on the numerical keyboard |
1,668,032,131,000 |
How can I enter Unicode characters from my keyboard?
I'm aware of the Ctrl+Shift+u, hex, Return method of entering an arbitrary Unicode character provided by (I think) IBus, but this causes a prompt (an underlined "u") to appear, and you can see the hex numerals as you type them. I want a method that does not cause anything to appear except for the final character.
I want this because I have a programmable keyboard that I want to enter certain Unicode characters from. Currently, for example, I can press Fn+D to type a Greek letter delta (Δ), but for a fraction of a second as it's being typed, I can see 394 (the Unicode codepoint for Δ) gradually appear, and then be erased, which is kind of ugly.
I'd like a solution that works system-wide (e.g., not tied to certain apps), if possible.
|
I found simply using UIM instead of IBus does what I want. UIM supports Ctrl+Shift+u like IBus, but it doesn't have an interactive prompt.
| "Transparent" Unicode input from keyboard |
1,668,032,131,000 |
On Pop! OS, Solaar does not detect my bluetooth keyboard and mouse (K380, MX Anywhere 2). Running solaar probe yields Exception: Logitech receiver not found.
If I connect the mouse with the Unifying receiver, it detects it fine. On Fedora, it works great with both bluetooth and Unifying receiver.
What am I missing?
|
The version in the Pop! OS repos was older. I installed from here (10.0.4), and it works now.
| Solaar doesn't detect my bluetooth mouse and keyboard on Pop! OS (Works on Fedora) |
1,668,032,131,000 |
I'm running latest Pop OS using i3 as my window manager and Gnome is also installed and I have configured 00-keyboard.conf for layout (us,ru) and switching method and using gxkb as indicator.I also need to load a modified Xmodmap in i3 config for more intuitive layout.So in Gnome everything works as it should, but in i3 loading Xmodmap adds an extra keyboard tap to cycle through the layouts. For example, without xmodmap , one tap - 'us', on tap 'ru', one tap 'us' and so on. But with loaded xmodmap it takes one extra step to get back to 'us'. I don't seem to find information on this. Any ideas?
Any help would be appreciated.
P.S. It seems that gxkb stays on 'ru' while the keyboard already prints English letters. So keyboard switches two times to 'us' and then to 'ru' and layout indicator does the opposite - two times on 'ru' and then 'us'.
|
The only solution I found right now is to manually edit /usr/share/X11/xkb/symbols/ru file. Maybe not the most elegant and smart way to fix this issue, but functional and works for me.
| Keyboard layout switcher issue |
1,602,973,052,000 |
Sometimes I'll clumsily hit both the Enter key and the right Shift key, resulting in a Shift+Enter by accident. If I want to type Shift+Enter I'll use the left Shift key. So I'd like to remap Shift_R+Enter to Enter but leave Shift_L+Enter as Shift+Enter. I've looked over xmodmap but can't figure out how to get it to do that.
|
As far as I know, you can't do that easyly, because what is interpreted is the modifier Shift + the keysym enter, and the modifier Shift cannot do the distinction between the keysyms Shift_R and Shift_L.
A solution is to define two separate modifiers with xkb (xmodmap is useless here) for Shift_R and Shift_L; then redefine ALL of the «types» definitions you use in /usr/share/X11/xkb/types to accept the two distinct modifiers as the same layer, and keep a custom one only for your space so only one shift will trigger the second layer on it.
Eventually because you have now a non regular modifier for your second shift, some applications will stop to intrepret it correctly (shifted selection).
| Remap Shift_R+Enter to Enter, but leave Shift_L+Enter alone |
1,602,973,052,000 |
I cannot view or change the keyboard layout options anymore on Linux Mint. Does anyone know how I could fix this? I am afraid, resetting the options might not solve the problem and then I'd lose all my settings and couldn't restore them.
Does anyone know, where the settings are stored? (And maybe the name of the program in cinnamon?)
|
There was a syntax error in the evdev.xml file. I think this may be connected to accidental inserts that annoyingly sometimes happen when I click on the touchpad.
| can't view or change keyboard options |
1,602,973,052,000 |
I am trying to use custom compose key sequences and have read that I need XIM for it (or UIM).
The problem is, Compose Sequences stop working altogether when using it.
The side effect that it disables ctrl+shift+u unicode entering is supposed to only apply to XIM, so I also tried UIM, but that also has the issue while still not working.
I am using Linux Mint 19.1
Can anyone help me to get custom compose key sequences to work?
|
I have found the solution. Even though I have read that I have to use xim or uim, selecting them breaks everything.
By not selecting anything and just placing the file ~/.XCompose everything works as intended.
| XIM UIM not working Compose Key |
1,602,973,052,000 |
I don't completely understand dead keys.
The dead acute for example always behaves in the following way: You have to know which character is compatible and then you can type that character with an acute. If you type the dead acute twice, it will appear after the previous character – unlike the combining acute.
Now, I've found that dead_hook behaves completely differently, in that it also behaves like any combining character. You can type it after any other character twice and it will modify that character like a combining character!
On the other hand, the dead_horn character doesn't seem to work at all.
Can anyone explain these inconsistencies? Is there a way to get this amazing functionality of the dead_hook with other dead keys too?
|
The reason for this behavior seems to be that there are rules like this for the combining_hook:
<dead_hook> <dead_hook> : "̉" U0309 # COMBINING HOOK ABOVE
Custom rules like this can be set in ~/.XCompose
In the past, this must have required XIM or UIM from what I have read but XIM breaks it for me. It works for me without XIM or UIM.
| Dead keys - combining functionality -inconsistent |
1,602,973,052,000 |
So my problem that when I change my language from American to Lithuanian all specials symbols like (ą,ž) are displayed incorect for example then I press Q it displays ą then I press f it displays š it should be that when I change language all special symbols are displayed instead of 1234567890-= I`m using laptop, I tried to change keyboard models, but it did not change anything I don't know what to do.
|
Right click on the system tray, click "Add/Remove Panel Items", click on panel applets, click on add, select "Keyboard Layout Handler." Add that and close all those windows.
In the lower right, you'll now have a Keyboard Layout Handler icon. Right click on that, untick the bit about keeping system layouts, and then add/change/remove keyboard layouts as you wish.
The solution is a bit of an ordeal until you're used to it.
| Linux Lubuntu wrong keys displayed |
1,602,973,052,000 |
When typing the character combination ^,2 (one after the other, not simultaneously) I do not get these two characters, but Unicode point U+00B2, aka ². Same is true for ^,4 => U+2074 => ⁴ etc.
My locale is set to English, while using a German keyboard. I would like to retain the normal character behaviour, e.g. typing ä,ö,ü,ß directly, but disable interpretation of multi-keycode sequences.
I run Fedora 31 (Workstation Edition) with GNOME 3.34.4.
Does anyone how to disable this interpretation?
Edit:
Output of xev when typing ^,2:
KeyPress event, serial 34, synthetic NO, window 0x800001,
root 0x2cd, subw 0x0, time 33006949, (941,-29), root:(1091,183),
state 0x10, keycode 49 (keysym 0xfe52, dead_circumflex), same_screen YES,
XLookupString gives 1 bytes: (5e) "^"
XmbLookupString gives 0 bytes:
XFilterEvent returns: True
KeyRelease event, serial 37, synthetic NO, window 0x800001,
root 0x2cd, subw 0x0, time 33007045, (941,-29), root:(1091,183),
state 0x10, keycode 49 (keysym 0xfe52, dead_circumflex), same_screen YES,
XLookupString gives 1 bytes: (5e) "^"
XFilterEvent returns: False
KeyPress event, serial 37, synthetic NO, window 0x800001,
root 0x2cd, subw 0x0, time 33007677, (941,-29), root:(1091,183),
state 0x10, keycode 11 (keysym 0x32, 2), same_screen YES,
XLookupString gives 1 bytes: (32) "2"
XmbLookupString gives 1 bytes: (32) "2"
XFilterEvent returns: True
KeyPress event, serial 37, synthetic NO, window 0x800001,
root 0x2cd, subw 0x0, time 33007677, (941,-29), root:(1091,183),
state 0x10, keycode 0 (keysym 0xb2, twosuperior), same_screen YES,
XKeysymToKeycode returns keycode: 11
XLookupString gives 0 bytes:
XmbLookupString gives 2 bytes: (c2 b2) "²"
XFilterEvent returns: False
KeyRelease event, serial 37, synthetic NO, window 0x800001,
root 0x2cd, subw 0x0, time 33007781, (941,-29), root:(1091,183),
state 0x10, keycode 11 (keysym 0x32, 2), same_screen YES,
XLookupString gives 1 bytes: (32) "2"
XFilterEvent returns: False
|
This does the trick:
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'de+nodeadkeys')]"
It was 'de' before that, lacking the +nodeadkeys part.
| Disabling unicode interpretation for keycode sequences |
1,602,973,052,000 |
My X60T has several buttons designed to be used in tablet mode. To try and optimize the buttons, I was wondering if there is any way to recognize double clicks to trigger a command? They behave just like keyboard keys with two being esc and super L.
I'm running Manjaro 32 bit with MATE.
|
I am not familiar with MATE, and you may be able to bind commands to clicks and double clicks in the window manager that MATE uses. That is normally the preferred solution (and possible e.g. with the fvwm window manager).
If the MATE window manager doesn't support it, you can use xbindkeys to trigger commands on key/mouse combination. To recognize a double click, you need the "guile" (a scheme dialect) configuration file, an example can be found in
xbindkeys --defaults-guile
| Double Key Click Event? |
1,602,973,052,000 |
I am running a Manjaro installation and after a recent update my built-in laptop keyword does no longer work. It does work though in a different distro and in the BIOS so there must be some sort of software problem here.
I have now plugged in another keyboard via USB which works just fine (it is also listed with lsusb as the only keyboard but I guess the built-in won't appear there anyway).
Does someone know what might be the issue and how to fix it?
If it is important: My machine is a HP Pavilion laptop.
|
It's a problem with libinput.
Uninstall libinput and install libinput-1.8
That solved the problem for me. ( Using manjaro and HP pavillion laptop)
| Built-in keyboard no longer detected after update |
1,503,320,911,000 |
I found this article and seem to have a similar Problem.
Why is USB not working in Linux when it works in UEFI/BIOS?
MyConfig
Fujitsu Board Qxx Chipset
i5-2400
I use VPro KVM and the input doesn't work in debian jessie.
Live CD and rescue mode are fine.
I tried an upgrade to Kernel 4.5.
To get network back to work I used service restart network-manager in rescue mode.
Normal usb devices work again after replugging them.
I changed mainboard and CPU recently, but I had similar problems with the last system.
I don't have a Gigabyte board. And tried nearly all settings in bios.
Following the lsusb output. 001:004 must be the vPro KVM.
lsusb :
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 046d:c529 Logitech, Inc. Logitech Keyboard + Mice
Bus 001 Device 004: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
just the dmesg | grep '2-3'. The vPro KVM device.
[ 4.284230] usb 2-3: new high-speed USB device number 3 using ehci-pci
[ 4.491046] usb 2-3: New USB device found, idVendor=8086, idProduct=002b
[ 4.491051] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4.491061] usb 2-3: Product: USBr Composite Device
[ 4.491063] usb 2-3: Manufacturer: Intel
[ 4.491065] usb 2-3: SerialNumber: 0001
[ 5.921587] usb 2-3: USB disconnect, device number 3
Why is it disconnecting?? In rescue mode it reconnects automatically.
I can even launch lightdm from rescue mode and then use it with keyboard and mouse.
Other "real" USB devices have the same problem.
The vPro device must be a virtual USB.
|
My /etc/rc.local was wired.
I deleted it.
And now everything seems fine.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
su user -c '/home/user/scripte/synergyc.sh' &
exit 0
This is my current script.
But the broken one looked exactly the same.
How do I mark the question as solved?
| USB Devices doesn't work but show up in lsub and dmesg |
1,503,320,911,000 |
I am running Debian 8 Jessie. Would it be possible to set user-specific languages and keyboard layouts for users in Debian?
|
Sure. You need to edit the ~/.bashrc file.
As an example, consider an English system (en_US.UTF-8 locale/language and us) keyboard. To give a specific user an italian environment, you need to edit its ~/.bashrc file adding the following rows:
export LC_ALL=it_IT.UTF-8
export LANG=it_IT.UTF-8
loadkeys it
| Different languages/keyboard layouts for different users - Debian |
1,503,320,911,000 |
Is it possible to have a Raspberry Pi connected to a CCTV recorder via USB and send mouse input commands over the network?
The video feed from the CCTV recorder is displayed on a TV with in the house, and there is no way to switch between cameras with out going into the room where the CCTV recorder is kept and changing it from there. I would like to connect the Raspberry Pi to the CCTV recorder via the USB port and connect the RPi to the network so a program can connect to the RPi and send mouse commands to the CCTV recorder.
|
The answer to this was the Teensy board. I ordered the Teensy 3.1 with the WIZ820IO and the WIZ820_SD_ADAPTOR, this worked a treat. A very useful piece of hardware. Thank you @Rob
| Send Mouse commands to PC with Raspberry Pi over the network |
1,503,320,911,000 |
I am running a fresh install of Wheezy x86 and trying to connect a Targus number pad (model AKP10US) which has the USB Vendor/Model IDs of 05A4 / 9840. (FWIW the system is also running in VirtualBox)
However the only keys on the number pad that seem to work are Enter and Back. For other keys, I see escape like looking strings or I just hear a sound (which sounds like a keyboard buffer full type sound).
For example in Terminal when pressing 0 I see ^[[2~, and when pressing . I hear the sound. (As a comparison with the number pad connected to OSX, even though OSX says Unknown keyboard I still get the correct keystrokes out. But on Windows 7 its different again and I only have workable +-/* <tab> and <enter> keys)
Dumping out dmesg I get
[ 233.313462] usb 2-2: new full-speed USB device number 3 using ohci_hcd
[ 233.525221] usb 2-2: New USB device found, idVendor=05a4, idProduct=9840
[ 233.525221] usb 2-2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 233.525221] usb 2-2: Product: USB Compliant Keypad
[ 233.552503] input: USB Compliant Keypad as /devices/pci0000:00/0000:00:06.0/usb2/2-2/2-2:1.0/input/input7
[ 233.552669] generic-usb 0003:05A4:9840.0002: input,hidraw1: USB HID v1.10 Keyboard [USB Compliant Keypad] on usb-0000:00:06.0-2/input0
And for lsusb -v I get
Bus 002 Device 003: ID 05a4:9840 Ortek Technology, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x05a4 Ortek Technology, Inc.
idProduct 0x9840
bcdDevice 1.10
iManufacturer 0
iProduct 1 USB Compliant Keypad
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 48mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 13
Device Status: 0x0000
(Bus Powered)
So it seems as if Debian has found the keyboard, but it hasn't wired it up as desired.
So what can I configure (no kernel compiling etc) to correctly enable this keyboard? Or is it actually working correctly and I just don't know it?
Edit
I just plugged in a full sized USB keyboard into the system and everything worked straight away except for the numbers of the numeric keypad. These behaved almost the same as above. However, once I pressed Numlock, even the numeric kets worked. So my guess is that the Number pad is working correctly, but that driver is not applying Numlock to the key codes coming from it.
|
Real D'Oh moment here
The problem was Numlock.
The solution was:
System Settings -> Keyboard -> Layout settings -> Options ->
Miscellaneous compatibility options
I checked Numeric keypad keys always enter digits (as in Mac OS)
And now things work as I expected
| Targus USB number pad not working in Debian Wheezy |
1,503,320,911,000 |
I have an MSI all-in-one PC with windows 10 and ubuntu. Usually I would start it up and go to ubuntu booting page and I had configured it in a way so that if I don't select any options after 3 seconds it would start the first option which was Win 10. But after updating to ubuntu 23 my keyboard doesn't work anymore on the booting page and also the first option has changed to memory test (with a blue screen) so now there is no way for me to select any operating system. What should I do? onboard or external keyboard on neither of usb slots works. also fast boot is on and I can't go to bios setting.
|
I finally fixed it by holding the power button which took me to BIOS setting directly.
| Keyboard not working in GRUB |
1,503,320,911,000 |
I'm on latest debian testing with i3wm on two different laptops.
Linux mango 4.19.0-2-amd64 #1 SMP Debian 4.19.16-1
When I press LeftAlt + x I get "ø". And other special chars with other keys.
I want to disable it, as I assume it is what is stopping me from using Alt-x in emacs, which should be bound to "execute-extended-command" by default. But it only says "ø is undefined".
It does not seem to be the compose key though, as running:
setxkbmap -model pc105 -option compose:caps
Does not affect Alt-x's behavior. Where is this configured?
Update to clarify:
I'm using uxterm and terminal emacs "-nw". I added XTerm.vt100.metaSendsEscape: true to .Xdefaults and .Xresources but it had no effect.
Here is the output of xkbcomp $DISPLAY -
https://pastebin.com/BFnV4Zdz
|
That's curious; it's the Right Alt which is AltGr and should generate such characters, but no file under /usr/share/X11/xkb seems to map AltGr+x to ø.
I suspect that you're running emacs in a terminal emulator -- in which case you should let the terminal emulator map Alt to Esc instead; in xterm, you can do that with
*.vt100.metaSendsEscape: true
If you're not running emacs in a term emulator, then please post the whole output of xkbcomp $DISPLAY - somewhere and link it from your question.
| xterm: Disable Left Alt from producing ø |
1,503,320,911,000 |
I am writing a class that monitors input events on linux.
It'll be used in a daemon that acts upon a user's keypresses in gui programs to give visual feedback on a usb led device.
I use input events I read from /dev/input/event*. I am using <linux/input.h> and I get the keycodes.
I am on a belgian keyboard. I press and release the 'A' key on my keyboard and my log currently shows:
29/09/2019 - 14:14:48.751 [Info] Event: time 1569759288.751445, type 4 (Misc), code 4 (ScanCode), value 0x10
29/09/2019 - 14:14:48.751 [Info] Event: time 1569759288.751445, type 1 (Key), code 16 (Q), value 1
29/09/2019 - 14:14:48.751 [Info] Event: time 1569759288.751445, -------------- Report Sync ------------
29/09/2019 - 14:14:48.792 [Info] Event: time 1569759288.792115, type 4 (Misc), code 4 (ScanCode), value 0x10
29/09/2019 - 14:14:48.792 [Info] Event: time 1569759288.792115, type 1 (Key), code 16 (Q), value 0
29/09/2019 - 14:14:48.792 [Info] Event: time 1569759288.792115, -------------- Report Sync ------------
what actually gets printed on the screen without any modifier keys is a small 'a'
notice the 'code 16 (Q)' - The number 16 is the base 10 keycode.
I now need to map that 'Q' to my keyboard layout and in this case it should log 'a'.
To that extend I use the dumpkeys program to get my kernel's current translation tables.
As far as this specific example is concerned the shortened data (only 4 columns shown) it outputs is:
keycode 16 = +a +A at VoidSymbol
or in a more suitable format:
keycode 16 = +0x0b61 +0x0b41 0x0040 0x0200
The + means shiftable by default. At this stage I am not sure if that is something I need to take into account so I strip that.
As I understand it the dumpkeys program adds 0xb00 to the correct number so, I drop the +, substract 0x0b00 from 0x0b61 to obtain 0x0061.
0x0061 is the unicode number U+0061 for 'a' and I store that QString in a vector on location 0, so, the first column as far as dumpkeys is concerned.
Now for the problems:
Some keys are ok. If I interpret the data for the physical key that has the characters '1' '&' '|' on my keyboard it all checks out with the modifier keys.
But for this example ( the physical key only carries a capital 'A' ) it's not ok.
According to the modifier rules explained in the keymaps(5) - Linux man page the following should occur:
I press keycode 16 without any modifier key and I get U+0061 or 'a' -> ok - action number zero (from the 1st column)
I press keycode 16 with shift modifier key and I get U+0041 or 'A' -> ok as the shift modifier has weight 1, so action number one (from the 2nd column)
I press keycode 16 with AltGr modifier key and I get U+0040 or '@' -> ok, AltGr weight 2 - so action number two (from the 3th column)
Now, if I press keycode 16 together with Shift and AltGr the weight adds up to 3, so action number three (from the 4th column) aka VoidSymbol so nothing shoud occur. What I get though is a capital omega 'Ω'. Why?
As for that VoidSymbol, U+0200 is actually Ȁ (Latin Capital Letter a with Double Grave). How does one print that character then if it's unicode value is used as VoidSymbol?
There are other issues too.
Another example is the physical key that has '§','6','^' on it. The keymap dumpkeys gives me has no trace of the '§' character (U+00A7). Yet, I am able to type it...
What's up with the shiftable by default?
EDIT: additional question
#define modifierShift 1; //why the difference between ShiftL and ShiftR -> there is no 'shift' key
#define modifierControl 4; //why the difference between ControlL and ControlR -> there is no 'control' key
#define modifierShiftL 16; //code 42
#define modifierShiftR 32; //code 54
#define modifierCtrlL 64; //code 29
#define modifierCtrlR 128; //code 97
Can someone clarify this for me please?
|
Linux uses two sets of keymappings. One works on the kernel input layer level, and assigns a keycode to a scancode. You can use loadkeys to change this mapping. This is what you see in evtest.
Another one works on the X server level. X has (among others) a generic evdev driver that collects input events from the kernel input layer, and then maps those to so-called keysyms. This is what you see in xev. You can modify this with xmodmap and through the xkbd extensions in a more general way.
So if you have users that are not using X, you have two choices: Act on the scancode of the key (i.e., the position of the key on the keyboard, so you implement your own keymapping), or act on the key as translated in the kernel, and instruct your users to use loadkeys etc. to load their keymapping of choice.
Both methods are "reliable", but have very different semantics.
| linux keyboard input logging - keymap translation [closed] |
1,503,320,911,000 |
In my vim instead using hjkl to moving I use Alt Gr+(wasd) (like in a game but enabling it with Alt Gr) and I love it, please don't try to convince me that is bad idea, it is not the case.
In fact, as far as I know there is no way to map Alt Gr in vim, what I do is mapping those Greek like characters that happens when you press Alt Gr+(was): łæßð.
So, I feel this way of replacing the arrows is very comfortable for my fingers and I'd really love to be able to use it everywhere not only in vim, I've been reading how to remap keys in Linux (I use Manjaro) but it looks like you can only map one key code to another, and what I want to do is map characters (łæßð) to the key codes of the arrows.
Someone know how to do that?
From my .vimrc:
"movement with a,d,w,s
noremap æ <left>
noremap ð <right>
noremap ß <down>
noremap ł <up>
inoremap æ <left>
inoremap ð <right>
inoremap ß <down>
inoremap ł <up>
Distribution: Manjaro (Kernel: 5.6.12-1-MANJARO)
Desktop environment: KDE Plasma
|
Short answer
xmodmap -e 'keycode 38 = a A a A Left'
xmodmap -e 'keycode 40 = d D d D Right'
xmodmap -e 'keycode 25 = w W w W Up'
xmodmap -e 'keycode 39 = s S s S Down'
Write those lines in any graphical environment startup script.
Detailled answer
One can remap keyboard events using the xmodmap command. As an exemple if you want to remap Altr Gr + a to the left arrow, use this command:
xmodmap -e 'keycode 38 = a A a A Left'
You can find the keycode of a specific key using the xev command: when pressing a key, the terminal will output information including the keycode . You can use the following command from the ArchWiki to output only the relevant information:
xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'
The five parameters at the right of the equal signal correspond to the modifiers:
---> Caps Lock + a = A
|
------> Shift + a = A
| |
xmodmap -e 'keycode 38 = a A a A Left' --> Alt. Gr + a = Left
| |
-----> a = a
|
----> Ctrl. + a = a
In order to run those lines at KDE startup you can add an desktop entry in your ~/.config/autostart/ folder. You need two files: one containing the xmodmap settings and one for the startupt desktop entry. Let us write the mapping settings in ~/.config/xmodmap/xmodmaprc:
keycode 38 = a A a A Left
keycode 40 = d D d D Right
keycode 25 = w W w W Up
keycode 39 = s S s S Down
And here is an example of a desktop entry file ~/.config/autostart/xmodmap.desktop:
[Desktop Entry]
Name[en_US]=Xmodmap
Comment[en_US]=xmodmap ~/.config/xmodmap/xmodmaprc
Exec=/usr/bin/xmodmap ~/.config/xmodmap/xmodmaprc
Icon=application-default-icon
X-KDE-Autostart-enabled=true
Type=Application
I don't have any desktop environment running on my system to try this out but it should be working.
Notes
The xmodmap method only works in a graphical environment. This mapping won't work on the Linux console (tty). See Remap keyboard on the Linux console.
Keep in mind that the keyboard is reset at each layout change. This method is only recommended for one-layout configuration.
If you did something wrong with xmodmap you can erase all settings using setxkbmap -option.
| How to remap characters like in vim but in the entire OS? |
1,503,320,911,000 |
As you can see one the link below, that pc has an integrated numpad on the keyboard. But, Linux Mint 19 doesn't recognize de key 'fn' to change from number pad to the actual letter. Is there any combination of keys to change that instead of using the 'fn' key? or any universal driver for this type of keyboard (like cheese for webcam)?
|
Linux is not special in this regard.
As I have said before:
Fn does not appear on keyboard layouts, you will find, because as far as the operating system is concerned, it does not exist. Operating systems do not deal in this key.
The Fn key is handled entirely by the microprocessor in the keyboard. Knowledge of it is not sent over the wire. There's no USB HID "usage" denoting it. It has no PS/2 scancode.
The keyboard's microprocessor uses the current Fn shift state (incorporating any "Fn lock" or latch) to determine the usages/scancodes that are sent over the wire for other keys, including the keys that double-up as both function keys and (say) multimedia keys.
(In a number of modern keyboard microprocessors, there are four maps from physical keys to usages/scancodes, one for each of the four combinations of current Fn shift state and NumLock LED (sic!) state.)
For some keyboards with Fn keys, the manufacturer also provides a vendor-private USB output mechanism for setting the sense of the Fn shift state, so that it is always on and the key turns it off rather than it being always off and the key turning it on. This mechanism is what a firmware's SETUP utility invokes, and what utilities like the Lenovo Keyboard "Driver" invoke on Windows. Outwith this, though, operating systems and applications have no knowledge of Fn.
Further reading
Jonathan de Boyne Pollard (2020). The "Fn" key is local.. Frequently Given Answers.
https://unix.stackexchange.com/a/331421/5132
| How to configure integrated numpad on keyboard, using linix mint? |
1,557,570,862,000 |
My keyboard is messing up. I can click on Z, X, C fine and I can press Ctrl + S to save file, Ctrl+Shift+D to duplicate line (in Atom) without any problem. All keys works fine.
But the strange thing is that I cannot use: Ctrl+Z to undo or Ctrl+C to copy or Ctrl+X to cut. It does not show any warning or error.
It does that in all IDEs, Browsers and text editors.
Even when I run top command in terminal I cannot use Ctrl+Z or Ctrl+C to stop it.
I tried to follow this but I got lost.
What can I do?
|
I think my keybord is dead!.
just installed windows as dual boot and it's doing the same.
so let me just close the Q
| Ctrl+z, Ctrl+x, Ctrl+c are not working in Ubuntu 16.04 LTS |
1,557,570,862,000 |
On OpenBSD 6.4 , my usb keyboard is dead so i get a old ps2 keyboard.
The problem now is that it is configured as qwerty keyboard and it is a azerty keyboard.
I can set it in xfce with :
Keyboard model : Logitech internet 350 keyboard
Keyboard layout : French (Azerty)
It is always qwerty in xenodm.
dmesg tell me :
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
There is no keyboard listed with wsconsctl.
So with wsconctl keyboard.encoding=fr, i get :
wsconsctl: /dev/wskbd0: No such file or directory.
What can i do ?
|
The /dev/wskbd0 device should exist on an OpenBSD 6.4 system. If it doesn't, it's a sign of a botched or incomplete upgrade or installation (creating the devices is usually the last step in an installation or upgrade and is done automatically if you install/upgrade by booting the bsd.rd kernel), or you may have deleted some device files manually.
To recreate the default devices, use
cd /dev && doas ./MAKEDEV all
The /dev/MAKEDEV script will then recreate the device files that should exist on any OpenBSD 6.4 system, including the /dev/wskbd0 file.
| PS2 keyboard in OpenBSD 6.4 |
1,557,570,862,000 |
Whenever I press the escape key (ESC), bash ignores the next character that I type. Is that normal? It is very annoying, because I have a habit of pressing escape redundantly from using vim, where I use it to return from insert mode to normal mode.
Why does bash behave this way and how can I turn it off?
|
That is the normal/expected behaviour for an ANSI terminal.
When you type Esc the terminal starts processing an eventual ANSI escape sequence (if you went on typing [ and then A the cursor would go up).
So, after Esc the terminal waits for the next character in the sequence, if it does not belong to a know sequence then it stops processing, but both Esc and the next character you typed will be lost (they were part of an illegal sequence, and so the are dropped).
How to stop it? One thing you could do is change the inter character timeout for the terminal by calling for example timeout() from a program. See this:
While interpreting an input escape sequence, wgetch sets a timer while waiting for the next character. If notimeout(win, TRUE) is called, then wgetch does not set a timer. The purpose of the timeout is to differentiate between sequences received from a function key and those typed by a user.
| Bash ignores key press after pressing Escape key |
1,360,312,318,000 |
What commands do I need for Linux's ls to show the file size in MB?
|
ls -l --block-size=M will give you a long format listing (needed to actually see the file size) and round file sizes up to the nearest MiB.
If you want MB (10^6 bytes) rather than MiB (2^20 bytes) units, use --block-size=MB instead.
If you don't want the M suffix attached to the file size, you can use something like --block-size=1M. Thanks Stéphane Chazelas for suggesting this.
If you simply want file sizes in "reasonable" units, rather than specifically megabytes, then you can use -lh to get a long format listing and human readable file size presentation. This will use units of file size to keep file sizes presented with about 1-3 digits (so you'll see file sizes like 6.1K, 151K, 7.1M, 15M, 1.5G and so on.
The --block-size parameter is described in the man page for ls; man ls and search for SIZE. It allows for units other than MB/MiB as well, and from the looks of it (I didn't try that) arbitrary block sizes as well (so you could see the file size as a number of 429-byte blocks if you want to).
Note that both --block-size and -h are GNU extensions on top of the Open Group's ls, so this may not work if you don't have a GNU userland (which most Linux installations do). The ls from GNU Coreutils 8.5 does support --block-size and -h as described above. Thanks to kojiro for pointing this out.
| How do I make `ls` show file sizes in megabytes? |
1,360,312,318,000 |
I am installing hadoop on my Ubuntu system. When I start it, it reports that port 9000 is busy.
I used:
netstat -nlp|grep 9000
to see if such a port exists and I got this:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
But how can I get the PID of the process which is holding it?
|
Your existing command doesn't work because Linux requires you to either be root or the owner of the process to get the information you desire.
On modern systems, ss is the appropriate tool to use to get this information:
$ sudo ss -lptn 'sport = :80'
State Local Address:Port Peer Address:Port
LISTEN 127.0.0.1:80 *:* users:(("nginx",pid=125004,fd=12))
LISTEN ::1:80 :::* users:(("nginx",pid=125004,fd=11))
You can also use the same invocation you're currently using, but you must first elevate with sudo:
$ sudo netstat -nlp | grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 125004/nginx
You can also use lsof:
$ sudo lsof -n -i :80 | grep LISTEN
nginx 125004 nginx 3u IPv4 6645 0t0 TCP 0.0.0.0:80 (LISTEN)
| Finding the PID of the process using a specific port? |
1,360,312,318,000 |
What's the most concise way to resolve a hostname to an IP address in a Bash script? I'm using Arch Linux.
|
You can use getent, which comes with glibc (so you almost certainly have it on Linux). This resolves using gethostbyaddr/gethostbyname2, and so also will check /etc/hosts/NIS/etc:
getent hosts unix.stackexchange.com | awk '{ print $1 }'
Or, as Heinzi said below, you can use dig with the +short argument (queries DNS servers directly, does not look at /etc/hosts/NSS/etc) :
dig +short unix.stackexchange.com
If dig +short is unavailable, any one of the following should work. All of these query DNS directly and ignore other means of resolution:
host unix.stackexchange.com | awk '/has address/ { print $4 }'
nslookup unix.stackexchange.com | awk '/^Address: / { print $2 }'
dig unix.stackexchange.com | awk '/^;; ANSWER SECTION:$/ { getline ; print $5 }'
If you want to only print one IP, then add the exit command to awk's workflow.
dig +short unix.stackexchange.com | awk '{ print ; exit }'
getent hosts unix.stackexchange.com | awk '{ print $1 ; exit }'
host unix.stackexchange.com | awk '/has address/ { print $4 ; exit }'
nslookup unix.stackexchange.com | awk '/^Address: / { print $2 ; exit }'
dig unix.stackexchange.com | awk '/^;; ANSWER SECTION:$/ { getline ; print $5 ; exit }'
| How can I resolve a hostname to an IP address in a Bash script? |
1,360,312,318,000 |
In my CMS, I noticed that directories need the executable bit (+x) set for the user to open them. Why is the execute permission required to read a directory, and how do directory permissions in Linux work?
|
When applying permissions to directories on Linux, the permission bits have different meanings than on regular files.
The read bit (r) allows the affected user to list the files within the directory
The write bit (w) allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes
The execute bit (x) allows the affected user to enter the directory, and access files and directories inside
The sticky bit (T, or t if the execute bit is set for others) states that files and directories within that directory may only be deleted or renamed by their owner (or root)
| Execute vs Read bit. How do directory permissions in Linux work? |
1,360,312,318,000 |
I'm trying to compress a folder (/var/www/) to ~/www_backups/$time.tar where $time is the current date.
This is what I have:
cd /var/www && sudo tar -czf ~/www_backups $time"
I am completely lost and I've been at this for hours now. Not sure if -czf is correct. I simply want to copy all of the content in /var/www into a $time.tar file, and I want to maintain the file permissions for all of the files. Can anyone help me out?
|
To tar and gzip a folder, the syntax is:
tar czf name_of_archive_file.tar.gz name_of_directory_to_tar
Adding - before the options (czf) is optional with tar. The effect of czf is as follows:
c — create an archive file (as opposed to extract, which is x)
f — filename of the archive file
z — filter archive through gzip (remove this option to create a .tar file)
If you want to tar the current directory, use . to designate that.
To construct filenames dynamically, use the date utility (look at its man page for the available format options). For example:
cd /var/www &&
tar czf ~/www_backups/$(date +%Y%m%d-%H%M%S).tar.gz .
This will create a file named something like 20120902-185558.tar.gz.
On Linux, chances are your tar also supports BZip2 compression with the j rather than z option. And possibly others. Check the man page on your local system.
| Compress a folder with tar? |
1,360,312,318,000 |
I am always very hesitant to run kill -9, but I see other admins do it almost routinely.
I figure there is probably a sensible middle ground, so:
When and why should kill -9 be used? When and why not?
What should be tried before doing it?
What kind of debugging a "hung" process could cause further problems?
|
Generally, you should use kill (short for kill -s TERM, or on most systems kill -15) before kill -9 (kill -s KILL) to give the target process a chance to clean up after itself. (Processes can't catch or ignore SIGKILL, but they can and often do catch SIGTERM.) If you don't give the process a chance to finish what it's doing and clean up, it may leave corrupted files (or other state) around that it won't be able to understand once restarted.
strace/truss, ltrace and gdb are generally good ideas for looking at why a stuck process is stuck. (truss -u on Solaris is particularly helpful; I find ltrace too often presents arguments to library calls in an unusable format.) Solaris also has useful /proc-based tools, some of which have been ported to Linux. (pstack is often helpful).
| When should I not kill -9 a process? |
1,360,312,318,000 |
Prior to doing some benchmarking work how would one free up the memory (RAM) that the Linux Kernel is consuming for its buffers and cache?
Note that this is mostly useful for benchmarking. Emptying the buffers and cache reduces performance! If you're here because you thought that freeing buffers and cache was a positive thing, go and read Linux ate my RAM!. The short story: free memory is unused memory is wasted memory.
|
Emptying the buffers cache
If you ever want to empty it you can use this chain of commands.
# free && sync && echo 3 > /proc/sys/vm/drop_caches && free
total used free shared buffers cached
Mem: 1018916 980832 38084 0 46924 355764
-/+ buffers/cache: 578144 440772
Swap: 2064376 128 2064248
total used free shared buffers cached
Mem: 1018916 685008 333908 0 224 108252
-/+ buffers/cache: 576532 442384
Swap: 2064376 128 2064248
You can signal the Linux Kernel to drop various aspects of cached items by changing the numeric argument to the above command.
To free pagecache:
# echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
# echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
# echo 3 > /proc/sys/vm/drop_caches
The above are meant to be run as root. If you're trying to do them using sudo then you'll need to change the syntax slightly to something like these:
$ sudo sh -c 'echo 1 >/proc/sys/vm/drop_caches'
$ sudo sh -c 'echo 2 >/proc/sys/vm/drop_caches'
$ sudo sh -c 'echo 3 >/proc/sys/vm/drop_caches'
NOTE: There's a more esoteric version of the above command if you're into that:
$ echo "echo 1 > /proc/sys/vm/drop_caches" | sudo sh
Why the change in syntax? The /bin/echo program is running as root, because of sudo, but the shell that's redirecting echo's output to the root-only file is still running as you. Your current shell does the redirection before sudo starts.
Seeing what's in the buffers and cache
Take a look at linux-ftools if you'd like to analyze the contents of the buffers & cache. Specifically if you'd like to see what files are currently being cached.
fincore
With this tool you can see what files are being cached within a give directory.
fincore [options] files...
--pages=false Do not print pages
--summarize When comparing multiple files, print a summary report
--only-cached Only print stats for files that are actually in cache.
For example, /var/lib/mysql/blogindex:
root@xxxxxx:/var/lib/mysql/blogindex# fincore --pages=false --summarize --only-cached *
stats for CLUSTER_LOG_2010_05_21.MYI: file size=93840384 , total pages=22910 , cached pages=1 , cached size=4096, cached perc=0.004365
stats for CLUSTER_LOG_2010_05_22.MYI: file size=417792 , total pages=102 , cached pages=1 , cached size=4096, cached perc=0.980392
stats for CLUSTER_LOG_2010_05_23.MYI: file size=826368 , total pages=201 , cached pages=1 , cached size=4096, cached perc=0.497512
stats for CLUSTER_LOG_2010_05_24.MYI: file size=192512 , total pages=47 , cached pages=1 , cached size=4096, cached perc=2.127660
stats for CLUSTER_LOG_2010_06_03.MYI: file size=345088 , total pages=84 , cached pages=43 , cached size=176128, cached perc=51.190476
stats for CLUSTER_LOG_2010_06_04.MYD: file size=1478552 , total pages=360 , cached pages=97 , cached size=397312, cached perc=26.944444
stats for CLUSTER_LOG_2010_06_04.MYI: file size=205824 , total pages=50 , cached pages=29 , cached size=118784, cached perc=58.000000
stats for COMMENT_CONTENT_2010_06_03.MYI: file size=100051968 , total pages=24426 , cached pages=10253 , cached size=41996288, cached perc=41.975764
stats for COMMENT_CONTENT_2010_06_04.MYD: file size=716369644 , total pages=174894 , cached pages=79821 , cached size=326946816, cached perc=45.639645
stats for COMMENT_CONTENT_2010_06_04.MYI: file size=56832000 , total pages=13875 , cached pages=5365 , cached size=21975040, cached perc=38.666667
stats for FEED_CONTENT_2010_06_03.MYI: file size=1001518080 , total pages=244511 , cached pages=98975 , cached size=405401600, cached perc=40.478751
stats for FEED_CONTENT_2010_06_04.MYD: file size=9206385684 , total pages=2247652 , cached pages=1018661 , cached size=4172435456, cached perc=45.321117
stats for FEED_CONTENT_2010_06_04.MYI: file size=638005248 , total pages=155763 , cached pages=52912 , cached size=216727552, cached perc=33.969556
stats for FEED_CONTENT_2010_06_04.frm: file size=9840 , total pages=2 , cached pages=3 , cached size=12288, cached perc=150.000000
stats for PERMALINK_CONTENT_2010_06_03.MYI: file size=1035290624 , total pages=252756 , cached pages=108563 , cached size=444674048, cached perc=42.951700
stats for PERMALINK_CONTENT_2010_06_04.MYD: file size=55619712720 , total pages=13579031 , cached pages=6590322 , cached size=26993958912, cached perc=48.533080
stats for PERMALINK_CONTENT_2010_06_04.MYI: file size=659397632 , total pages=160985 , cached pages=54304 , cached size=222429184, cached perc=33.732335
stats for PERMALINK_CONTENT_2010_06_04.frm: file size=10156 , total pages=2 , cached pages=3 , cached size=12288, cached perc=150.000000
---
total cached size: 32847278080
With the above output you can see that there are several *.MYD, *.MYI, and *.frm files that are currently being cached.
Swap
If you want to clear out your swap you can use the following commands.
$ free
total used free shared buffers cached
Mem: 7987492 7298164 689328 0 30416 457936
-/+ buffers/cache: 6809812 1177680
Swap: 5963772 609452 5354320
Then use this command to disable swap:
$ swapoff -a
You can confirm that it's now empty:
$ free
total used free shared buffers cached
Mem: 7987492 7777912 209580 0 39332 489864
-/+ buffers/cache: 7248716 738776
Swap: 0 0 0
And to re-enable it:
$ swapon -a
And now reconfirm with free:
$ free
total used free shared buffers cached
Mem: 7987492 7785572 201920 0 41556 491508
-/+ buffers/cache: 7252508 734984
Swap: 5963772 0 5963772
| How do you empty the buffers and cache on a Linux system? |
1,360,312,318,000 |
What is the Linux command to check the server OS and its version?
I am connected to the server using shell.
|
Kernel Version
If you want kernel version information, use uname(1). For example:
$ uname -a
Linux localhost 3.11.0-3-generic #8-Ubuntu SMP Fri Aug 23 16:49:15 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Distribution Information
If you want distribution information, it will vary depending on your distribution and whether your system supports the Linux Standard Base. Some ways to check, and some example output, are immediately below.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu Saucy Salamander (development branch)
Release: 13.10
Codename: saucy
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.10
DISTRIB_CODENAME=saucy
DISTRIB_DESCRIPTION="Ubuntu Saucy Salamander (development branch)"
$ cat /etc/issue.net
Ubuntu Saucy Salamander (development branch)
$ cat /etc/debian_version
wheezy/sid
| How to check OS and version using a Linux command [duplicate] |
1,360,312,318,000 |
I want to set a folder such that anything created within it (directories, files) inherit default permissions and group.
Lets call the group "media". And also, the folders/files created within the directory should have g+rw automatically.
|
I found it: Applying default permissions
From the article:
Set the setgid bit, so that files/folder under <directory> will be created with the same group as <directory>
chmod g+s <directory>
Set the default ACLs for the group and other
setfacl -d -m g::rwx /<directory>
setfacl -d -m o::rx /<directory>
Next we can verify:
getfacl /<directory>
Output:
# file: ../<directory>/
# owner: <user>
# group: media
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x
| How to set default file permissions for all folders/files in a directory? |
1,360,312,318,000 |
I'd like to do some general disk io monitoring on a debian linux server. What are the tools I should know about that monitor disk io so I can see if a disk's performance is maxed out or spikes at certain time throughout the day?
|
For disk I/O trending there are a few options. My personal favorite is the sar command from sysstat. By default, it gives output like this:
09:25:01 AM CPU %user %nice %system %iowait %steal %idle
09:35:01 AM all 0.11 0.00 0.01 0.00 0.00 99.88
09:45:01 AM all 0.12 0.00 0.01 0.00 0.00 99.86
09:55:01 AM all 0.09 0.00 0.01 0.00 0.00 99.90
10:05:01 AM all 0.10 0.00 0.01 0.02 0.01 99.86
Average: all 0.19 0.00 0.02 0.00 0.01 99.78
The %iowait is the time spent waiting on I/O. Using the Debian package, you must enable the stat collector via the /etc/default/sysstat config file after package installation.
To see current utilization broken out by device, you can use the iostat command, also from the sysstat package:
$ iostat -x 1
Linux 3.5.2-x86_64-linode26 (linode) 11/08/2012 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.84 0.00 0.08 1.22 0.07 97.80
Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util
xvda 0.09 1.02 2.58 0.49 112.79 12.11 40.74 0.15 48.56 3.88 1.19
xvdb 1.39 0.43 4.03 1.82 43.33 18.43 10.56 0.66 112.73 1.93 1.13
Some other options that can show disk usage in trending graphs is munin and cacti.
| How can I monitor disk io? |
1,360,312,318,000 |
Most of the info I see online says to edit /etc/resolv.conf, but any changes I make there just get overridden.
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND --
# YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
It seems that 127.0.1.1 is a local instance of dnsmasq. The dnsmasq docs say to edit /etc/resolv.conf. I tried putting custom nameservers in /etc/resolv.conf.d/base, but the changes didn't show up in /etc/resolv.conf after running sudo resolvconf -u.
FYI, I don't want to change DNS on a per-connection basis, I want to set default DNS settings to use for all connections when not otherwise specified.
UPDATE:
I answered this question myself:
https://unix.stackexchange.com/a/163506/67024
I think it's the best solution since:
It works.
It requires the least amount of changes and
It still works in conjunction with dnsmasq's DNS cache, rather than bypassing it.
|
I found out that you can change the nameservers that dnsmasq uses by adding the following lines to /etc/dnsmasq.conf:
server=8.8.8.8
server=8.8.4.4
I didn't have a /etc/dnsmasq.conf file though, since it's installed by the dnsmasq package, but Ubuntu only comes with dnsmasq-base. I ran sudo apt-get install dnsmasq, then edited /etc/dnsmasq.conf, then sudo service dnsmasq restart and sudo service network-manager restart.
I ran sudo tail -n 200 /var/log/syslog to check my syslog and verify that dnsmasq was using the nameservers I specified:
Oct 21 23:00:54 mylaptop dnsmasq[8611]: using nameserver 8.8.8.8#53
Oct 21 23:00:54 mylaptop dnsmasq[8611]: using nameserver 8.8.4.4#53
| How do I set my DNS when resolv.conf is being overwritten? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.