All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Tomasz Grobelny <tomasz.aleksander.grobelny@gmail.com>,
	linux-usb@vger.kernel.org
Subject: Re: dwc2 gadget mode different behaviour with different hosts
Date: Tue, 05 Jan 2021 15:07:25 +0200	[thread overview]
Message-ID: <87mtxncz1u.fsf@kernel.org> (raw)
In-Reply-To: <CAAH9jopk2ngwBDxfmQ8CQsvntW0uUU2e4h3R=drXV2n2y6+Nuw@mail.gmail.com>

Hi,

Tomasz Grobelny <tomasz.aleksander.grobelny@gmail.com> writes:
> Hi all,
>
> I am trying to implement Android Open Accessory Protocol which is a
> base for Android Auto Protocol. I am using Odroid N2 working in gadget
> mode and trying to send data to car's headunit.
>
> The problem I am facing now is that for some headunits it works, for
> some it doesn't. It seems there is some difference in what happens
> immediately after the host tries to switch device to accessory mode by
> sending control commands 51, 52 and 53. The initial part in all cases
> (all headunits I have access to) works just fine, but after it
> completes my Odroid gadget should be reinitialized on the USB bus. On
> hosts on which it works (my PC and VW headunit) the device gets new
> address like this:
>
> [   33.491312] Mass Storage Function, version: 2009/09/11
> [   33.491322] LUN: removable file: (no medium)
> [   33.504716] file system registered
> [   33.506279] read descriptors
> [   33.506290] read strings
> [   33.510164] dwc2 ff400000.usb: bound driver configfs-gadget
> [   33.678710] dwc2 ff400000.usb: new device is high-speed
> [   33.750089] dwc2 ff400000.usb: new device is high-speed
> [   33.806366] dwc2 ff400000.usb: new address 4
> [   37.899601] ffs_data_put(): freeing
> [   37.899862] unloading
> [   38.942619] file system registered
> [   38.943003] read descriptors
> [   38.943009] read strings
> [   38.946561] dwc2 ff400000.usb: bound driver configfs-gadget
> [   39.310762] dwc2 ff400000.usb: new device is high-speed
> [   39.381890] dwc2 ff400000.usb: new device is high-speed
> [   39.438056] dwc2 ff400000.usb: new address 5
>
> On Fiat's headunit I get the same address for both phases:
> [   33.773387] Mass Storage Function, version: 2009/09/11
> [   33.773397] LUN: removable file: (no medium)
> [   33.784054] file system registered
> [   33.792335] read descriptors
> [   33.792389] read strings
> [   33.796349] dwc2 ff400000.usb: bound driver configfs-gadget
> [   34.023544] dwc2 ff400000.usb: new device is high-speed
> [   34.131592] dwc2 ff400000.usb: new device is high-speed
> [   34.194740] dwc2 ff400000.usb: new address 3
> [   34.353478] ffs_data_put(): freeing
> [   34.353825] unloading
> [   35.392723] file system registered
> [   35.393450] read descriptors
> [   35.393459] read strings
> [   35.403955] dwc2 ff400000.usb: bound driver configfs-gadget
> [   37.119299] dwc2 ff400000.usb: new device is high-speed
> [   37.227341] dwc2 ff400000.usb: new device is high-speed
> [   37.290497] dwc2 ff400000.usb: new address 3
>
> Any idea why this might be the case? Can I somehow enforce that the
> device reintroduces itself on the bus and gets new address? Can I
> somehow debug what happens when my device is connected as gadget (eg.
> see control messages for device/configuration/string descriptors)?

Make sure your device passed USB Command Verifier Chapter 9 tests. You
can use mass storage for early testing, once that's working fine, then
switch to the android accessory mode. This could very well be a bug in
dwc2 itself.

-- 
balbi

  parent reply	other threads:[~2021-01-05 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  1:02 dwc2 gadget mode different behaviour with different hosts Tomasz Grobelny
2021-01-05  6:49 ` Greg KH
2021-01-05 19:02   ` Tomasz Grobelny
2021-01-05 13:07 ` Felipe Balbi [this message]
2021-02-25 23:53   ` Tomasz Grobelny

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=87mtxncz1u.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tomasz.aleksander.grobelny@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.