The reason I asked is that I sometimes get a message that my keyboard is "not recognized", and it asks me to type a particular key (so it can know the layout). The next message says it can not identify the keyboard.
Then the keyboard proceeds to work flawlessly.
--------
Clearly, you have a FAR more serious problem than my occasional messages.
Apple Keyboards have a reputation of becoming unreliable (maybe as extreme as not being seen by Hardware) when used on a USB extension cable. They also do not support any USB peripherals in the "convenience" USB jacks except an Apple low-power mouse. (I did manage to clobber my numeric keypad when trying to plug a nominally self-powered printer into the "convenience" USB port. I did not notice until my credit card number was entered incorrectly when placing an online order.)