How can I simulate unplugging and plugging in my usb mouse from terminal and bash script?











up vote
1
down vote

favorite












When I ever boot into Ubuntu my wireless usb mouse gets stuck for moments frequently and the mouse wheel is too sensitive. Only when I unplug the wireless usb and plug it back in does the mouse return to normal.



I would like to simulate unplugging and plugging in my usb mouse in my startup bash script so that I don't have to do it manually every time. Is there a terminal command for this?



Thanks so much.



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


Edit: it seems as though from above that ubuntu is running two drivers for the same mouse under id 10 and 11.



Edit: I solved the mouse bug.



In the file..



/etc/laptop-mode/conf.d/runtime-pm.conf


I had to make



CONTROL_RUNTIME_AUTOSUSPEND=0


This fixes the mouse bug I was experiencing for years.










share|improve this question
























  • You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
    – Sergiy Kolodyazhnyy
    Mar 30 '16 at 2:27















up vote
1
down vote

favorite












When I ever boot into Ubuntu my wireless usb mouse gets stuck for moments frequently and the mouse wheel is too sensitive. Only when I unplug the wireless usb and plug it back in does the mouse return to normal.



I would like to simulate unplugging and plugging in my usb mouse in my startup bash script so that I don't have to do it manually every time. Is there a terminal command for this?



Thanks so much.



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


Edit: it seems as though from above that ubuntu is running two drivers for the same mouse under id 10 and 11.



Edit: I solved the mouse bug.



In the file..



/etc/laptop-mode/conf.d/runtime-pm.conf


I had to make



CONTROL_RUNTIME_AUTOSUSPEND=0


This fixes the mouse bug I was experiencing for years.










share|improve this question
























  • You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
    – Sergiy Kolodyazhnyy
    Mar 30 '16 at 2:27













up vote
1
down vote

favorite









up vote
1
down vote

favorite











When I ever boot into Ubuntu my wireless usb mouse gets stuck for moments frequently and the mouse wheel is too sensitive. Only when I unplug the wireless usb and plug it back in does the mouse return to normal.



I would like to simulate unplugging and plugging in my usb mouse in my startup bash script so that I don't have to do it manually every time. Is there a terminal command for this?



Thanks so much.



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


Edit: it seems as though from above that ubuntu is running two drivers for the same mouse under id 10 and 11.



Edit: I solved the mouse bug.



In the file..



/etc/laptop-mode/conf.d/runtime-pm.conf


I had to make



CONTROL_RUNTIME_AUTOSUSPEND=0


This fixes the mouse bug I was experiencing for years.










share|improve this question















When I ever boot into Ubuntu my wireless usb mouse gets stuck for moments frequently and the mouse wheel is too sensitive. Only when I unplug the wireless usb and plug it back in does the mouse return to normal.



I would like to simulate unplugging and plugging in my usb mouse in my startup bash script so that I don't have to do it manually every time. Is there a terminal command for this?



Thanks so much.



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


Edit: it seems as though from above that ubuntu is running two drivers for the same mouse under id 10 and 11.



Edit: I solved the mouse bug.



In the file..



/etc/laptop-mode/conf.d/runtime-pm.conf


I had to make



CONTROL_RUNTIME_AUTOSUSPEND=0


This fixes the mouse bug I was experiencing for years.







command-line usb bash mouse






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 11 at 4:16

























asked Mar 30 '16 at 2:19









deanresin

234314




234314












  • You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
    – Sergiy Kolodyazhnyy
    Mar 30 '16 at 2:27


















  • You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
    – Sergiy Kolodyazhnyy
    Mar 30 '16 at 2:27
















You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
– Sergiy Kolodyazhnyy
Mar 30 '16 at 2:27




You can try loading and unloading the driver. That has Pretty much same effect. I'm on mobile though so can't say much more on that right now
– Sergiy Kolodyazhnyy
Mar 30 '16 at 2:27










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try something like this:



sudo modprobe -r usbhid && sudo modprobe usbhid


