How do smartphones know if they need to "feed" a mouse via OTG cable?

Thread Starter

rambomhtri

Joined Nov 9, 2015
557
Hello, I've recently bought an OTG cable for my smartphone and also an external battery. Once I plugged the OTG cable into my smartphone, questions started to come to my mind:


1. How does the smartphone know, when you plug a mouse through the OTG cable, if it needs to "feed" current or draw current?
In other words, why if you connect a mouse, the smartphone gives current to the mouse, but if you connect a regular charger cable it receives current? Both in the same port micro USB of the smartphone.

2. How can a smartphone charge another smartphone via OTG, how do you know which one will be charged and which one will donate battery?
It's like connecting 4 wires to each pin: ground with ground, data+ with data+, data- with data- and 5V with 5V.

3. The external battery has 2 kind of ports: input and output. If you connect the input port of the battery to the OTG cable, and this cable to the smartphone, how does it know that it needs to give current through the micro USB port? (kind of the same question as number 1)
 

Thread Starter

rambomhtri

Joined Nov 9, 2015
557
The OTG cable connectors have 5 pins rather than the usual 4.
What's that supposed to mean?

But, nevermind, I'm quite positive that's false, micro USB and USB interfaces only have 4 pins, so my OTG cable in both sides and my smartphone.

Edit: wrong, I misscounted, there are 5 pins.
 
Last edited:

mcgyvr

Joined Oct 15, 2009
5,394
My bad, I don't even know how to count, oh my God...

My apologies for considering you were wrong, Alec, but you know, I read your message and then counted the pins and I don't know how, I counted 4, and there are actually 5.

So, since the USB has 4 pins, two of them must be shorted. Which ones and how does it exactly work?
So you can't count OR read? :p
All you need to know is in the link I provided about how OTG protocol works..

Do you really want us to just copy/paste that here for you?
 

Thread Starter

rambomhtri

Joined Nov 9, 2015
557
So you can't count OR read? :p
All you need to know is in the link I provided about how OTG protocol works..

Do you really want us to just copy/paste that here for you?
Lol, I thought you linked Wikipedia to show me there were 5 pins. I'll read that later.
 

Motanache

Joined Mar 2, 2015
540
Although the question was answered.
The micro USB connector has 5 pins- +5V, GND, D+, D- and ID(Sense)

The OTG cable and data cable have 4 wires +5V, GND, D+, D-.

On the OTG cable micro USB connector has internally connected the Sense pin to GND.
That tells the tablet or phone that it has to supply power to the connected device.

On the data cable, the micro USB connector has Sense pin not connected.
That tells the tablet or phone that it will be powered from the outside.

Not any tablet or phone is capable of OTG.
 
Top