Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid

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

 



W dniu 04.02.2015 o 15:33, Chris McClimans pisze:
Hi Andrzej,

Thank you for your time.

I'd like to take a stab at FunctionFS before I start looking at
backporting hid and uvc from 3.19+

I found a lot of information (mainly from you [1] [2]) on gadget
ConfigFS and hid, but I'm
having less luck finding information on FunctionFS and the required daemons.

On Thu, Jan 22, 2015 at 7:33 AM, Andrzej Pietrasiewicz
<andrzej.p@xxxxxxxxxxx> wrote:

These days instead of gadgetfs one should probably use FunctionFS.
The purpose of the two is delegating actual usb function implementation
to userspace with some filesystem being the interface to the kernel.

It looks like I should be able to combine Ethernet, Mass Storage, and
HID this way.
(and it's supported all the way back to 3.10)
However I haven't found any ffs-daemon examples, including the
hid-daemon mentioned
in the kernel source.


Yeah, those are hypothetical userspace usb function drivers...
...some of which you are generously going to contribute to the open source
community ;-)

What I am aware of is a userspace program in Documentation/usb/gadget_hid.txt,
but it only uses hid's /dev node. Using hid's /dev node has nothing
to do with the way your gadget is composed. No matter how you compose
your gadget containing hid, you end up providing a /dev node and this
interface has nothing to do with FunctionFS.

By "ffs-daemon" I mean a userspace program which implements a USB function.

Example "ffs-daemons":

- tools/usb/ffs-test.c
- tools/usb/ffs-aio-example (using async io)
- https://android-review.googlesource.com/#/c/31640/ (my proof-of-concept
for converting adbd to using FunctionFS; actually as far as I know
it ended up with some changes in Android code base:
https://android.googlesource.com/platform/system/core/+/fd96db17b7f07eb6615af01fd1908b74383bf04b)
- http://www.spinics.net/lists/linux-usb/msg41962.html (PTP)
- http://www.spinics.net/lists/linux-usb/msg87093.html (another PTP)

Also I'm not quite sure how the loading g_ffs enables Ethernet in the docs.
Is g_ffs loaded after a g_multi that included Ethernet?

Not at all. You cannot have two gadgets active at the same time
unless you have at least two UDC/OTG (USB device controller) chips
in your Linux box acting as your USB gadget. And if you do have two
UDC chips then almost for sure each handles a separate USB cable
which is probably not what you want. I think you want a single
gadget which provides Ethernet _and_ FunctionFS.

Now some clarification.
g_ffs is a legacy gadget, whose composition is defined statically
in source code, as opposed to gadgets composed with configfs at runtime.
In its Kconfig entry it allows some flexibility: as a matter of fact
g_ffs is a composite gadget, which always contains FunctionFS proper and,
optionally, CDC ECM (Ethernet), and RNDIS (Ethernet).

A USB gadget contains one or more configurations, each configuration
groups a number of usb functions like Ethernet, Mass Storage, HID etc.
g_ffs can contain up to 3 configurations:

0) FunctionFS + RNDIS
1) FunctionFS + ECM
2) FunctionFS

Please note that a popular, proprietary operating system asks only
for the first configuration in any gadget.

So in order to have Ethernet and FunctionFS in g_ffs you need
to provide a suitable configuration. make menuconfig is your friend.

AP

--
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