linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sid Spry" <sid@aeam.us>
To: "Peter Chen" <peter.chen@nxp.com>
Cc: "Felipe Balbi" <balbi@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: Documentation for Raw USB ConfigFS
Date: Mon, 18 May 2020 17:14:33 -0500	[thread overview]
Message-ID: <83ac8b7b-e0e7-4615-8ebf-4c98e596577b@www.fastmail.com> (raw)
In-Reply-To: <20200518054914.GC27612@b29397-desktop>

On Mon, May 18, 2020, at 12:48 AM, Peter Chen wrote:
> On 20-05-16 00:57:55, Sid Spry wrote:
> > On Thu, May 14, 2020, at 8:05 PM, Peter Chen wrote:
> > > 
> > > > >
> > > > > Would you please let ECM gadget work first at your board, then let
> > > > > f_fs work using test application (you need to compile both host and
> > > > > device application for it). After that, you may have more precise
> > > > > concept for Linux USB gadget framework.
> > > > >
> > > > 
> > > > I don't see anything that harmonizes preexsting function usage with specifying
> > > > custom endpoints.
> > > > 
> > > > I've gotten the ECM gadget, and then the ECM gadget via ffs working. I've read
> > > > through the ffs test but I don't see any way to assign functionality to the endpoints.
> > > > The example seems to transport raw data via a bulk endpoint. I know enough to
> > > > instead assign an isochronous endpoint to the UDC and transfer via that, but I don't
> > > > want it to be the *only* functionality the device offers.
> > > > 
> > > > Are you saying I can assign the ECM gadget via ffs and then add another driver
> > > > after the fact? 
> > > 
> > > ffs (f_fs.c) is used for customized function, other functions, like ECM (f_ecm.c)
> > > and Mass Storage (f_mass_storage.c) are used for certain function. You could
> > > use configfs (like you have done below) to put customized function and certain functions
> > > into one configuration, and let the host see them at the same time. Do your
> > > real requirement is one customized function and one ECM function in one USB gadget?
> > > If it is, below is the example to combine f_fs, mass_storage, and NCM together.
> > > 
> > > cd /sys/kernel/config/usb_gadget
> > > cd g1
> > > echo "0x1d6b" > idVendor
> > > echo "0x0105" > idProduct
> > > mkdir /dev/usb-ffs
> > > mkdir functions/ffs.usb
> > > mount -t functionfs usb /dev/usb-ffs
> > > ln -s functions/ffs.usb configs/c.1
> > > /home/root/usb_test/ffs_test/ffs-test & /* your own test application */
> > > while [ ! -e /dev/usb-ffs/ep1 ]
> > > do
> > >  echo "."
> > >  sleep 1;
> > > done
> > > mkdir functions/ncm.0 
> > > ln -s functions/ncm.0 configs/c.1 
> > > mkdir functions/mass_storage.0
> > > ln -s functions/mass_storage.0 configs/c.1
> > > echo $FILE > functions/mass_storage.0/lun.0/file 
> > > 
> > > Peter 
> > > 
> > 
> > Hi Peter, thanks for the advice. I realized I was confusing FunctionFS and ConfigFS a little while after I sent my message and saw the FFS configuration in the ConfigFS documentation.
> > 
> > And yes, I need ECM/NCM (one is newer and faster, will go look it up again) and my custom function. I may also include a serial port.
> > 
> > I have been having issues creating any file called "ffs.${id}" in the gadget directory. It fails with device or resource busy. I assume this means I have misconfigured it, but I am copying your example; or missing the driver, but I have ensured it is there.[1] I have also tried ensuring the ffs function is added first. Any pointers?
> > 
> 
> 1. Please build in all configfs functions, and choose through the
> script.
> 
> CONFIG_USB_CONFIGFS=y
> CONFIG_USB_CONFIGFS_SERIAL=y
> CONFIG_USB_CONFIGFS_ACM=y
> CONFIG_USB_CONFIGFS_OBEX=y
> CONFIG_USB_CONFIGFS_NCM=y
> CONFIG_USB_CONFIGFS_ECM=y
> CONFIG_USB_CONFIGFS_ECM_SUBSET=y
> CONFIG_USB_CONFIGFS_RNDIS=y
> CONFIG_USB_CONFIGFS_EEM=y
> CONFIG_USB_CONFIGFS_MASS_STORAGE=y
> CONFIG_USB_CONFIGFS_F_LB_SS=y
> CONFIG_USB_CONFIGFS_F_FS=y
> CONFIG_USB_CONFIGFS_F_UAC1=y
> CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
> CONFIG_USB_CONFIGFS_F_UAC2=y
> CONFIG_USB_CONFIGFS_F_MIDI=y
> CONFIG_USB_CONFIGFS_F_HID=y
> CONFIG_USB_CONFIGFS_F_UVC=y
> 
> 2. Try exactly the same script I gave you, do not try change
> any charaters (except the position for your application)
> 
> > > cd /sys/kernel/config/usb_gadget
> > > cd g1
> > > echo "0x1d6b" > idVendor
> > > echo "0x0105" > idProduct
> > > mkdir /dev/usb-ffs
> > > mkdir functions/ffs.usb
> > > mount -t functionfs usb /dev/usb-ffs
> > > ln -s functions/ffs.usb configs/c.1
> > > /home/root/usb_test/ffs_test/ffs-test & /* your own test application */
> > > while [ ! -e /dev/usb-ffs/ep1 ]
> > > do
> > >  echo "."
> > >  sleep 1;
> > > done
> 
> > 
> > [1]: I actually did not have CONFIG_USB_CONFIGFS_F_FS nor F_NCM/ECM set however the necessary code seemed to have been pulled in some other way and the modules were available. They were loaded, and as explained my shell-based configfs code worked. They are set now and the problem persists.
> 

Hi, sorry I was not clear. The kernel config is fine, and CONFIG_USB_CONFIGFS_F_FS is set. I run your exact script (minus the ffs-test line) and it fails to create the functions/ffs.usb directory as I described before. I can create other functions just fine.

  reply	other threads:[~2020-05-18 22:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 17:08 Documentation for Raw USB ConfigFS Sid Spry
2020-05-06  9:17 ` Peter Chen
2020-05-12 15:14   ` Sid Spry
2020-05-13  7:36     ` Felipe Balbi
2020-05-13 10:05       ` Peter Chen
2020-05-14 16:32         ` Sid Spry
2020-05-15  1:05           ` Peter Chen
2020-05-16  5:57             ` Sid Spry
2020-05-18  5:48               ` Peter Chen
2020-05-18 22:14                 ` Sid Spry [this message]
2020-05-18 23:58                   ` Peter Chen
2020-05-19 19:12                     ` Sid Spry
2020-05-19 19:40                       ` Sid Spry
2020-05-19 19:51                         ` Krzysztof Opasiak
2020-05-20  5:27                           ` Sid Spry

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=83ac8b7b-e0e7-4615-8ebf-4c98e596577b@www.fastmail.com \
    --to=sid@aeam.us \
    --cc=balbi@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.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).