I'd suggest a simpler solution: check if the movement sensor of the mouse can detect when the mouse is lifted up (Don't know it that's doable, but I believe it is), if not, add a little sensor to the bottom of the mouse, that checks if the mouse sits on ground. Now, when the mouse is lifted up by, say 15cm, you put the mouse in a 'unset' state, the first button that is pressed, after the mouse lands on a surface, defines button orientation.
Example: Mouse sits on right of keyboard: Lift mouse, and put it back at left side of keyboard.
Press right mouse button: Mouse is now a left-hand mouse (right button = Button 1).
If the laser - that most mice nowadays have - or the LED led is capable of detecting the distance from the surface (or movement away from those), you could implement the solution completely in software on the driver side. This might even work with standard mice.
To minimize accidental button switching and allow "swiping" the mouse several times over the same surface, you's simply activate the 'unset' state after the mouse has been in the air at an altitude of ~15cm and for more than 2sec.