usbprotocolsidentityhostperipherals

Is there a way to uniquely identify a specific usb port on a host device?


This question may be very broad but I'm trying to keep it platform agnostic.

If I connect a device to a USB port on a computer, is there a way for that device to uniquely identify the port it's connected to?

e.g. I have a PC with 10 USB ports. I have a smart phone that's programmed to run Function A if it's connected to Port 1 and Function B if it's connected to Port 2, etc...

Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?

Is there a way it can identify the host device as a whole?

Basically, does the peripheral know anything about the host?


Solution

  • Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?

    No, only the host knows which port a device is connected to. They all look the same from the phones point of view.

    Is there a way it can identify the host device as a whole? Basically, does the peripheral know anything about the host?

    Not with USB per se, but you could implement some identification in a higher protocol.

    Look at later implementations of the android debugging protocol for example: The host sends an ID to the device, and unless it matches in the device database the user will be asked: "Do you want PC (ID) to be able to debug this device?"