Again, you are making it 50,000,000,000 times harder on yourself than you ever should. LOOK AT OTHER TEMPLATES OF THE SAME TYPE...
Just make sure the basics are implemented at least.. number keys, channel up, channel down, as many commands as you can find equivalents for, test them, make sure they are okay,
AND LET LINUXMCE DO THE REST.
The system is smart. So long as it knows how to control your devices, and how they're hooked up (setup wiz, Web admin, whatever), it will do the right thing.