当我启动 Ubuntu 时,我的无线 USB 鼠标经常会卡住片刻,并且鼠标滚轮太敏感了。只有当我拔下无线 USB 并重新插入时,鼠标才会恢复正常。
我想在启动 bash 脚本中模拟拔出和插入 USB 鼠标,这样我就不必每次都手动执行此操作。有没有可以执行此操作的终端命令?
非常感谢。
terminal:~$ xinput -list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 id=10 [slave pointer (2)]
⎜ ↳ Microsoft Microsoft® Nano Transceiver v2.0 id=11 [slave pointer (2)]
⎜ ↳ eGalax Inc. eGalaxTouch EXC3000-0367-44.00.00 id=13 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [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)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Microsoft Microsoft® Nano Transceiver v2.0 id=9 [slave keyboard (3)]
↳ HP Webcam id=12 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ HP Wireless hotkeys id=16 [slave keyboard (3)]
↳ HP WMI hotkeys id=17 [slave keyboard (3)]
terminal:~$ xinput --list-props
Usage: xinput list-props <device> [<device> ...]
terminal:~$ xinput --list-props 11
Device 'Microsoft Microsoft® Nano Transceiver v2.0':
Device Enabled (143): 1
Coordinate Transformation Matrix (145): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (272): 0
Device Accel Constant Deceleration (273): 1.000000
Device Accel Adaptive Deceleration (274): 1.000000
Device Accel Velocity Scaling (275): 10.000000
Device Product ID (261): 1118, 1861
Device Node (262): "/dev/input/event7"
Evdev Axis Inversion (276): 0, 0
Evdev Axes Swap (278): 0
Axis Labels (279): "Rel X" (153), "Rel Y" (154), "Rel Horiz Wheel" (268)
Button Labels (280): "Button 0" (265), "Button Unknown" (264), "Button Unknown" (264), "Button Wheel Up" (149), "Button Wheel Down" (150), "Button Horiz Wheel Left" (151), "Button Horiz Wheel Right" (152)
Evdev Scrolling Distance (281): 1, 1, 1
Evdev Middle Button Emulation (282): 0
Evdev Middle Button Timeout (283): 50
Evdev Third Button Emulation (284): 0
Evdev Third Button Emulation Timeout (285): 1000
Evdev Third Button Emulation Button (286): 3
Evdev Third Button Emulation Threshold (287): 20
Evdev Wheel Emulation (288): 0
Evdev Wheel Emulation Axes (289): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (290): 10
Evdev Wheel Emulation Timeout (291): 200
Evdev Wheel Emulation Button (292): 4
Evdev Drag Lock Buttons (293): 0
terminal:~$ xinput --list-props 10
Device 'Microsoft Microsoft® Nano Transceiver v2.0':
Device Enabled (143): 1
Coordinate Transformation Matrix (145): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (272): 0
Device Accel Constant Deceleration (273): 1.000000
Device Accel Adaptive Deceleration (274): 1.000000
Device Accel Velocity Scaling (275): 10.000000
Device Product ID (261): 1118, 1861
Device Node (262): "/dev/input/event6"
Evdev Axis Inversion (276): 0, 0
Evdev Axes Swap (278): 0
Axis Labels (279): "Rel X" (153), "Rel Y" (154), "Rel Horiz Wheel" (268), "Rel Dial" (269), "Rel Vert Wheel" (270), "Rel Misc" (271)
Button Labels (280): "Button Left" (146), "Button Middle" (147), "Button Right" (148), "Button Wheel Up" (149), "Button Wheel Down" (150), "Button Horiz Wheel Left" (151), "Button Horiz Wheel Right" (152), "Button Side" (266), "Button Extra" (267), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264), "Button Unknown" (264)
Evdev Scrolling Distance (281): 1, 1, 1
Evdev Middle Button Emulation (282): 0
Evdev Middle Button Timeout (283): 50
Evdev Third Button Emulation (284): 0
Evdev Third Button Emulation Timeout (285): 1000
Evdev Third Button Emulation Button (286): 3
Evdev Third Button Emulation Threshold (287): 20
Evdev Wheel Emulation (288): 0
Evdev Wheel Emulation Axes (289): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (290): 10
Evdev Wheel Emulation Timeout (291): 200
Evdev Wheel Emulation Button (292): 4
Evdev Drag Lock Buttons (293): 0
编辑:从上面看,ubuntu 似乎在 id 10 和 11 下为同一个鼠标运行两个驱动程序。
编辑:我解决了鼠标错误。
在文件中..
/etc/laptop-mode/conf.d/runtime-pm.conf
我必须
CONTROL_RUNTIME_AUTOSUSPEND=0
这解决了我多年来遇到的鼠标错误。
答案1
尝试这样的操作:
sudo modprobe -r usbhid && sudo modprobe usbhid
您可以将其放入脚本中,并将脚本链接到键盘快捷键,或类似的操作(如果您想要快捷方式,则必须对那里的 sudo 权限做些什么)。
如果这不起作用,请尝试在其中添加睡眠,如下所示:
sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid