dynamic Keyboard activation - desactivation

Magnus Kessler Magnus.Kessler at gmx.net
Thu Oct 28 03:59:19 PDT 2010


On Thursday 28 October 2010 09:32:29 MONDON Daniel wrote:
> -----Message d'origine-----
> De : xorg-bounces+daniel.mondon=lpgtechnologies.com at lists.freedesktop.org
> [mailto:xorg-bounces+daniel.mondon=lpgtechnologies.com at lists.freedesktop.o
> rg] De la part de Magnus Kessler Envoyé : mercredi 27 octobre 2010 18:19
> À : xorg at lists.freedesktop.org
> Objet : Re: dynamic Keyboard activation - desactivation
> 
> On Wednesday 27 October 2010 15:31:36 MONDON Daniel wrote:
> > Hi all !
> > 
> > 
> > 
> > I'am under ubuntu 10.04 live CD.
> > 
> > 
> > 
> > My application doesn't need any keyboard, and I don't want to have one
> > because users are not allowed to modify anything.
> > 
> > 
> > 
> > I know I can do that with xorg.conf file, but
> > 
> > + I don't want to have to restart
> > 
> > + I an under live CD (I have to move the xorg.conf location ... and
> > reboot).
> > 
> > 
> > 
> > I think I can do that with udev rules, but I don't find anyone who can
> > help me to do that, or any applicable rule sample. :-(
> > 
> > 
> > 
> > Or a simple X command ?
> > 
> > 
> > 
> > Thanks
> > 
> > 
> > 
> > Daniel.
> 
> I think Peter Hutterer provided an answer to your question recently on this
> list: See
> http://lists.freedesktop.org/archives/xorg/2010-October/051507.html
> 
> In short, if your version of xinput, the device driver and the xorg server
> is new enough you should be able to do:
> 
> xinput set-prop <device name> "Device Enabled" 0
> 
> HTH,
> 
> Magnus
> 
> __________________________________________________________________________
> 
> With the <xinput --set-prop 10 127 0> command, I succed to deactivate
> mouse.

When using xinput, you might be on the safer side if you use the property 
names, rather than their numeric equivalents. The same goes for the device 
IDs.

So your example should read (I'm inventing the mouse name here):

xinput --set-prop "My Mouse" "Device Enabled" 0

> 
> But this mouse is plugged and identified.
> Will it be se same thing with a constructor other mouse?
> 
> It is the same thing with keyboard.
> But with the <xinput --set-prop 11 127 0> command, I have carriage return
> key pressed every time.
> 
> Then, I don't think this solution is ok for me!
> Because I think I can't know the new device id for plugged keyboards or
> mouse.
> 
> With what I know, I think it is better to set an udev rule.
> Am I right?
> 
> Thanks,
> Daniel.

Again assuming you have a new enough Xorg server (1.8+) you might want to look 
into using the configuration snippets in /usr/share/X11/xorg.conf.d.

Peter Hutterer gave an example of blacklisting earlier on this list: 
http://lists.freedesktop.org/archives/xorg/2010-October/051405.html

In the example he gave a device is blacklisted by name, but in fact you can 
blacklist an entire range of devices by functionality also:

### /usr/share/X11/xorg.conf.d/01-blacklist-keyboards.conf ###
Section "InputClass"
    Identifier "blacklist all keyboards"
    MatchIsKeyboard "on"
    Option "Ignore" "on"
EndSection
###

For an overview of today's xorg configuration capabilities please have a look 
at Peter's blog posts: http://who-t.blogspot.com/search/label/xorg.conf, 
especially http://who-t.blogspot.com/2010/01/new-configuration-world-
order.html or the documentation for Fedora at 
https://fedoraproject.org/wiki/Input_device_configuration. And finally, "man 
xorg.conf" has some useful information in the InputClass section as well.

Cheers,

Magnus



More information about the xorg mailing list