Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

command to refresh usb mouse..

  • 08-02-2011 10:53PM
    #1
    Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭


    Hi Guys,

    Just installed Ubuntu and loving it so far.

    I'm having a problem with my mouse though! It scrolls through documents/web pages really fast.. I need to unplug the mouse then plug it back in to get it to slow down.

    Just wondering is there a command/script that would refresh or disable/enable the usb devices in the computer. I could then put this in the "startup folder"..?

    Cheers!


Comments

  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    techguy wrote: »
    Hi Guys,

    Just installed Ubuntu and loving it so far.

    I'm having a problem with my mouse though! It scrolls through documents/web pages really fast.. I need to unplug the mouse then plug it back in to get it to slow down.

    Just wondering is there a command/script that would refresh or disable/enable the usb devices in the computer. I could then put this in the "startup folder"..?

    Cheers!

    You can use xinput to disable/enable the mouse on the fly.
    As root: "apt-get install xinput"
    Scan for your mouse: "xinput list | grep -i mouse"
    

    Now you will see a list of devices matching the "mouse" string.
    You can now disable the mouse with the matching string.

    For example, on my machine the list returns:
    ⎜   ↳ ImPS/2 Logitech Wheel Mouse             	id=9	[slave  pointer  (2)]
    ⎜   ↳ Macintosh mouse button emulation        	id=10	[slave  pointer  (2)]
    

    Now, you can disable the mouse by subsituting the 1st device string above with the following:
    ENABLE:
    xinput set-int-prop "ImPS/2 Logitech Wheel Mouse" "Device Enabled" 8 1
    
    DISABLE:
    xinput set-int-prop "ImPS/2 Logitech Wheel Mouse" "Device Enabled" 8 0
    

    Forget the desktop icon, add these two aliases to your .bashrc file:
    alias mouse_enable='xinput set-int-prop "ImPS/2 Logitech Wheel Mouse" "Device Enabled" 8 1'
    alias mouse_disable='xinput set-int-prop "ImPS/2 Logitech Wheel Mouse" "Device Enabled" 8 0'
    

    Now from your shell, just type mouse_enable or mouse_disable to enable/disable as required. You could use the following script to do the job, or even set the mouse on and
    off using cron/anacron entries. shopt is required for non interactive shell sessions, so you need that line to expand your newly defined aliases, otherwise it won't work.
    #!/bin/sh
    shopt -s expand_aliases
    source /home/<your_name_here>/.bashrc
    mouse_disable
    mouse_enable
    


  • Registered Users, Registered Users 2 Posts: 2,238 ✭✭✭techguy


    Thanks so much, Naikon!

    The problem seems to have sorted itself out now. No need to unplug mouse anymore!

    Cheers! :)


  • Closed Accounts Posts: 4,564 ✭✭✭Naikon


    techguy wrote: »
    Thanks so much, Naikon!

    The problem seems to have sorted itself out now. No need to unplug mouse anymore!

    Cheers! :)

    Glad to be of some service :D

    Welcome to the land of Unix/Linux btw. I think you will be around for a long time. It's nice to actually see somebody treating the OS on it's own merits and not expecting an open source version of Windows. Ubuntu will serve you well.


Advertisement