Android – Detection of plugged in USB device

androidlinuxlinux-device-driverlinux-kernelusb

I'd like to know, which part of the system is responsible for detection of plugged-in device in the USB port

It may be a USB host port, so that a plugged-in device will be considered a USB client (so port owner is host),
or it may be a USB client port, so that a plugged-in device will be considered a USB host (so port owner is client)

What I am interested in is a moment WHEN the system actually detects (by change of resistance maybe) that something has been plugged in, and based on from which port the signal is coming (host port or client port), either host port driver or client port driver is deployed
I want to know, HOW system picks up this or that driver, based on that "plugged-in" event

Where should I look for that ? In USB core maybe ?

Best Answer

I understand what you are asking, and rightly when a usb device is connected then the current fluctuation (across resistors) leads to notification. Then the host (there can be negotiation that who will be host in OTG mode but that also happens after enumeration process).

Enumeration is main process which is most important. USB follows star tier topology and whole system is based on same.

NOTE: It is very important to note that all the transactions of packets are initiated by host. The client is at mercy of host. This is very important in understanding the usb system.

Pls refer: http://www.beyondlogic.org/usbnutshell/usb1.shtml