[PATCH] usb: gadget: composite: Provide list of registered functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a respin of previously discussed RFC patch[1].

*Why?*

USB gadget can be composed from userspace using ConfigFS. During
gadget composition user has to create at least one instance of
function. Instance is being created using

cd <configfs-root>/usb-gadget/<gadget-name>
mkdir functions/<type>.<instance>

Where:
instance - unique name for instance of function of given type
type - name registered by USB function driver during it's module
init

Instance is a string which allow to identify instance if we have for
example two acm functions in one gadget. Type is a USB function driver
identifier registered by driver during module init. This string is
also a part of USB function module alias. User has to know that
functionfs module is identifed using ffs and source sink is identified
by SourceSink.

When function is compiled as a module user may read module.alias file
and get those names form module alias. When function is compiled-in
kernel it doesn't provide entry in module.alias file and currently
there is no way to learn what functions are available.

*Does similar problem exist in other place?*

Yes, similar problem is with file systems. Each module which provides
file system implementation registers some file system name which can
be used during mounting (-t option). User may also check the
module.alias file to find fs types available as modules. To discover
what fs types has been compiled-in kernel there is a /proc/filesystems
file which exports names of all fs types currently registered in
framework.

*How to solve this?*

This patch solves our problem by adding /proc/usb-functions file which
exports to userspace list of all currently registered USB function
drivers. This is similar solution as one used by file systems.

I'm aware that adding new files to proc is not very well welcome.
I have looked for some other more suitable location for this list
but didn't find any, so suggestions are very welcome.

Footnotes:
1 - http://www.spinics.net/lists/linux-usb/msg115872.html


Best regards,
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics

Krzysztof Opasiak (1):
  usb: gadget: composite: Provide list of registered functions

 drivers/usb/gadget/configfs.c  |   53 ++++++++++++++++++++++++++++++++++++++++
 drivers/usb/gadget/configfs.h  |    2 ++
 drivers/usb/gadget/functions.c |   13 ++++++++++
 3 files changed, 68 insertions(+)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux