5 Replies Latest reply on Jan 22, 2015 12:58 PM by @hippiehacker

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

    @hippiehacker

      The linux-usb community has been quite helpful, but I would really love some discourse on this from knowledgeable people at Intel.

      It seems it's up to me to backport the patches to a kernel that's not maintained in the open, but I don't want to do this alone.

       

      From http://article.gmane.org/gmane.linux.usb.general/120512

      "then you need to backport patches yourself. The community can't really

      support older kernels :-)"

      "I guess you don't have other way but keep in mind you'll, essentially,

      be on your own."

       

      From f hid  f mass storage  and f rdnis via configfs on platform intel mid

       

      Thanks for all the direction and feedback thus far, configfs is the

      way to go but I would need f_hid, f_mass_storage, and f_rdnis which

      aren't available in v3.10. Configfs f_hid is relatively recent,

      f_rndis + f_mass_storage where merged into v3.11, but similar

      functions actual entered the kernel in v3.10... which is what gives me

      hope that the porting may be simple.

       

      Porting the platform/intel-mid forward to a new kernel version without

      communication from Intel would probably result in needless duplication

      of effort. Would it be advisable for me to backport the

      drivers/usb/gadget/function/* from 3.19-rc1 and compile them in

      3.10.17? I doubt it would be as simple as copying them over and

      modifying the Makefile, but one can hope.

       

      https://lkml.org/lkml/2014/12/14/274 - v3.19-rc1 for f_hid

       

      https://lkml.org/lkml/2013/7/1/388 - v3.11-rc1 for f_rndis and f_mass_storage

       

      https://lkml.org/lkml/2013/4/29/248 - v3.10-rc1 for f_acm (which seems

      to load and configure **)

       

      **root@...:/# cat

      /sys/kernel/config/usb_gadget/gadget/functions/acm.usb0/port_num

      0

        • 1. Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid
          Intel_Peter

          Hello @hippiehacker,

           

          You can find some updates for the kernel in the AlexT repo, why don't you take a look at this: How to install a kernel from my repo onto Edison with the official image

          In there AlexT explains how to install them but if they are not sufficient you can always create your own modifications.

           

          Peter.

          • 2. Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid
            @hippiehacker

            @Intel_Peter would you mind publishing the layer you used to build your repo?

             

            The kernel features I am looking for are currently only in the 3.19 series which there is currently no yocto build.

             

            I'm trying to get some feedback on if 3.19-rc4 would it boot the Edison at all and if so some help on bulding a yocto layer to do so...

             

            If it won't boot or function well enough, would it be worth the effort to backport the kernel modules from 3.19 back to 3.10.

            • 3. Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid
              @hippiehacker

              I has crossposted this to linux-usb


              The devices in embedded space accept kernel updates at various speeds.
              The raspberry pi is at 3.18, and the Intel Edison is bit lagging at 3.10.
              I thought it would probably be useful to the embedded community if I at
              least took a stab at back porting the hid gadgetfs function to 3.18 for use
              on the raspberry pi. Going farther back with more modules if there is interest.

              I searched through the kernel source and I think I've found the definitive
              list of gadget functions (grepping for DECLARE_USB_FUNCTION_INIT),
              and noted when they were introduced.

              3.19 midi, hid
              3.18 uvc, uac2, uac1
              3.14 fs
              3.13 mass_storage
              3.11 subset, rndis, phonet, ncm, eem, ecm
              3.10 serial, obex, acm

              I figured this list was probably the best place to ask if there were any
              caveats to taking usb/gadget/function/f_hid.c back one kernel rev.

              On Tue, Jan 13, 2015 at 11:49 AM, Felipe Balbi <balbi@ti.com> wrote:
              > then you need to backport patches yourself. The community can't really
              support older kernels :-)
              > I guess you don't have other way but keep in mind you'll, essentially,
              be on your own

               

              Any obvious dragons be aware of before I head out on my own?


              Is there a better list to or talk/discuss backporting of usb gadget functions?
              • 4. Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid
                @hippiehacker

                Some great information from the linux-usb mailing list http://www.spinics.net/lists/linux-usb/msg120315.html


                Hello Chris,

                 

                W dniu 22.01.2015 o 15:37, Chris McClimans pisze:

                The devices in embedded space accept kernel updates at various speeds.
                The raspberry pi is at 3.18, and the Intel Edison is bit lagging at 3.10.
                I thought it would probably be useful to the embedded community if I at
                least took a stab at back porting the hid gadgetfs function to 3.18 for use
                There is no gadgetfs hid implementation, at least there are none
                that I am aware of.

                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.

                And ConfigFS is a totally different thing: in the context of usb gadgets
                it serves the purpose of composing gadgets of different usb functions
                at runtime. The kernel versions and function names you mention below
                suggest that you mean ConfigFS.

                on the raspberry pi. Going farther back with more modules if there is interest.

                I searched through the kernel source and I think I've found the definitive
                list of gadget functions (grepping for DECLARE_USB_FUNCTION_INIT),
                You should also grep for DECLARE_USB_FUNCTION

                and then you would find:

                SourceSink
                Loopback

                which, in legacy gadgets, are components of gadget zero (g_zero),
                the "first" gadget by David Brownell.
                The two functions serve testing purposes and their names suggest
                their use. They are also available for composing gadgets with configfs.

                and noted when they were introduced.

                It is likely that uvc will land in 3.20, so you might also be preparing for

                3.20 uvc

                3.19 midi, hid
                3.18 uvc, uac2, uac1
                3.14 fs
                3.13 mass_storage
                3.11 subset, rndis, phonet, ncm, eem, ecm
                3.10 serial, obex, acm

                I figured this list was probably the best place to ask if there were any
                caveats to taking usb/gadget/function/f_hid.c back one kernel rev.
                With hid specifically it is likely you will just cherry pick a couple
                of commits and solve some trivial conflicts (like in Makefile or Kconfig).

                On Tue, Jan 13, 2015 at 11:49 AM, Felipe Balbi <balbi@xxxxxx> wrote:
                then you need to backport patches yourself. The community can't really
                support older kernels :-)
                I guess you don't have other way but keep in mind you'll, essentially,
                be on your own

                Any obvious dragons be aware of before I head out on my own?

                If you decide to backport anything to 3.10, you must take this into
                consideration:
                Apart from some changes in the usb functions themselves,
                at some point in time there happended refactoring of the gadget
                directory. I guess it was sometime between 3.14 and 3.18.
                Before the refactoring all the source code files related to gadgets
                implementation had resided in drivers/usb/gadget. Since the refactoring
                there are dedicated directories: functions, udc and legacy.
                "functions" dir contains actual usb function implementations, "udc" dir
                contains USB Device Controller implementations (except dual role devices
                like dwc2 or dwc3) and "legacy" dir contains traditional gadgets,
                composed at compilation time. The change also affected Makefiles
                and Kconfigs. That said, git might be smart enough to treat most of the
                refactoring changes merely as "renames".


                Is there a better list to or talk/discuss backporting of usb gadget functions?

                I guess there is no other list where people know more
                about usb gadgets in Linux.
                But when it comes to backporting you are on your own,
                as Felipe said. If I were you, I would be targeting 3.18.
                By the time you will have been done at least the 3.20 (or newer)
                will be the state-of-the art kernel. My personal view is
                that supporting 3.10 at that time makes no sense.

                AP


                • 5. Re: f_hid, f_mass_storage, and f_rdnis via configfs on platform/intel-mid
                  @hippiehacker

                  This gives us a list of gadgets and available kernel.... which has a big impact on what BSPs could be supported.

                   

                  Hence my effort to backport or encourage devices to support newer kernels.

                   

                   

                  # 3.19 and 3.20 are in http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto-contrib/ but do not yet contain any linux-yoctoness.. understandable

                  3.20 uvc

                  3.19 midi, hid

                   

                  # Raspberry Pi has a https://github.com/raspberrypi/linux/tree/rpi-3.18.y which gives us a reasonable backport

                  3.18 uvc, uac2, uac1

                   

                  # 3.10, 3.14, and 3.17 have git repos here: http://git.yoctoproject.org/cgit/cgit.cgi/linux-yocto

                  3.14 fs

                  3.13 mass_storage

                  3.11 subset, rndis, phonet, ncm, eem, ecm

                   

                  # Intel Edison sits here... but maybe the next BSP release will update the kernel!.... there is no repo for it, just a patch included with the release tarball

                  3.10 serial, obex, acm