Determine USB Host
Posted: Wed Apr 02, 2025 7:32 pm
In the device we're developing, we have two basic operational modes. One being a USB HID Host and the other being as a MSC Device. I have hardware that tells me if the source of power (am I receiving power as a UFP or am I providing power as a DFP.
What I can't tell in the UFP case is if I'm connected to a host computer or a charger. I've tried looking at the D+D- lines to see if I can detect the host pulling them high, but it doesn't work, I suspect, at boot, someone already has control of those IO lines.
Does anyone know a reliable way to tell?
Since it's two different stacks (MSC is tiny USB), there's probably no way to switch on the fly, and a reboot is required (that's ok if detection works).
Thanks
What I can't tell in the UFP case is if I'm connected to a host computer or a charger. I've tried looking at the D+D- lines to see if I can detect the host pulling them high, but it doesn't work, I suspect, at boot, someone already has control of those IO lines.
Does anyone know a reliable way to tell?
Since it's two different stacks (MSC is tiny USB), there's probably no way to switch on the fly, and a reboot is required (that's ok if detection works).
Thanks