I tried all of yours methodes but any of them didn't work for me so i made my tests with xinput
for R.A.T.3 and realised that the buttons 10 11 12 don't work so I adapted yours method and it didn't work again so I realised that if I run "xinput set-button-map 9 1 2 3 4 5 6 7 8 9 0 0 0 13 14 0 0 0 0" it works just you must run it before pressing any key and before event motion of your mouse and it works for automatise the whole thing you can make a script or other way to run the command
before you run kde
I tried all of yours methodes but any of them didn't work for me so i made my tests with xinput
for R.A.T.3 and realised that the buttons 10 11 12 don't work so I adapted yours method and it didn't work again so I realised that if I run "xinput set-button-map 9 1 2 3 4 5 6 7 8 9 0 0 0 13 14 0 0 0 0" it works just you must run it before pressing any key and before event motion of your mouse and it works for automatise the whole thing you can make a script or other way to run the command
before you run kde
kubuntu 11.04