Input: Add proper locking when changing device's keymap