I use scroll LED as keyboard layout indicator (off - English, on - Russian). It works great on the PS/2 keyboard at home. And it works in general on my work computer (USB keyboard). But sometimes I have this LED being out of sync. I assume it is related to sporadic USB device disconnection/connection (there are appropriate messages in dmesg). After that I can change layout, but LED state continue to be inversed.
The question is: how to sync led with current keyboard layout?
P.S. used xkb options:
xset -led, but I've no idea if this syncs with the internal keyboard state. Worth a try, though.