You can put that in a script and link the script to a keyboard shortcut, or something along those lines (you'd have to do something about the sudo perms there if you wanted a shortcut).



If this doesn't work, try adding a sleep in there like this:



sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid





share|improve this answer





















  • Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
    – deanresin
    Mar 30 '16 at 3:02










  • Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
    – Zzzach...
    Mar 30 '16 at 3:36












  • [sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
    – deanresin
    Mar 30 '16 at 5:14










  • Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
    – Zzzach...
    Mar 31 '16 at 6:19











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f751702%2fhow-can-i-simulate-unplugging-and-plugging-in-my-usb-mouse-from-terminal-and-bas%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Try something like this:



sudo modprobe -r usbhid && sudo modprobe usbhid


You can put that in a script and link the script to a keyboard shortcut, or something along those lines (you'd have to do something about the sudo perms there if you wanted a shortcut).



If this doesn't work, try adding a sleep in there like this:



sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid





share|improve this answer





















  • Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
    – deanresin
    Mar 30 '16 at 3:02










  • Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
    – Zzzach...
    Mar 30 '16 at 3:36












  • [sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
    – deanresin
    Mar 30 '16 at 5:14










  • Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
    – Zzzach...
    Mar 31 '16 at 6:19















up vote
0
down vote













Try something like this:



sudo modprobe -r usbhid && sudo modprobe usbhid


You can put that in a script and link the script to a keyboard shortcut, or something along those lines (you'd have to do something about the sudo perms there if you wanted a shortcut).



If this doesn't work, try adding a sleep in there like this:



sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid





share|improve this answer





















  • Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
    – deanresin
    Mar 30 '16 at 3:02










  • Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
    – Zzzach...
    Mar 30 '16 at 3:36












  • [sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
    – deanresin
    Mar 30 '16 at 5:14










  • Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
    – Zzzach...
    Mar 31 '16 at 6:19













up vote
0
down vote










up vote
0
down vote









Try something like this:



sudo modprobe -r usbhid && sudo modprobe usbhid


You can put that in a script and link the script to a keyboard shortcut, or something along those lines (you'd have to do something about the sudo perms there if you wanted a shortcut).



If this doesn't work, try adding a sleep in there like this:



sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid





share|improve this answer












Try something like this:



sudo modprobe -r usbhid && sudo modprobe usbhid


You can put that in a script and link the script to a keyboard shortcut, or something along those lines (you'd have to do something about the sudo perms there if you wanted a shortcut).



If this doesn't work, try adding a sleep in there like this:



sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 30 '16 at 2:56









Zzzach...

2,2141528




2,2141528












  • Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
    – deanresin
    Mar 30 '16 at 3:02










  • Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
    – Zzzach...
    Mar 30 '16 at 3:36












  • [sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
    – deanresin
    Mar 30 '16 at 5:14










  • Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
    – Zzzach...
    Mar 31 '16 at 6:19


















  • Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
    – deanresin
    Mar 30 '16 at 3:02










  • Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
    – Zzzach...
    Mar 30 '16 at 3:36












  • [sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
    – deanresin
    Mar 30 '16 at 5:14










  • Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
    – Zzzach...
    Mar 31 '16 at 6:19
















Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
– deanresin
Mar 30 '16 at 3:02




Is there a script that runs with root privileges at startup so I can use these commands? I want to avoid any repetitive manual labour.
– deanresin
Mar 30 '16 at 3:02












Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
– Zzzach...
Mar 30 '16 at 3:36






Heh, yea, put these lines in /etc/rc.local BEFORE the exit 0 line. That is run every startup...I think (maybe every login). You might need a sleep before them too if you are running it at startup. Something like sleep 5 && sudo modprobe -r ... EDIT: Now that I think about this, I'll just give you one line to stick in there. Put this before the exit 0 line: ( sleep 2 && modprobe -r usbhid && sleep 2 && modprobe usbhid ) &
– Zzzach...
Mar 30 '16 at 3:36














[sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
– deanresin
Mar 30 '16 at 5:14




[sudo modprobe -r usbhid ... sudo modprobe usbhid] run in the terminal has no effect :( I still have to unplug and plug in the usb mouse. I think it has something to do with duplicate entries in xinput -list.
– deanresin
Mar 30 '16 at 5:14












Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
– Zzzach...
Mar 31 '16 at 6:19




Hmm, then this is a bust. Sorry, but I'm not sure what else to do.
– Zzzach...
Mar 31 '16 at 6:19


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f751702%2fhow-can-i-simulate-unplugging-and-plugging-in-my-usb-mouse-from-terminal-and-bas%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How did Captain America manage to do this?

迪纳利

南乌拉尔铁路局