> You shouldn't use epX where X != 0 until you get enable event. You may
> refer to ffs-aio examples which have a suitable flag to wait for that event.

I got the ffs-aio example (simple and multibuff) to work.
I also used the ffs-aio example as a reference and tried to get the ffs-test 
example to work. So I am waiting for both events (Event BIND, Event ENABLE) 
before accessing epX where X != 0.
However I still get the same error (-19) No such device when using ffs-test 
example.

For testing I added a read()-operation to the working ffs-aio-example to make 
sure the endpoint descriptors are not faulty in ffs-test. Also here, I get the 
same error (-19).

>From my understanding, FunctionFS is the successor of GadgetFS. It provides a 
>file for each endpoint (ep0, ep1, ep2, ...). The endpoints can then be 
>accessed with read() / write() operations - please correct me if I'm wrong.

Questions remaining:
1) Why does the ffs-test example not work even when waiting for Event 
BIND/Event ENABLE before accessing epX where X != 0?
2) Is it not possible to access endpoints with read()/write()
3) if 2) is not possible, how did ffs-test ever work? How can the endpoints be 
accessed now?

> In addition I'd recommend you using libusbgx[1] instead of direct
> configfs manipulation. There is even an example which sets usb gadget
> with two instances of functionfs[2]
> 
> Footnotes:
> 1 - https://github.com/libusbgx/libusbgx
> 2 - https://github.com/libusbgx/libusbgx/blob/master/examples/gadget-ffs.c

>From my understanding using libusbgx can be used to instead of using command 
>in the CLI. Thanks for this recommendation, will definitely use it. But for 
>first testing I am meanwhile okay with setting things up manually.


Best regards

Jan Huber

________________________________________

> I'm trying to establish a high performance USB connection from device/gadget 
> to host. On the USB gadget side I'm running on a Atmel ATSAMA5D35-EK. The 
> Linux Kernel version is 4.1 (4.1.0-linux4sam_5.2-00045-g633e08a) and I'm 
> using configfs to set things up.
>
> I strictly followed the steps according to the presentations from the 
> Embedded Linux Conference 2014 (by Alan Ott and Matt Porter)
>
> Here is what I did on the USB device side so far:
>
> # insmod atmel_usba_udc.ko
> # insmod usb_f_fs.ko
>
> # mkdir -p /home/root/configfs
> # mount -t configfs none /home/root/configfs
> # mkdir -p /home/root/configfs/usb_gadget/g1
>
> # echo "0x1a0a" > /home/root/configfs/usb_gadget/g1/idVendor
> # echo "0xbadd" > /home/root/configfs/usb_gadget/g1/idProduct
>
> # mkdir -p /home/root/configfs/usb_gadget/g1/strings/0x409
> # echo "1234" > /home/root/configfs/usb_gadget/g1/strings/0x409/serialnumber
> # echo "manufacturer" > 
> /home/root/configfs/usb_gadget/g1/strings/0x409/manufacturer
> # echo "product" > /home/root/configfs/usb_gadget/g1/strings/0x409/product
>
> # mkdir -p /home/root/configfs/usb_gadget/g1/configs/c.1
> # mkdir -p /home/root/configfs/usb_gadget/g1/configs/c.1/strings/0x409
> # echo "Config1" > 
> /home/root/configfs/usb_gadget/g1/configs/c.1/strings/0x409/configuration
>
> # mkdir -p /home/root/configfs/usb_gadget/g1/functions/ffs.usb0
> # ln -s /home/root/configfs/usb_gadget/g1/functions/ffs.usb0 
> /home/root/configfs/usb_gadget/g1/configs/c.1
>
> # mkdir -p /home/root/ffs
> # mount usb0 /home/root/ffs -t functionfs
>
> # cd /home/root/ffs
> # ../ffs-test 64 &
>
> Setting up the device and functionfs works perfectly fine, but when executing 
> the ffs-test I get the following log messages:
>
> ffs-test: info: ep0: writing descriptors (in v2 format)
> ffs-test: info: ep0: writing strings
> ffs-test: dbg:  ep1: starting
> ffs-test: dbg:  ep2: starting
> ffs-test: info: ep0: starts
> ffs-test: info: ep2: starts
> ffs-test: info: ep1: starts
> ffs-test: warn: ep1: write: (-19) No such device
> ffs-test: warn: ep2: read: (-19) No such device
> ffs-test: info: ep1: ends
> ffs-test: info: ep2: ends
> Event BIND
> Event ENABLE
>

You shouldn't use epX where X != 0 until you get enable event. You may
refer to ffs-aio examples which have a suitable flag to wait for that event.

In addition I'd recommend you using libusbgx[1] instead of direct
configfs manipulation. There is even an example which sets usb gadget
with two instances of functionfs[2]

Footnotes:
1 - https://github.com/libusbgx/libusbgx
2 - https://github.com/libusbgx/libusbgx/blob/master/examples/gadget-ffs.c

Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to