Linux USB
 help / color / mirror / Atom feed
From: Ingo Rohloff <lundril@gmx.de>
To: linux-usb@vger.kernel.org
Subject: USB Gadget via ConfigFS; define custom String Descriptors
Date: Tue, 22 Dec 2020 12:13:17 +0100	[thread overview]
Message-ID: <20201222121317.008f54a6@ingxiaomi.fritz.box> (raw)

Hello,

before trying to implement something I would like to get some opinions
if what I am thinking of seems to be useful, or if I am on the wrong
track.

I am implementing a USB Gadget.
To configure the gadget I use ConfigFS.
Now what I would like to do is to configure some device specific
string descriptors, which have a fixed, custom index.


Now I know that if you for example create a gadget in configFS
at directory
  usb_gadget/g1

you will get the following standard device string descriptors:
  usb_gadget/g1/strings/0x409
    manufacturer
    product
    serialnumber

You might set the content of these string descriptors by writing to
these files.
The indexes of these string descriptors gets auto-assigned as far as I
understand the Linux source code.
These indexes are then put into the USB device descriptor, which is how
a USB host finds out which indexes to use.


What I now want to do is to define additional string descriptors, with
some fixed, custom indexes.

Questions:

* Is this simply not intended by the USB spec ?

* Is there already a way to do that via ConfigFS,
  which I am not aware of ?

* Does a mechanism to define such custom string descriptors sound
  useful ? So is it worth the effort to implement it ?


Just a super simple proposal how to do that; since I have no experience
what's best for ConfigFS, please advise if you think there is a better
way!
If a user creates a file
   usb_gadget/g1/strings/0x0409/
      custom_34

Then this will be accessible as USB device string descriptor,
with index 0x34. So the two characters after the "_" are interpreted as
two hex digits, which define the index.

Does this sound like a viable strategy to allow custom string
descriptors ?


Ingo

                 reply	other threads:[~2020-12-22 11:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201222121317.008f54a6@ingxiaomi.fritz.box \
    --to=lundril@gmx.de \
    --cc=linux-usb@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox