For Windows, there's very useful software: EitherMouse by Steffen Software:
GitHub project page:Leave multiple mice on a pc and automatically swap buttons on each mouse.
Have a left-handed and a right-handed mouse always connected and ready to use.
Match speeds across different mice, ie touchpad and mouse with different speeds.
AHK forum tread: