I'm testing xvfb-run possibilities and I display the famous trex game in a chromium tab on a specific DISPLAY with this command line : $
xvfb-run -n 1 -f ~/.Xauthority --server-args='-screen 0 1600x1200x24 -shmem -listen tcp' chromium-browser --no-sandbox --disable-gpu --window-size=1600,1200 --window-position=0,0 --kiosk http://www.trex-game.skipser.com
The fact is, when I press "space" key, the trex should start walking and jumping. But none of this happen.
So I ran the following command :
DISPLAY=:1 xinput
And I was surprised to see there was no real keyboards.
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Xvfb mouse id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Xvfb keyboard id=7 [slave keyboard (3)]
If I use :
DISPLAY=:1 xdotool key space
I'm able to jump with the trex, which is normal because xdotool directly interact with the XTEST keyboard if I'm right.
I thought that my X server was listening on the /dev/input folder, but I start wondering if I should somehow attach my keyboard on the x server.
Does anyone know how to do so ?
Related
I have an external monitor that I plug-in my Dell laptop after turn it on. The sound works before and after plug it in the Laptop, So the headphone works too, plugin it in and out too. The problem is when I resume Debian after suspend. The sound has gone, and some times when increasing and decreasing volume one of the three options appears in the screen: Headphone unplugged, HDMI output (or something like), or Dummy Output.
I will show now what happens when Dummy Output is displayed and some outputs of commands.
$ lspci | grep Audio
Output:
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
$ lsmod | grep hda
Output:
snd_hda_ext_core 28672 1 snd_soc_skl
snd_hda_intel 36864 0
snd_hda_codec 135168 1 snd_hda_intel
snd_hda_core 90112 4 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_soc_skl
snd_hwdep 16384 1 snd_hda_codec
snd_pcm 110592 6 snd_hda_intel,snd_hda_codec,snd_hda_ext_core,snd_hda_core,snd_soc_skl,snd_soc_core
snd 86016 7 snd_compress,snd_hda_intel,snd_hwdep,snd_hda_codec,snd_timer,snd_soc_core,snd_pcm
$ sudo dmesg | grep snd
Output (when rebooting):
[ 13.341580] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 13.461226] snd_hda_intel 0000:00:1f.3: CORB reset timeout#1, CORBRP = 0
[ 13.462799] snd_hda_intel 0000:00:1f.3: no codecs found!
$ sudo alsactl init
Output:
alsactl: init:1757: No soundcards found...
Complete Alsa Information script:
https://alsa-project.org/db/?f=ff03c7d8dac369fc1211822de963b337c132420c
So it looks like the sound card is there but alsa does not recognize it.
Many forums/sites recommend to blacklist snd_hda_codec_hdmi (that would be the case when the problem is with connecting/desconnecting HDMI for the external monitor), and also put a line:
options snd-hda-intel model=generic
in a file, e.g., /etc/modprobe.d/alsa-base-blacklist.conf.
But it didn't work.
Other sites suggest to disable and enable sound in BIOS. Didn't work.
Can anyone help me solve this forever issue?
the problem is that the speed and acceleration of my mouse is too high and the system setting (Ubuntu) is completely useless so I need an external tool/trick to adjust it.
So, how to slow down definitely the mouse at startup without doing the command manually?
The xinput list's output is:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SYN1B7E:01 06CB:2970 UNKNOWN id=14 [slave pointer (2)]
⎜ ↳ MOSART Semi. 2.4G Keyboard Mouse id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Video Bus id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ CHICONY USB Keyboard id=10 [slave keyboard (3)]
↳ HD WebCam id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=15 [slave keyboard (3)]
↳ Acer WMI hotkeys id=16 [slave keyboard (3)]
↳ MOSART Semi. 2.4G Keyboard Mouse id=11 [slave keyboard (3)]
Now, at startup I setted this command:
xinput --set-prop "pointer:MOSART Semi. 2.4G Keyboard Mouse" "libinput Accel Speed" -0.7
but with appareantly no reason, at some time the mouse come back to its initial speed value...
Also, sometimes at startup the command does not work.
My aim is simple to have a mouse with always the same acceptable speed!
Thanks!
To set the speed, use this:
xinput --set-prop device_id_or_name "Device Accel Constant Deceleration" number
In your case:
xinput --set-prop "MOSART Semi. 2.4G Keyboard Mouse" "Device Accel Constant Deceleration" -0.7
Save the above in a file as ~/.xprofile.
Use THIS script. It will do all the hard work for you.
https://github.com/rubo77/mouse-speed
Alternatively you could run something like xset mouse 10 0
Or you could create an Xorg config /etc/X11/xorg.conf.d/acceleration.conf
Section "InputClass"
Identifier "Mouse"
MatchIsPointer "yes"
# set the following to 1 1 0 respectively to disable acceleration.
Option "AccelerationNumerator" "2"
Option "AccelerationDenominator" "1"
Option "AccelerationThreshold" "4"
EndSection
The following settings is working fine in my linux.
First get the pointer id using following command:
$ xinput --list
Then replace $id with pointer id
$ xinput set-prop $id 'libinput Accel Speed' 0.65
$ xinput set-prop $id 'libinput Accel Profiles Available' 1, 1
$ xinput set-prop $id 'libinput Accel Profile Enabled' 1, 0
$ xinput set-prop $id 'Coordinate Transformation Matrix' 0.3125, 0, 0, 0, 0.2, 0, 0, 0, 1.16
$ xset mouse 15/1 15
You can create a bash script to do the hard work for you, and then call it automatically via udev rules every time the mouse gets connected to any USB port.
1st STEP) Get the idVendor and idProduct from your mouse
1. Connect the mouse to any usb port
2. Launch the terminal and execute the command below to list the details of your usb devices
lsusb
You'll get an output similar to this
Bus 001 Device 074: ID 1038:1300 SteelSeries ApS
After "ID" and before ":" is the idVendor.
After ":" and before the name of the mouse is the idProduct.
2nd STEP) Create a bash script (fixMouse.sh) to do the hard work for us
1. Launch the terminal and execute the command below to create and edit a file named fixMouse.sh under /usr/local/bin/
sudo nano /usr/local/bin/fixMouse.sh
Insert the following code and save the file
MOUSE_ID=$(xinput --list --short | grep MOSART | cut -d "=" -f2 | cut -c 1-2)
if [ ! -z "$MOUSE_ID" ]
then
PROP_ID=$(xinput --list-props "$MOUSE_ID" | grep 'Accel Speed' | cut -d "(" -f2 | cut -c 1-3 | tail -2 | head -1)
fi
if [ ! -z "$MOUSE_ID" ]
then
xinput --set-prop "$MOUSE_ID" "$PROP_ID" -1
fi
3rd STEP) Create a .rules file under /etc/udev/rules.d
1. Launch the terminal and execute the command below to create a mouse.rules file
nano /etc/udev/rules.d/mouse.rules
2. Insert the code below, changing the values accordingly, and save the file.
> ACTION=="bind", SUBSYSTEM=="usb", ENV{DISPLAY}=":0.0",
> ENV{XAUTHORITY}="/home/<your-user-name>/.Xauthority",
> ATTRS{idVendor}=="<your-mouse-idVendor>",
> ATTRS{idProduct}=="<your-mouse-idProduct>",
> RUN+="/usr/local/bin/fixMouse.sh"
4th STEP) Making the changes permanent for debian based distros with Gnome
(for other DMs please take a look at https://askubuntu.com/questions/48321)
1. Launch the terminal and execute the command below to go to the autostart folder
cd ~/.config/autostart
Note: If that doesn't work, create the directory with the following command
mkdir ~/.config/autostart && cd ~/.config/autostart
2. Execute the command below to create a file named fixMouse.desktop
nano fixMouse.desktop
3. Add the following content
[Desktop Entry]
Type=Application
Exec=/usr/local/bin/fixMouse.sh
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_US]=fixMouse
Comment[en_US]=fixes Mouse sensitivity issue after startup
X-GNOME-Autostart-Delay=0
4. Execute the following command to give execution permission to fixMouse.desktop
chmod +x fixMouse.desktop
5th STEP) Reboot your system
Note: I was able to reproduce the 4th STEP on a Debian distro with Cinnamon, without any errors.
I want to run below commands on startup of linux mint os. which will enable my laptop touchpad two finger scroll.
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8
Depending on you WindowManager you could use its autorun feature to run the script.
I know the following does not answer the question, but why don't you configure the synaptics driver in you xorg configuration?
http://www.x.org/releases/X11R7.6/doc/man/man4/synaptics.4.xhtml
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1
Not sure what this is.
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1
Option "VertTwoFingerScroll" "boolean"
Enable vertical scrolling when dragging with two fingers anywhere on the touchpad. Property: "Synaptics Two-Finger Scrolling"
Option "HorizTwoFingerScroll" "boolean"
Enable horizontal scrolling when dragging with two fingers anywhere on the touchpad. Property: "Synaptics Two-Finger Scrolling"
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10
Option "EmulateTwoFingerMinZ" "integer"
For touchpads not capable of detecting multiple fingers (Alps), this sets the Z pressure threshold to emulate a two finger press. Property: "Synaptics Two-Finger Pressure"
O
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8
Option "EmulateTwoFingerMinW" "integer"
Some touchpads report a two-finger touch as wide finger. This sets the finger width threshold to emulate a two finger press. This feature works best with (PalmDetect) off. Property: "Synaptics Two-Finger Width"
Depending on which shell you are using (which you've not responded to yet), you could just put these start up commands in a startup script. This is where you would typically personalise your linux/ unix env. See the links below to get the idea...
.bashrc file if you use the bash shell
.profile for bourne shells (e.g. ksh, zsh [and bash again])
I want to be able to do so from both Windows and from Linux. I know that there are ways by getting sysinfo and using thumb rules related to hardware identifiers.
I want to know if there is a more fundamental method, like looking at a memory address / issuing an interrupt etc.
BTW I am trying to do this on Intel hardware and the virtualization software I use are Vmware Workstation and Windows HyperV.
Here is one more useful command:
$ lscpu | grep -E 'Hypervisor vendor|Virtualization type'
Hypervisor vendor: KVM
Virtualization type: full
Example output of other commands:
$ sudo virt-what
kvm
$ dmesg | grep -i virtual
[ 0.000000] Booting paravirtualized kernel on KVM
[ 0.029160] CPU0: Intel QEMU Virtual CPU version 1.0 stepping 03
$ sudo dmidecode | egrep -i 'manufacturer|product|vendor|domU'
Vendor: Bochs
Manufacturer: Bochs
Product Name: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
Manufacturer: Bochs
At least one of these should work to detect if you are running under VMware (or some other common virtual environment) on Linux:
Check for virtual devices detected by kernel when system boots.
dmesg | grep -i virtual
Another way to detect virtualized hardware devices, if dmesg doesn't say anything useful.
dmidecode | egrep -i 'manufacturer|product|vendor|domU'
You can also check for virtual disks:
cat /proc/ide/hd*/model
Virtuozzo can usually be detected by looking for /proc/vz or /dev/vzfs.
Most software check the hypervisor CPUID leaf -
Leaf 0x40000000, Hypervisor CPUID information
EAX: The maximum input value for hypervisor CPUID info (0x40000010).
EBX, ECX, EDX: Hypervisor vendor ID signature. E.g. "KVMKVMKVM"
Leaf 0x40000010, Timing information.
EAX: (Virtual) TSC frequency in kHz.
EBX: (Virtual) Bus (local apic timer) frequency in kHz.
ECX, EDX: RESERVED
Ofcourse, you are still relying on the hypervisor to give you this information. It may very well decide to not report 0x40000000 at all, in turn leading the guest to believe that it's actually running on real hardware
As the title says!
I can read info from the device with "dmesg" and see it when "lsusb" but how do I attach/install it as for example dev/ttyUSB2
One way is to change the VID and PID with FTDI software FT Prog (utility for programming the EEPROM of FTxxx devices). Change to 0403 and 6001, Linux will then recognise it as a generic FTDI.
If you don't want to modify the ftdi chips settings, you could just add the VID / PID to the list of ids recognized by the ftdi driver. To do this at run time (non permanent) do:
modprobe ftdi_sio
echo "1c40 0477" > /sys/bus/usb-serial/drivers/ftdi_sio/new_id