# How to set up Ubuntu to instantly transform NumLock on when an exterior key-board is affixed and also off when it is not?

Having NumLock on is hassle-free when making use of a complete - sized exterior key-board (having a keypad) and also really bothersome when making use of laptop computer is constructed - in key-board (which positions figures as opposed to letters on the key-board is appropriate sid unless Fn is pushed).

So I need to transform NumLock on every single time I attach an exterior key-board (or boot with it affixed) and also off every single time I detach an exterior key-board (or boot with it separated). And also I do this regularly due to the fact that I favor making use of a complete - sized exterior key-board, yet have not nearly enough (just 3) USB ports to connect - in it alongside with a computer mouse, a 3G modem and also an exterior hard/flash drive.

Can I automate this? Appears a really formaliseable, practically straightforward job : if there is an USB key-board affixed (some tool in/ dev existing?) - NumLock gets on, otherwise - NumLock is off. My laptop computer is constructed - in key-board is PS/2 - affixed, exterior is USB.

Possibly I should code it myself, yet where to place it in this instance?

I make use of Ubuntu 10.10.

0
2019-05-13 04:50:55
Source Share

I'm not exactly sure what I'm doing in different ways, due to the fact that my numlock on this key-board is failing to on (This is a Mac Pro Aluminum key-board). There are some instructions here that needs to suffice.

Hope this aids!

0
2019-05-18 08:09:58
Source

First off, install numlockx (click here to install numlockx). Primarily this permits you to write manuscripts to set the state of Num Lock - see the numlockx man page for information.

Next we require to start diving right into the enjoyable of udev regulations. First we require to figure out just how the key-board is recognized. You can do this by

ls /dev/input/by-id/


This needs to offer you some human legible documents names (that are soft links to the not specifically legible real name). My key-board was

/dev/input/by-id/usb-KINESIS_FREESTYLE_KB700_KB700_Kinesis_Freestyle-event-kbd


So after that we require to figure out all the details concerning the key-board. I did

udevadm info -a -p \$(udevadm info -q path -n /dev/input/by-id/usb-KINESIS_FREESTYLE_KB700_KB700_Kinesis_Freestyle-event-kbd)


But insert your very own path there certainly. You'll get a great deal of details, yet you intend to consider the first block that names the key-board and also has SUBSYSTEMS=="usb". (Rather than the USB controller or whatever). In my instance that was:

  looking at parent device '/devices/pci0000:00/0000:00:1a.0/usb3/3-2/3-2.3':
KERNELS=="3-2.3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{configuration}==""
ATTRS{bNumInterfaces}==" 2"
ATTRS{bConfigurationValue}=="1"
ATTRS{bmAttributes}=="a0"
ATTRS{bMaxPower}==" 50mA"
ATTRS{urbnum}=="6284"
ATTRS{idVendor}=="058f"
ATTRS{idProduct}=="9410"
ATTRS{bcdDevice}=="0122"
ATTRS{bDeviceClass}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bNumConfigurations}=="1"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{speed}=="1.5"
ATTRS{busnum}=="3"
ATTRS{devnum}=="3"
ATTRS{devpath}=="2.3"
ATTRS{version}==" 1.10"
ATTRS{maxchild}=="0"
ATTRS{quirks}=="0x0"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{authorized}=="1"
ATTRS{manufacturer}=="KINESIS FREESTYLE KB700"
ATTRS{product}=="KB700 Kinesis Freestyle"


So currently we have adequate details to write some regulations. Utilize your favorite editor to create /etc/udev/rules.d/10-local.rules and also place in:

BUS=="usb",ATTRS{product}=="KB700 Kinesis Freestyle",ACTION=="add",RUN+="/usr/bin/numlockx on"
BUS=="usb",ATTRS{product}=="KB700 Kinesis Freestyle",ACTION=="remove",RUN+="/usr/bin/numlockx off"


Again, placed the name of your key-board in below, and also the ATTRS if it is various. After that it needs to function:)

Note I have not had the ability to examine this, though I have actually run all the commands up till developing the regulations submit. And also the resources in instance you require to do some even more examination are:

0
2019-05-18 07:00:50
Source