* Documentation for Raw USB ConfigFS @ 2020-04-30 17:08 Sid Spry 2020-05-06 9:17 ` Peter Chen 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-04-30 17:08 UTC (permalink / raw) To: linux-usb Hi, I'm having issues finding good documentation for raw USB configfs. It has reached the point I need to look at developing a new driver, but I'd like my unique endpoint to coexist with a CDC ECM endpoint or similar. Is there a high level description of this? I can refer to the code but it will be quite slow. Cheers! P.S. to be clear I've gotten a lot of good info from https://www.kernel.org/doc/html/latest/usb/index.html. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 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 0 siblings, 1 reply; 15+ messages in thread From: Peter Chen @ 2020-05-06 9:17 UTC (permalink / raw) To: Sid Spry; +Cc: linux-usb On 20-04-30 12:08:13, Sid Spry wrote: > Hi, I'm having issues finding good documentation for raw USB configfs. It has reached the point I need to look at developing a new driver, but I'd like my unique endpoint to coexist with a CDC ECM endpoint or similar. > > Is there a high level description of this? I can refer to the code but it will be quite slow. > You could write a user application using f_fs for your endpoint, the example is at: tools/usb/ffs-test.c. And add both your specific function and CDC function together into one configuration, in that case, the host could see both functions. -- Thanks, Peter Chen ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-06 9:17 ` Peter Chen @ 2020-05-12 15:14 ` Sid Spry 2020-05-13 7:36 ` Felipe Balbi 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-12 15:14 UTC (permalink / raw) To: Peter Chen; +Cc: linux-usb Hi Peter, thanks for pointing me towards the ffs-test. Unfortunately after some exploration in that area I still don't see how I would add a preexisting function to the configuration to be handled by the kernel. I do see something in an AIO test in the host code where libusb is used to bind a kernel driver to an endpoint. Is that something that will be necessary? Device side, I'm still unsure how I tell the function to handle ECM/ethernet on a collection of endpoints. I understand how USB works fairly well, especially on microcontrollers, but am a little lost still in understanding the Linux machinery for USB. Cheers, Sid On Wed, May 6, 2020, at 4:17 AM, Peter Chen wrote: > On 20-04-30 12:08:13, Sid Spry wrote: > > Hi, I'm having issues finding good documentation for raw USB configfs. It has reached the point I need to look at developing a new driver, but I'd like my unique endpoint to coexist with a CDC ECM endpoint or similar. > > > > Is there a high level description of this? I can refer to the code but it will be quite slow. > > > > You could write a user application using f_fs for your endpoint, the example is at: > tools/usb/ffs-test.c. And add both your specific function and CDC > function together into one configuration, in that case, the host could > see both functions. > > -- > > Thanks, > Peter Chen ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-12 15:14 ` Sid Spry @ 2020-05-13 7:36 ` Felipe Balbi 2020-05-13 10:05 ` Peter Chen 0 siblings, 1 reply; 15+ messages in thread From: Felipe Balbi @ 2020-05-13 7:36 UTC (permalink / raw) To: Sid Spry, Peter Chen; +Cc: linux-usb [-- Attachment #1: Type: text/plain, Size: 847 bytes --] Hi, "Sid Spry" <sid@aeam.us> writes: > Hi Peter, thanks for pointing me towards the ffs-test. Unfortunately after > some exploration in that area I still don't see how I would add a preexisting > function to the configuration to be handled by the kernel. > > I do see something in an AIO test in the host code where libusb is used to > bind a kernel driver to an endpoint. Is that something that will be necessary? > Device side, I'm still unsure how I tell the function to handle ECM/ethernet > on a collection of endpoints. > > I understand how USB works fairly well, especially on microcontrollers, but am > a little lost still in understanding the Linux machinery for USB. please, stop with your top-posting and break your lines at 80-columns. I have re-wrapped your lines so you see how they should look. -- balbi [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-13 7:36 ` Felipe Balbi @ 2020-05-13 10:05 ` Peter Chen 2020-05-14 16:32 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Peter Chen @ 2020-05-13 10:05 UTC (permalink / raw) To: Felipe Balbi, Sid Spry; +Cc: linux-usb On 20-05-13 10:36:05, Felipe Balbi wrote: > > Hi, > > "Sid Spry" <sid@aeam.us> writes: > > > Hi Peter, thanks for pointing me towards the ffs-test. Unfortunately after > > some exploration in that area I still don't see how I would add a preexisting > > function to the configuration to be handled by the kernel. > > > > I do see something in an AIO test in the host code where libusb is used to > > bind a kernel driver to an endpoint. Is that something that will be necessary? > > Device side, I'm still unsure how I tell the function to handle ECM/ethernet > > on a collection of endpoints. > > > > I understand how USB works fairly well, especially on microcontrollers, but am > > a little lost still in understanding the Linux machinery for USB. > 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. -- Thanks, Peter Chen ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-13 10:05 ` Peter Chen @ 2020-05-14 16:32 ` Sid Spry 2020-05-15 1:05 ` Peter Chen 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-14 16:32 UTC (permalink / raw) To: Peter Chen, Felipe Balbi; +Cc: linux-usb On Wed, May 13, 2020, at 5:05 AM, Peter Chen wrote: > On 20-05-13 10:36:05, Felipe Balbi wrote: > > > > Hi, > > > > "Sid Spry" <sid@aeam.us> writes: > > > > > Hi Peter, thanks for pointing me towards the ffs-test. Unfortunately after > > > some exploration in that area I still don't see how I would add a preexisting > > > function to the configuration to be handled by the kernel. > > > > > > I do see something in an AIO test in the host code where libusb is used to > > > bind a kernel driver to an endpoint. Is that something that will be necessary? > > > Device side, I'm still unsure how I tell the function to handle ECM/ethernet > > > on a collection of endpoints. > > > > > > I understand how USB works fairly well, especially on microcontrollers, but am > > > a little lost still in understanding the Linux machinery for USB. > > > > 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? This isn't really spelled out in the documentation (from what I can see). I was operating under the assumption that assigning the UDC claims it and it's not a shared resource. I've already run into issues where certain configurations use up the available endpoints or cause other issues. For reference here is what I am currently doing: --- modprobe g_ffs cd /sys/kernel/config/usb_gadget if [[ -d "g1" ]]; then echo "" > UAC rm -rf g1; fi mkdir g1 cd g1 echo "0x1d6b" > idVendor echo "0x0104" > idProduct mkdir strings/0x409 echo "0000000000" > strings/0x409/serialnumber echo "Foo Bar Inc." > strings/0x409/manufacturer echo "Trololololo" > strings/0x409/product mkdir functions/ecm.usb0 mkdir functions/uac2.dev0 mkdir functions/midi.dev0 mkdir configs/c.1 ln -s functions/ecm.usb0 configs/c.1 ln -s functions/uac2.dev0 configs/c.1 ln -s functions/midi.dev0 configs/c.1 echo "musb-hdrc.2.auto" > UDC ^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: Documentation for Raw USB ConfigFS 2020-05-14 16:32 ` Sid Spry @ 2020-05-15 1:05 ` Peter Chen 2020-05-16 5:57 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Peter Chen @ 2020-05-15 1:05 UTC (permalink / raw) To: Sid Spry, Felipe Balbi; +Cc: linux-usb > > > > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-15 1:05 ` Peter Chen @ 2020-05-16 5:57 ` Sid Spry 2020-05-18 5:48 ` Peter Chen 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-16 5:57 UTC (permalink / raw) To: Peter Chen, Felipe Balbi; +Cc: linux-usb 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]: 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-16 5:57 ` Sid Spry @ 2020-05-18 5:48 ` Peter Chen 2020-05-18 22:14 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Peter Chen @ 2020-05-18 5:48 UTC (permalink / raw) To: Sid Spry; +Cc: Felipe Balbi, linux-usb 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. -- Thanks, Peter Chen ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-18 5:48 ` Peter Chen @ 2020-05-18 22:14 ` Sid Spry 2020-05-18 23:58 ` Peter Chen 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-18 22:14 UTC (permalink / raw) To: Peter Chen; +Cc: Felipe Balbi, linux-usb 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: Documentation for Raw USB ConfigFS 2020-05-18 22:14 ` Sid Spry @ 2020-05-18 23:58 ` Peter Chen 2020-05-19 19:12 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Peter Chen @ 2020-05-18 23:58 UTC (permalink / raw) To: Sid Spry; +Cc: Felipe Balbi, linux-usb > > 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. You may enable debug at configfs.c, f_fs.c and your udc driver to see what happened. Peter ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-18 23:58 ` Peter Chen @ 2020-05-19 19:12 ` Sid Spry 2020-05-19 19:40 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-19 19:12 UTC (permalink / raw) To: Peter Chen; +Cc: Felipe Balbi, linux-usb On Mon, May 18, 2020, at 6:58 PM, Peter Chen wrote: > > > > 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. > > You may enable debug at configfs.c, f_fs.c and your udc driver to see > what happened. > Thanks for your help Peter. Unfortunately I have hit a brick wall. The examples in libusbgx also fail to work, and I tried that library after a friend recommended it as perhaps having secret mojo. I enabled the userspace debug helpers in the kernel but they do not seem to offer me any insight, and there's no relevant dmesg output. My device is an Allwinner H2+, and the UDC seems to be the Inventra Highspeed Dual Role Controller. I've also got the DesignWare USB3/USB2 cores enabled from my upstream but I think they are not being loaded. If anyone can look I'd appreciate it, this is just a hobby project. It's a good chance for me to do some kernel debugging but I'm a bit lost. Thanks for the help so far. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-19 19:12 ` Sid Spry @ 2020-05-19 19:40 ` Sid Spry 2020-05-19 19:51 ` Krzysztof Opasiak 0 siblings, 1 reply; 15+ messages in thread From: Sid Spry @ 2020-05-19 19:40 UTC (permalink / raw) To: Peter Chen; +Cc: Felipe Balbi, linux-usb On Tue, May 19, 2020, at 2:12 PM, Sid Spry wrote: > On Mon, May 18, 2020, at 6:58 PM, Peter Chen wrote: > > > > > > 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. > > > > You may enable debug at configfs.c, f_fs.c and your udc driver to see > > what happened. > > > > Thanks for your help Peter. Unfortunately I have hit a brick wall. The > examples in libusbgx also fail to work, and I tried that library after > a friend recommended it as perhaps having secret mojo. I enabled the > userspace debug helpers in the kernel but they do not seem to offer me > any insight, and there's no relevant dmesg output. > > My device is an Allwinner H2+, and the UDC seems to be the Inventra > Highspeed Dual Role Controller. I've also got the DesignWare USB3/USB2 > cores enabled from my upstream but I think they are not being loaded. > > If anyone can look I'd appreciate it, this is just a hobby project. > It's a good chance for me to do some kernel debugging but I'm a bit > lost. > > Thanks for the help so far. > Sorry for double post again. Alternatively, if anyone can recommend a device which they know has working ffs configfs gadget functionality, I'll just buy a board with that instead. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-19 19:40 ` Sid Spry @ 2020-05-19 19:51 ` Krzysztof Opasiak 2020-05-20 5:27 ` Sid Spry 0 siblings, 1 reply; 15+ messages in thread From: Krzysztof Opasiak @ 2020-05-19 19:51 UTC (permalink / raw) To: Sid Spry, Peter Chen; +Cc: Felipe Balbi, linux-usb On 19.05.2020 21:40, Sid Spry wrote: > On Tue, May 19, 2020, at 2:12 PM, Sid Spry wrote: >> On Mon, May 18, 2020, at 6:58 PM, Peter Chen wrote: >>> >>>>> 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. >>> >>> You may enable debug at configfs.c, f_fs.c and your udc driver to see >>> what happened. >>> >> >> Thanks for your help Peter. Unfortunately I have hit a brick wall. The >> examples in libusbgx also fail to work, and I tried that library after >> a friend recommended it as perhaps having secret mojo. I enabled the >> userspace debug helpers in the kernel but they do not seem to offer me >> any insight, and there's no relevant dmesg output. >> >> My device is an Allwinner H2+, and the UDC seems to be the Inventra >> Highspeed Dual Role Controller. I've also got the DesignWare USB3/USB2 >> cores enabled from my upstream but I think they are not being loaded. >> >> If anyone can look I'd appreciate it, this is just a hobby project. >> It's a good chance for me to do some kernel debugging but I'm a bit >> lost. >> >> Thanks for the help so far. >> > > Sorry for double post again. Alternatively, if anyone can recommend a device which they know has working ffs configfs gadget functionality, I'll just buy a board with that instead. Can you send me the strace log from the libusbgx example that does not work for you? Best regards, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Documentation for Raw USB ConfigFS 2020-05-19 19:51 ` Krzysztof Opasiak @ 2020-05-20 5:27 ` Sid Spry 0 siblings, 0 replies; 15+ messages in thread From: Sid Spry @ 2020-05-20 5:27 UTC (permalink / raw) To: Krzysztof Opasiak, Peter Chen; +Cc: Felipe Balbi, linux-usb On Tue, May 19, 2020, at 2:51 PM, Krzysztof Opasiak wrote: > > > On 19.05.2020 21:40, Sid Spry wrote: > > On Tue, May 19, 2020, at 2:12 PM, Sid Spry wrote: > >> On Mon, May 18, 2020, at 6:58 PM, Peter Chen wrote: > >>> > >>>>> 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. > >>> > >>> You may enable debug at configfs.c, f_fs.c and your udc driver to see > >>> what happened. > >>> > >> > >> Thanks for your help Peter. Unfortunately I have hit a brick wall. The > >> examples in libusbgx also fail to work, and I tried that library after > >> a friend recommended it as perhaps having secret mojo. I enabled the > >> userspace debug helpers in the kernel but they do not seem to offer me > >> any insight, and there's no relevant dmesg output. > >> > >> My device is an Allwinner H2+, and the UDC seems to be the Inventra > >> Highspeed Dual Role Controller. I've also got the DesignWare USB3/USB2 > >> cores enabled from my upstream but I think they are not being loaded. > >> > >> If anyone can look I'd appreciate it, this is just a hobby project. > >> It's a good chance for me to do some kernel debugging but I'm a bit > >> lost. > >> > >> Thanks for the help so far. > >> > > > > Sorry for double post again. Alternatively, if anyone can recommend a device which they know has working ffs configfs gadget functionality, I'll just buy a board with that instead. > > Can you send me the strace log from the libusbgx example that does not > work for you? > I apologize for the anticlimax, but some minor option I changed seemed to gate the bug. It may have been that I compiled in the DWC controller's dual mode instead of leaving it as module and this claimed the UDC in some way? The DWC dual-mode was compiled in as it caused a compilation issue in an older kernel. I can now create the directory. Will get back if I can get the driver code working, the example references the linux source code in a strange way, haven't figured out how to add all headers. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-05-20 5:28 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
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).