How to disable a kext for external optical mouse by terminal without causing kernel panic?

Hello everyone,

I would like to know if there's a way to disconnect external mouse support on the MacOs High Sierra 10.13 for some testing purposes.

The test needs to do 10 sleep cycles, leave the computer awake for 30s and sleep it by 60s.

When the mouse is connected to the mac, by some reason it wakes up before finishing the 60s on sleep mode. The wake reason prompted is EHC2. That's referring to the Enhanced Host Controller 2 I think, and presumably it's referring to an external keyboard or mouse.

The question is, how to achieve that the external mouse stays disable during the test and wakes up after that?

I've tried a command to disable the trackpad .kext, it worked but after loading it again it crashes and causes kernel panic.

I know there's the IPS that even if you remove the .kext it'll just get it back to where it was.

I wouldn't like to disable the IPS 'cause it will be too much trouble. So the best option I would like to achieve it's to disable the .kext temporarily and re-enable it after finishing the test, anything that blocks the communication with the port or ports where the mouse is hosted will do.

Is there a way to do that programatically with the terminal or with a programming language (python, c)?

Thanks in advance!