From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Kyungmin Park <kyungmin.park@samsung.com>,
Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joel Becker <jlbec@evilplan.org>,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [RFC 0/2] USB gadget - configfs
Date: Sun, 24 Jun 2012 21:50:04 +0200 [thread overview]
Message-ID: <4FE76F6C.1090300@linutronix.de> (raw)
In-Reply-To: <1340276129-20023-1-git-send-email-andrzej.p@samsung.com>
On 06/21/2012 12:55 PM, Andrzej Pietrasiewicz wrote:
> $ echo 1> /cfg/usb-function-gadget/G1/connect
> $ file.img> /cfg/usb-function-gadget/G1/C1/F1/f_mass_storage/lun0/file
connect should be available at UDC level which triggers the
pull-up/down of the UDC. The gadget itself should be configured once
and made available / bound to the UDC. And you may have more
than once UDC at a time within a single a system.
> Each function, after creating its corresponding directory
> (/cfg/usb-function-gadget/G1/C1/F1), must be "personalized" by storing
> its name in the "name" attribute. After that it is possible to create
> a child item of the same name ("f_mass_storage" here). The common code
> handles everything from top of the hierarchy up to the function directory.
> Under the function directory a function-specific stuff provided by each
> function is used. The function-specific code is abstracted by the above
> mentioned struct ufg_fn. In the example, the mass storage function is
> supplied with one LUN.
The hierarchy looks good. C1 vs config1 is just taste.
> The "connect" attribute's store method calls the ufg_gadget_bind function,
> which registers the composite gadget, then walks the configfs hierarchy
> rooted at the above mentioned subsystem and does USB configurations and
> functions registration.
> This is a work in progress. There might be issues.
>
> I would like to ask some questions. All answers in general, and answers
> from linux-usb and Felipe and Greg KH in particular, are welcome.
>
> 1. Generally, is this the right way to go?
In the big picture I think, yes. I think you should start a little
different. We need to be able to load multiple gadgets at a time.
Therefore I would suggest to first rip the global variables out of
composite. It is probably also possible to do it after configfs is in
but I think doing it first would be less work.
> 2. Using configfs like this calls for an interface between the generic
> configfs-related code and function-specific code. I suggested the
> struct ufg_fn. What do you think?
> 3. Should some parameters still be available through sysfs?
We have for udc level some things like connect, power level and Felipe
planned a poll interface for connect/disconnect notifications. This is
one side. On the gadget it should configure a custom gadget as detailed
as possible / required. What kind of options would you like to export
via sysfs? Currently I can't think of any.
> 4. Do we need module parameters for USB descriptors like iManufacturer
> and similar?
No. No modules parameters at all. With one exception: Currently we set
those things via modprobe. As a for compatibility interface I guess we
have to keep this. In the end I would like have f_mass_storage gone as
it. We would have a new gadget_storage which provides only the function
and relies on configfs module and nothing else. The replacement
g_mass_storage would simply be a small module which takes the
iManufacturer parameters and others and configures the gadget the way
the old gadget did i.e. without echo this and echo that.
> 5. I assumed that the configfs entities are contained in the structures
> used for configuring the USB functions, e.g. a struct config_group in
> struct fsg_common, or a struct config_item in a struct fsg_lun. This
> has implications that the lifetime of the structures is controlled by
> userspace through configfs, which, in turn, has influence on how
> the USB functions are implemented. Even though it seems natural,
> there are some issues. For example an extension to configfs was required
> in order to disable deleting the luns while the gadget is connected.
> Is this the right approach? If not, then are there any alternatives?
Joel might be a help here. I had the same problem with my uas gadget
and I ignored it for now. I think it should be possible to forbid
unlink / rename / create at certain states of gadget. For instance it
should not be possible to change a single thing while the gadget is
connected.
Sebastian
next prev parent reply other threads:[~2012-06-24 19:50 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-21 10:55 [RFC 0/2] USB gadget - configfs Andrzej Pietrasiewicz
2012-06-21 10:55 ` [RFC 1/2] fs: configfs: add check_rmdir operation Andrzej Pietrasiewicz
2012-07-02 8:49 ` Joel Becker
2012-06-21 10:55 ` [RFC 2/2] usb: gadget: Add USB Functions Gadget Andrzej Pietrasiewicz
2012-06-21 11:34 ` [RFC 0/2] USB gadget - configfs Sebastian Andrzej Siewior
2012-06-24 19:50 ` Sebastian Andrzej Siewior [this message]
2012-06-25 14:11 ` Alan Stern
2012-07-03 16:15 ` Felipe Balbi
2012-07-02 9:09 ` Joel Becker
2012-07-10 8:54 ` Andrzej Pietrasiewicz
2012-08-15 8:13 ` Joel Becker
2012-08-16 13:17 ` Andrzej Pietrasiewicz
2012-08-16 13:47 ` Sebastian Andrzej Siewior
2012-08-17 1:46 ` Joel Becker
2012-08-17 9:22 ` Sebastian Andrzej Siewior
2012-08-17 10:30 ` Andrzej Pietrasiewicz
2012-08-17 10:34 ` Sebastian Andrzej Siewior
2012-08-20 5:59 ` Joel Becker
2012-08-20 8:53 ` Andrzej Pietrasiewicz
2012-08-20 11:17 ` Joel Becker
2012-08-20 11:01 ` Sebastian Andrzej Siewior
2012-08-20 11:19 ` Joel Becker
2012-08-21 8:19 ` Andrzej Pietrasiewicz
2012-08-29 19:52 ` Sebastian Andrzej Siewior
2012-08-29 13:17 ` Andrzej Pietrasiewicz
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=4FE76F6C.1090300@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlbec@evilplan.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.szyprowski@samsung.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 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).