Chip88
November 7th, 2016, 01:11 PM
Hi there,
after upgarding last weekend from 14.04 LTS to 16.04, I'm trying now to get the numlock turning on automatically when I plug in an external keyboard.
Of course, I found many instructions how to do this.
I did exactly the following:
lsusb to find out idVendor and idProduct:
Bus 001 Device 007: ID 04fc:05d8 Sunplus Technology Co., Ltd Wireless keyboard/mouse
Then I installed numlockx and created a file 25-usbkeyboard.rules in /etc/udev/rules.d/:
ACTION=="add", SUBSYSTEM=="input", ATTRS{idProduct}=="05d8", ATTRS{idVendor}=="04fc", RUN+="/usr/local/bin/numlock on", ENV{REMOVE_CMD}="/usr/local/bin/numlock off"
ENV{ID_VENDOR_ID}=="04fc", ENV{ID_MODEL_ID}=="05d8", ACTION=="remove", RUN+="/usr/local/bin/numlock off'"
I also created another file numlock in /usr/local/bin/:
#!/bin/shexport XAUTHORITY=/home/mark/.Xauthority #falls Session-Daten benötigt werden
case "$1" in
on)
export DISPLAY=':0.0'; /usr/bin/numlockx on
;;
off)
export DISPLAY=':0.0'; /usr/bin/numlockx off
;;
esac
exit 0
Restarted the notebook and got the login screen: Numlock is turned off (LED is off).
Put in the password, logged in and numlock turned on automatically (LED is also on).
→ But: When I unplug the USB receiver, nothing happens (LED keeps on).
Now, when I am plugging in the USB receiver, the LED turns off for a second and then automatically turns on again.
So it seems to me that the ACTION=="add" works fine.
But why is the the ACTION=="remove" not working correctly?
Thank you in advance about any advices & hints!
Regards,
Chipy
after upgarding last weekend from 14.04 LTS to 16.04, I'm trying now to get the numlock turning on automatically when I plug in an external keyboard.
Of course, I found many instructions how to do this.
I did exactly the following:
lsusb to find out idVendor and idProduct:
Bus 001 Device 007: ID 04fc:05d8 Sunplus Technology Co., Ltd Wireless keyboard/mouse
Then I installed numlockx and created a file 25-usbkeyboard.rules in /etc/udev/rules.d/:
ACTION=="add", SUBSYSTEM=="input", ATTRS{idProduct}=="05d8", ATTRS{idVendor}=="04fc", RUN+="/usr/local/bin/numlock on", ENV{REMOVE_CMD}="/usr/local/bin/numlock off"
ENV{ID_VENDOR_ID}=="04fc", ENV{ID_MODEL_ID}=="05d8", ACTION=="remove", RUN+="/usr/local/bin/numlock off'"
I also created another file numlock in /usr/local/bin/:
#!/bin/shexport XAUTHORITY=/home/mark/.Xauthority #falls Session-Daten benötigt werden
case "$1" in
on)
export DISPLAY=':0.0'; /usr/bin/numlockx on
;;
off)
export DISPLAY=':0.0'; /usr/bin/numlockx off
;;
esac
exit 0
Restarted the notebook and got the login screen: Numlock is turned off (LED is off).
Put in the password, logged in and numlock turned on automatically (LED is also on).
→ But: When I unplug the USB receiver, nothing happens (LED keeps on).
Now, when I am plugging in the USB receiver, the LED turns off for a second and then automatically turns on again.
So it seems to me that the ACTION=="add" works fine.
But why is the the ACTION=="remove" not working correctly?
Thank you in advance about any advices & hints!
Regards,
Chipy