[PATCH v4 0/5] Equivalent of g_multi.ko with configfs

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

 



Here I present the conversion of everything that is required to provide
the equivalent of g_multi.ko with configfs.

v1..v2:

- removed the cause of Felipe returning -ENOLOG
- moved fsg_common_set_sysfs invocation after the lun number is set, so that
the latter operation does not try freeing nonexistent sysfs entries
- adapted to earlier changes in multi.c (*_do_config)

v2..v3:

- rebased onto 3.12-rc1

v3..v4:

- rebased onto Felipe's "testing" (3.12-rc3)

A branch 'usb-gadget-configfs-3.12' is available at:
git://git.linaro.org/people/mszyprowski/linux-srpol.git

This series depends on a [PATCH v3] Equivalent of g_acm_ms with configfs,
which has just been sent.

BACKWARD COMPATIBILITY
======================

Please note that the old g_multi.ko is still available and works.


USING THE NEW "GADGET"
======================

Please refer to this post:

http://www.spinics.net/lists/linux-usb/msg76388.html

for general information from Sebastian on how to use configfs-based
gadgets (*).

The g_multi.ko provides 4 functions:

- acm (described in (*))
- ecm (http://www.spinics.net/lists/linux-usb/msg86561.html)
- rndis (http://www.spinics.net/lists/linux-usb/msg86561.html)
- mass storage (described in a series preceding the current one,
  I will reply to this post to send a link when spinics or gmane
  has indexed the series in question)

and using all of them with configfs has already been described.

The procedure of setting up a new "multi" gadget with configfs is given
below with an example:

$ modprobe libcomposite

$ mount none cfg -t configfs

$ mkdir cfg/usb_gadget/g1
$ cd cfg/usb_gadget/g1

$ echo 0x0106 > idProduct
$ echo 0x04e8 > idVendor
$ mkdir strings/0x409
$ echo my-serial-num > strings/0x409/serialnumber
$ echo my-manufacturer > strings/0x409/manufacturer
$ echo "Multi Gadget" > strings/0x409/product

$ mkdir configs/c.1
$ echo 120 > configs/c.1/MaxPower
$ mkdir configs/c.1/strings/0x409
$ echo "Conf 1" > configs/c.1/strings/0x409/configuration

$ mkdir configs/c.2
$ echo 120 > configs/c.2/MaxPower
$ mkdir configs/c.2/strings/0x409
$ echo "Conf 2" > configs/c.2/strings/0x409/configuration

$ mkdir functions/mass_storage.0
$ echo /root/lun0.img > functions/mass_storage.0/lun.0/file
$ mkdir functions/mass_storage.0/lun.1
$ echo /root/lun1.img > functions/mass_storage.0/lun.1/file

$ mkdir functions/acm.0
$ mkdir functions/ecm.0
$ mkdir functions/rndis.0

$ ln -s functions/rndis.0 configs/c.1
$ ln -s functions/acm.0 configs/c.1
$ ln -s functions/mass_storage.0 configs/c.1

$ ln -s functions/ecm.0 configs/c.2
$ ln -s functions/acm.0 configs/c.2
$ ln -s functions/mass_storage.0 configs/c.2


After unbinding the gadget with echo "" > UDC
the symbolic links in the configuration directory can be removed,
the strings/* subdirectories in the configuration directory can
be removed, the strings/* subdirectories at the gadget level can
be removed and the configs/* subdirectories can be removed.
The functions/* subdirectories can be removed.
After that the gadget directory can be removed.
After that the respective modules can be unloaded.


TESTING THE FUNCTIONS
====================

acm)

On the host:

cat > /dev/ttyACM0

On the device:

cat /dev/ttyGS0

and then the other way round:

cat > /dev/ttyGS0

cat /dev/ttyACM0

mass storage)

device: connect the gadget, enable it
host: dmesg, see the USB drives appear (if system configured to automatically
mount)

ecm, rndis)

On the device: ping <host's IP>
On the host: ping <device's IP>



Andrzej Pietrasiewicz (5):
  usb/gadget: multi: convert to new interface of f_ecm
  usb/gadget: multi: convert to new interface of f_rndis
  usb/gadget: multi: convert to new interface of f_mass_storage
  usb/gadget: f_mass_storage: remove compatibility layer
  usb/gadget: mass_storage: merge usb_f_mass_storage module with u_ms
    module

 drivers/usb/gadget/Kconfig          |   12 +--
 drivers/usb/gadget/Makefile         |    4 +-
 drivers/usb/gadget/f_mass_storage.c |  154 +----------------------
 drivers/usb/gadget/f_mass_storage.h |   21 ---
 drivers/usb/gadget/multi.c          |  237 +++++++++++++++++++++++++++--------
 5 files changed, 190 insertions(+), 238 deletions(-)

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