Testing for buttons||hats||axes is equivalent to testing for joysticks!=0, since SConstruct forces joysticks=0 when buttons == 0 && hats == 0 && axes == 0. Remove tests of buttons||hats||axes when those occur inside a test for joysticks!=0.