Como posso simular a desconexão e a conexão do meu mouse USB do script terminal e bash?

1

Quando eu inicio no Ubuntu, meu mouse USB sem fio fica preso por momentos freqüentes e a roda do mouse é muito sensível. Somente quando eu desconectar o usb sem fio e ligá-lo novamente, o mouse retorna ao normal.

Eu gostaria de simular a desconexão e o plug-in do meu mouse USB no meu script bash de inicialização para que eu não precise fazer isso manualmente toda vez. Existe um comando de terminal para isso?

Muito obrigado.

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

Editar: parece que, acima de tudo, o Ubuntu está executando dois drivers para o mesmo mouse sob o id 10 e 11.

    
por deanresin 30.03.2016 / 04:19

1 resposta

0

Tente algo assim:

sudo modprobe -r usbhid && sudo modprobe usbhid

Você pode colocar isso em um script e vincular o script a um atalho de teclado, ou algo assim (você teria que fazer algo sobre o sudo perms lá se quisesse um atalho).

Se isso não funcionar, tente adicionar um sono lá assim:

sudo modprobe -r usbhid && sleep 2 && sudo modprobe usbhid
    
por Zzzach... 30.03.2016 / 04:56