Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: "Andrew P. Lentvorski" <bsder@allcaps.org>,
	Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org
Subject: Re: Unable to set "iInterface" in usb gadget via configfs
Date: Thu, 16 Jan 2020 15:02:12 +0200
Message-ID: <87lfq75zcb.fsf@kernel.org> (raw)
In-Reply-To: <0453184e-353e-2a98-4f7a-c97b9dddf57a@allcaps.org>

[-- Attachment #1: Type: text/plain, Size: 2405 bytes --]


hi,

"Andrew P. Lentvorski" <bsder@allcaps.org> writes:
> On 1/15/20 7:14 AM, Alan Stern wrote:
>
>> I don't think any earlier messages in this thread made it through the 
>> mailing list, but this one definitely did.
>
> Yay!  I also saw this one in the archives so I was hopeful.
>
>>>> I've been trying to set "iInterface" in my usb gadget to a specific
>>>> string, but I simply can't find a way to make configfs accept this.

iInterface is not a string. It's the index to a string descriptor table.

>>>> When I set my gadget up on my Beaglebone Black (uname -a: Linux
>>>> beaglebone 4.14.108-ti-r113 #1 SMP PREEMPT Wed Jul 31 00:01:10 UTC
>>>> 2019 armv7l GNU/Linux).
>>>>
>>>> I get (output from lsusb):
>>>>
>>>> iInterface 5 HID Interface
>>>>
>>>>
>>>> But I want it to be something like:
>>>>
>>>> iInterface 4 LPC-LINK2 CMSIS-DAP V5.224

Why? Oh, you want your beaglebone to behave as a CMSIS-DAP to trick some
other SW?

Do we need to support that upstream, though? It seems like this is a
one-off thing. Does anybody else need to configure interface string
descriptor?

>> Then maybe you need to fix f_hid.c.  Or maybe configfs isn't meant to
>> allow the user to specify these string index values (I don't know any
>> of the configfs details).
>
> That's kind of my problem in that I was hoping to get someone far more
> knowledegable than me to at least flag these before attacking it:
>
> A) I didn't overlook something stupid and this really is hardwired with
> no way to change it (either in configfs or ... some other? kernel mechanism)

yes, it really is hardwired

> B) This is an *actual* bug.

Not a bug, just was never a requirement.

> C) This is an actual bug *that should be fixed* and isn't that way
> intentionally for some Linux reason.

Up until now, it has been intentional. Currently, I don't see a need to
change it. I may be persuaded otherwise, but I need to see arguments
other than "I want to trick some SW into thinking I'm something else".

> D) This is actually the right place to fix it.  Obviously there is going
> to be something at the configfs level, too, and I have *zero* idea where
> to start looking for that.

drivers/usb/gadget/configfs.c, look for GS_STRINGS_RW(). Note, also,
that you should *not* allow for strings to be changed after the device
has been enumerated.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 23:58 Andrew P. Lentvorski
2020-01-15 15:14 ` Alan Stern
2020-01-16  2:23   ` Andrew P. Lentvorski
2020-01-16 13:02     ` Felipe Balbi [this message]
2020-01-17  0:39       ` Andrew P. Lentvorski
2020-01-17  9:25         ` Felipe Balbi
2020-01-18  0:58           ` Andrew P. Lentvorski
2020-01-19 16:45             ` Felipe Balbi

Reply instructions:

You may reply publically 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=87lfq75zcb.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=bsder@allcaps.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git