dynamic Keyboard activation - desactivation

Peter Hutterer peter.hutterer at who-t.net
Thu Oct 28 14:33:25 PDT 2010


On Thu, Oct 28, 2010 at 02:03:49PM +0200, 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.org] De la part de Magnus Kessler
> Envoyé : jeudi 28 octobre 2010 12:59
> À : xorg at lists.freedesktop.org
> Objet : Re: dynamic Keyboard activation - desactivation
> 
> 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
> 
> __________________________________________________________________________
> 
> Many mousse, many names ...

names don't change, IDs do though...

> __________________________________________________________________________
> 
> > 
> > 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.
> 
> __________________________________________________________________________
> 
> I've got the 1.7.6 Xorg server (ubuntu 10.04).

I think Ubuntu backported the xorg.conf.d changes to server 1.7, so you
should be fine. someone correct me if I'm wrong here.

> __________________________________________________________________________
> 
> 
> 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
> ###
> __________________________________________________________________________
> 
> Can I use blacklisting dynamically? => keyboard activated or not.

no, you can match on the device name, the device path, and a few other
properties but not on "keyboard activated" (not sure what that means, tbh)

> __________________________________________________________________________
> 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.
> 
> __________________________________________________________________________
> 
> I know I can enable - disable keyboard and mouse with xorg.conf file.
> But
> + I have to restart
> + I have to set xorg.conf location not under live CD.
> 
> The udev rules can be activated dynamically ... what I want to do.

you can do that stuff with udev rules as well, but you will have to remove
xorg.conf.d snippets that would otherwise apply.
check for "x11_driver" configurations in your udev rules and dynamically set
these depending on the devices you need. that's pretty much where my
knowledge of udev configuration magic stops though.

Cheers,
  Peter



More information about the xorg mailing list