Electronic – Which TWO wires to disconnect to disable USB mouse

usbusb device

As there is more choice in DPDT switches than there is for 4PDT switches I am wondering which TWO connections are the best to disconnect to disable a USB mouse?

I need an easy to use switch that allows the mouse to be 'disconnected' without pulling the USB connector out of a laptop so I want to use a DPDT rocker or paddle switch.

From what I have found so far the pin-out is:

  1. VCC (+5V)
  2. Data -ve
  3. Data +ve
  4. GND

If my switch only allows two of these to be disconnected is it better/safer to disconnect both data lines, both power lines or one of each?

(Note: I've attempted to do the disabling programmatically in Windows but unfortunately Windows APIs identify the multiple input devices on the machine all as 'Generic HID' (Human Input Device) so it's not easy to determine the correct one to disable.)

(Note 2 – added in response to some comments and answers: The reason for this question is that I need to supply a solution to a user in a user-friendly manner. To this end registry hacks, Device Manager etc are not user-friendly enough. A simple toggle switch is easy to understand and, so long as it doesn't fry the MoBo or the USB hub, then is safer than sending a user into system settings.)

Best Answer

My first reflex was to say that you should disconnect D+ and D- lines. Leaving VCC and GND connected is obviously safe for both the mouse and the host: VCC and GND leads in USB connectors are even made longer to insure this safe state is reached before D+ and D- are connected.

However, disconnecting VCC alone may be enough, and even if not, it should at least be safe. Take a look at this figure from USB specification:

enter image description here

The host will only communicate with the device when it sees D- line pulled up. However, once VCC is disconnected, Rpu is effectively eliminated from the circuit, leaving both D+ and D- at ground potential. As a result, no further communication will take place.

Once you reconnect the VCC line, the host will again see D- line pulled high, and will react as if a new USB device was just plugged in. In the best case, your mouse will just work. In the unlikely worst case scenario, the mouse won't have enough time to initialize (since normally VCC is connected before D- and the device has more time to start) and will fail to reply to the host within the allotted time. In that case, you'll have to keep VCC and GND connected and put a DPST switch on D+ and D-.