LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 11-20-2008, 05:15 AM   #1
gus_1985
LQ Newbie
 
Registered: Nov 2008
Distribution: Debian
Posts: 4

Rep: Reputation: 0
Question Which command to use to (temporarily) turn off the mouse?


Hi folks,

I've already googled for a solution to my problem, but to no avail.

Is there any command that allows me to deactivate the mouse completely until I decide to turn it on again?

My goal is to use xset dpms force off to shut off my display. However, even the slightest movement of the mouse causes it to turn on again. I'd like the system to do so only after a key is pressed.

Thanks in advance for any replies,

Gus
 
Old 11-20-2008, 10:27 PM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
My X setup uses /dev/input/mice - which means my USB trackball (preferred) or that horrible evil invention from the darkest depths of hell known as the 'touchpad'. Sometimes I can't plug in my trackball so I'll use the touchpad; however, most of the time when I boot that horrible touchpad screws me over because I bump it so often while typing.

So - the tricks are:
1. switch to a text virtual console (like vc1)
2. unload the mouse driver (for my cursed touchpad: rmmod psmouse)
3. do whatever you want to X

Now before starting X, just remember to activate the mouse driver again; do this from the text console just in case X gets a bit confused (although it shouldn't if you use 'mice' as I do).
 
Old 11-21-2008, 01:45 PM   #3
gus_1985
LQ Newbie
 
Registered: Nov 2008
Distribution: Debian
Posts: 4

Original Poster
Rep: Reputation: 0
Hi pinniped,

thanks very much for your fast reply. It completely deactives my notebook's touchpad.

But how do I proceed if I want to do the same with an USB mouse? After all, I cant' just unload the whole usbhid module, can I?

lsusb (debian) delivers:
Quote:
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 04f9:01aa Brother Industries, Ltd DCP-540CN (printer)
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0d3d:0001 Tangtop Technology Co., Ltd HID Keyboard (keyboard)
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 1a7c:0068 <- This is the mouse.
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Any idea on how to accomplish that, i.e. how to turn off an usb mouse?

I already tried the approach mentioned in the link above:
http://www.linuxquestions.org/questi...ff-usb-509328/.
However, in the directory
Quote:
/sys/bus/usb/devices/2-1/power
there is no subfolder
Quote:
/state
. Hence, I can't use
Quote:
echo -n 0/2 > ./state
for on/off
 
Old 11-21-2008, 03:20 PM   #4
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
For the USB mouse, I set up 'udev' to always call it 'mouse0' (and the touchpad is always mouse1). I just pull out the USB mouse and plug it back in. You *have* to be in a virtual console when you plug the mouse back in, otherwise X has the mouse device open and udev can't name the mouse 'mouse0'; also, you don't want a million mouse devices which don't really exist because the USB mouse was plugged and unplugged multiple times - that would be a mouse infestation.

I don't have my laptop with me today so I can't look up the rule I used (and where I put it), but you start off with the /sys filesystem:

cd /sys/class/input
udevinfo -a -p $PWD/mouse0

Somewhere in there I get:
ATTRS{name}=="PS2++ Logitech TrackMan"

SO I can make a udev rule:
KERNEL=="mouse?", ATTRS{name}=="PS2++ Logitech TrackMan", NAME="mouse0"
 
Old 11-21-2008, 03:47 PM   #5
gus_1985
LQ Newbie
 
Registered: Nov 2008
Distribution: Debian
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pinniped View Post
I just pull out the USB mouse and plug it back in.
Unfortunately, that is exactly the thing I wanted to avoid .
The grand goal was to write a shell script that first turns the mouse off via command and then does the same with the display.

Besides, plugging the mouse in and out already works fine somehow.
 
Old 11-21-2008, 04:51 PM   #6
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
I can't think of how to disable the mouse without disabling keyboards as well. Unfortunately it looks like time to look at the driver code. It might be possible to write to a sysfs parameter to shut down the mouse. Otherwise the only other option I can think of is to have an enable/disable parameter in sysfs - that may be useful if other people have the same problem and find it too annoying.
 
Old 11-23-2008, 03:12 AM   #7
gus_1985
LQ Newbie
 
Registered: Nov 2008
Distribution: Debian
Posts: 4

Original Poster
Rep: Reputation: 0
Oh. I think that right now this is way over my head. I guess I'll just have to stick with plugging the mouse in and out.

Thanks for your efforts though, pinniped.
 
  


Reply

Tags
hid, mouse, shell, usb, xorg, xset


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
turn off keyboard and mouse on boot rjb982 Linux - Software 1 07-25-2006 09:20 AM
Mouse doesn't turn on upon booting halfpower Debian 1 01-23-2006 07:30 AM
Turning off printer causes mouse to lockup temporarily BajaNick Linux - General 2 07-10-2005 02:33 PM
How to turn off Xserver in the gui and turn it off in the command line geminiviper Linux - Newbie 8 08-20-2004 08:05 AM
turn off mouse focusing? mathfeel Linux - General 3 08-16-2002 07:22 AM


All times are GMT -5. The time now is 12:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration