LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 10-18-2004, 05:06 PM   #1
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Rep: Reputation: 30
Disable keyboard


Is there any way to disable the keyboard from the command line?

I'm looking for something that would have the same effect as physically unplugging the keyboard, without actually doing it.


(The reason I'm trying to do this is to have my computer's monitors go to sleep at night, and not be able to be woken up by hitting keyboard keys. I already disabled the mouse waking them b/c I want the monitors off until a script turns them on in the morning.)

Thanks.

Last edited by kundor; 10-18-2004 at 05:07 PM.
 
Old 10-18-2004, 05:40 PM   #2
avarus
Member
 
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
Hi,

Try this (as root):

nohup cat /dev/tty0

TIM
 
Old 10-18-2004, 06:05 PM   #3
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
If the main issue is that you want to control what hours of the day the monitors are powered on, a very low tech but incredibly effective way of doing this is to just buy some timers and plug the monitors into them. It's not fancy but it will definitely do the job. -- J.W.
 
Old 10-18-2004, 06:53 PM   #4
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
avarus,
the "nohup cat /dev/tty0" was very effective at disabling all keyboard input, so that worked, but unfortunately hitting a keyboard key still woke up the monitors even though it had no effect otherwise.

J.W, that would work, I suppose, but is beneath my geekly dignity ;-)
--aka I'm too lazy and broke to go buy things.

Are there any other possiblities?
 
Old 10-18-2004, 08:39 PM   #5
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 87
Just out of curiosity, why is it so important that the monitor remain dark during certain hours? Assuming that you've got your monitor set to operate in power saving mode, then even if someone did press a key, the monitor would only be on for X minutes until it goes dark again, and as long as you've got a password-protected screensaver, the only thing on the display would be the logon box and the screensaver pattern.

Is this question being asked because you are attempting to make the system more secure? If so, there are much more effective ways to do it. I guess I'm just puzzled as to what factors cause this issue to be important. -- J.W.
 
Old 10-18-2004, 09:08 PM   #6
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
If truth be told, I have a bit of an internet-addiction problem. If I'm not careful I'll be up surfing til 4 or 5 am, which is obviously not good when I have 9 am classes (I'm a student.)

I decided to set myself a bedtime, and to use cron to enforce it to some extent -- more than just a reminder or popup which I would ignore. I found how to use dpms to turn off the monitors, but that's not much of a deterrent when a simple wave of the mouse would turn them back on.

Now that I have sound muted and the mouse and keyboard disabled until morning (cron wakes everything up again,) it's really enough of a solution, I guess. I'm still trying for the completeness of the thing, and because I'm curious, because it must be achievable.

(I went far enough to set /etc/nologin, so that I couldn't just hit the reset switch to get around this -- not that I'd actually do that, but again to have a thorough implementation. )

the gotosleep script:
Code:
#!/bin/sh
mute
xmms-shell -e stop

gaim-remote away
/usr/kde/3.3/bin/dcop kopete default setAway

sudo /etc/init.d/gpm stop
sudo nohup cat /dev/tty0 > /dev/null&
/usr/X11R6/bin/xset dpms force off

sudo sh -c 'echo "Wait until morning, bucko" > /etc/nologin'
#ensure that boinc and valknut run through the night
if [ "`ps x | awk '/boinc/ {print$5}' | grep -v awk`" = "" ]; then /home/kundor/bin/boinker; fi
if [ "`ps x | awk '/valknut/ {print$5}' | grep -v awk`" = "" ]; then /home/kundor/bin/valker; fi
and wakeup:
Code:
#!/bin/sh
sudo /usr/sbin/alsactl restore
xmms-shell -e "jump 2490; play"

gaim-remote back
/usr/kde/3.3/bin/dcop kopete default setAvailable

sudo rm /etc/nologin
/usr/X11R6/bin/xset dpms force on
sudo killall cat
sudo /etc/init.d/gpm start

Last edited by kundor; 10-19-2004 at 05:57 PM.
 
Old 10-19-2004, 05:43 PM   #7
avarus
Member
 
Registered: Apr 2004
Location: Oxford, UK
Distribution: Ubuntu, Debian, various
Posts: 230
Blog Entries: 5

Rep: Reputation: 33
Rats - I thought I had it nailed with the cat /dev/tty0 suggestion. Interesting problem though.

I don't suppose you have a USB keyboard, in which case you can do:

modprobe -r usbhid
<sleeps>
modprobe usbhid

Might consider using your script myself - I should have turned in half an hour ago.
 
Old 10-19-2004, 06:05 PM   #8
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
If you do want to do something like this, it's worth noting that the mouse disabling works by using gpm repeating for X.

The xorg.conf just has
Code:
Section "InputDevice"
    Identifier "Mouse1"
    Driver "mouse"
    Option "Protocol" "IMPS/2"
    Option "Device" "/dev/gpmdata"
    Option "ZAxisMapping" "4 5"
EndSection
while the gpm start line is gpm -m /dev/input/mice -t imps2 -Rraw


And of course: Be CAREFUL when you're messing with stuff that disables mouse, keyboard, and login, or your computer could end up very unusable ;-)
 
  


Reply



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
keyboard disable Ipolit Linux - Hardware 4 02-14-2005 03:52 PM
spilled tea on my keyboard and need to disable it... kenkajoto Linux - Hardware 10 12-04-2004 12:35 PM
how do i disable keyboard input? thebover Linux - Newbie 5 08-24-2004 10:13 AM
USB Keyboard disable before installing Redhat 7.3 simprince Linux - Hardware 2 03-19-2004 08:03 PM
Keyboard disable, can't even log in Bustaroms Linux - Newbie 2 06-01-2003 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration