First off, install numlockx (click here to install numlockx). Basically this allows you to write scripts to set the state of Num Lock - see the numlockx man page for details.
Next we need to start delving into the fun of udev rules. First we need to find out how the keyboard is identified. You can do this by
ls /dev/input/by-id/
This should give you some human readable file names (that are soft links to the not particularly readable true name). My keyboard was
/dev/input/by-id/usb-KINESIS_FREESTYLE_KB700_KB700_Kinesis_Freestyle-event-kbd
So then we need to find out all the info about the keyboard. 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 own path there of course. You'll get a lot of info, but you want to look at the first block that names the keyboard and has SUBSYSTEMS=="usb". (Rather than the USB controller or whatever). In my case 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 now we have enough information to write some rules. Use your favourite editor to create /etc/udev/rules.d/10-local.rules and put 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, put the name of your keyboard in here, and the ATTRS if it is different. Then it should work :)
Note I haven't been able to test this, though I have run all the commands up until creating the rules file. And the sources in case you need to do some more investigation are: