You should see your joystick number first... so open a terminal and run
xinput list and look to your joystick number and replace its number (instead of the 10) in the example below.
id=xinput list | grep "↳ DragonRise Inc. Generic USB Joystick id=10" | cut -c58-59
props_mouse=xinput list-props 10 | grep "Generate Mouse Events (" | cut -c25-27
props_teclado=xinput list-props 10 | grep "Generate Key Events (" | cut -c23-25
xinput set-prop 10 $props_mouse 0
xinput set-prop 10 $props_teclado 0
Save the above into a file like
~/disable_joystick.sh and then run
chmod +x ~/disable_joystick.sh.
You can now run
~/disable_joystick.sh and it should block your device from generating mouse and keyboard events in X.