LKML Archive on
help / color / mirror / Atom feed
From: Felipe Balbi <>
To: ext David Brownell <>
Subject: Re: [PATCH] USB: OTG: Fix weirdnesses on enumerating partial otg devices
Date: Tue, 12 Feb 2008 15:22:15 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Tue, Feb 12, 2008 at 05:02:47AM -0800, David Brownell wrote:
> On Tuesday 12 February 2008, Felipe Balbi wrote:
> > On Tue, Feb 12, 2008 at 02:28:53AM -0800, David Brownell wrote:
> > > On Tuesday 12 February 2008, Felipe Balbi wrote:
> > > > Some devices claim
> > > > to be b_host even though they have an a_connector attached to it.
> > > 
> > > Why not just fix that bug?  Remember that's Linux code.
> > 
> > The device claiming to be b_host is not linux based.
> Wrong ... the meaning of that flag is:  *THIS* system is a
> Linux-USB OTG device which came up in B-peripheral role, and
> then through the magic of HNP morphed into the B-host role.

Don't be sarcastic I won't even fall into what Jean Delvare told you.

> Linux is acting as a host at that point.  So either it's
> being the A-host, or the B-host.  That flag says which.  If
> the other device has the A-connector, yet we're the B-host,
> then right now it is acting as an A-peripheral.  That's
> exactly what HNP is designed to do.

True, but allowing hnp nowing we're b_host doesn't sound correct. If
we're b_host it can get two scenarios we would get to fall into this

	1. We asked to become host; or
	2. A_device allowed us become host because it can't handle us.

In both cases, HNP is quite useless happening again, don't you think?
We should at least try to enumerate a_peripheral, if it can't due to
our power capabilities i.e. 100mA, we'll fall into overcurrent
protection and we'll suspend the bus and disconnect, which would give
a_device another change to enumerate us.

This sound much better to me.

> > In any case this 
> > is_b_host check won't do nothing here as we should check is
> > SetFeature(b_hnp_enbable) has been succesfull.
> Again wrong ... if the host side's b_hnp_enable flag is set,
> that means this is a Linux-USB OTG device which came up in
> A-host role and enumerated some vendor's OTG device, and
> then set the b_hnp_enable flag.  (So it could in the future
> use HNP to become an A-peripheral, despite having started
> as an A-host.)
> > A device in b_host state is not enough for allowing hnp to happen.
> If the system is in b_host state, then HNP *ALREADY* happened.

True, but...

> So it can happen again, to go back into the b_peripheral state.
> (And of course, we can't set the b_hnp_enable flag in a device
> which is in the a_peripheral state...)

it shouldn't happen again at this point. If we're b_host, we should try to
enumerate a_peripheral. If it draws more than 100mA the session should
end, otherwise we'd fall into hnp loops until we start getting hub port
errors and linux decide to suspend roothub and end the session.

> Seems like the root cause of the problem here is that you
> have some correctly functioning code, but for some reason
> you're surprised by that correct functioning.  (Maybe this
> is a case where neither device is on the other's whitelist?)

True, neither is in other's whitelist, but the point is:

 1. Currently standard-a device supports hnp only on A states
 2. Currently standard-b device supports hnp on both roles
 3. A-device enumerates b-device, checks it's not tpl'ed and allow hnp
 4. B-device become b_host, checks a_peripheral is not on its tpl, even
 though it has support for that device class and it draws less than

According to otg tpl clarification, they should work in this scenario,
shouldn't they ? Or should they stay in an hnp loop until someone
decides to end the session ?

	- Balbi

  reply	other threads:[~2008-02-12 13:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-12 17:00 Felipe Balbi
2008-02-12 10:28 ` David Brownell
2008-02-12 17:45   ` Felipe Balbi
2008-02-12 13:02     ` David Brownell
2008-02-12 20:22       ` Felipe Balbi [this message]
2008-02-12 20:32         ` David Brownell
2008-02-13 16:29           ` Felipe Balbi
2008-02-13 21:36             ` David Brownell
2008-02-14  5:03               ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \
    --subject='Re: [PATCH] USB: OTG: Fix weirdnesses on enumerating partial otg devices' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).