[PATCH v2 0/1] Equivalent of g_acm_ms.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_acm_ms.ko with configfs.

In fact this series consists of just one patch; everything required to provide
the equivalent of g_acm_ms.ko with configfs has been done in the series related
to the g_mass_storage.ko. The current series just moves the g_acm_ms to the
new function interface of f_mass_storage.

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

A branch will be available here from 31st July:
git://git.infradead.org/users/kmpark/linux-samsung usb-gadget-configfs

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

Please note that the old g_acm_ms.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_acm_ms.ko provides 2 functions:

- acm (described in (*))
- 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)


The procedure of setting up such a 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-number > strings/0x409/serialnumber
$ echo my-manufacturer > strings/0x409/manufacturer
$ echo "ACM/MS 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 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.usb0

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

$ echo s3c-hsotg > UDC

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)



Andrzej Pietrasiewicz (1):
  usb/gadget: acm_ms: convert to new interface of f_mass_storage

 drivers/usb/gadget/Kconfig  |    1 +
 drivers/usb/gadget/acm_ms.c |  113 ++++++++++++++++++++++++++++---------------
 2 files changed, 75 insertions(+), 39 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