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

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

 



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

A branch will be available here (from 24th April 2013, afternoon UTC):
git://git.infradead.org/users/kmpark/linux-samsung usb-gadget-configfs

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

Please note that the old g_ncm.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 (*).

Here is the description specific to using g_cdc.ko equivalent.

The old g_cdc.ko provides two functions:

- acm
- ecm

which can be used simultaneously.

The acm function usage is described in (*).

For ecm the old g_cdc.ko offered three parameters:

qmult      - queue length multiplier for high/super -speed devices
dev_addr   - device's MAC address
host_addr  - host's MAC address

With configfs the procedure is as follows, compared to the information
mentioned above (*):

instead of mkdir functions/acm.ttyS1 do

mkdir functions/ecm.<instance name>

e.g. mkdir functions/ecm.usb0

In functions/ecm.<instance name> there will be the following attribute files:

qmult
dev_addr
host_addr
ifname

and after creating the functions/ecm.<instance name> they contain default
values: qmult is 5, dev_addr and host_addr are randomly selected.
Except for ifname they can be written to until the function is linked to a
configuration. The ifname is read-only and contains the name of the interface
which was assigned by the net core, e. g. usb0.

The rest of the procedure (*) remains the same.

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 host: cat > /dev/ttyACM<X>
On target: cat /dev/ttyGS<Y>

then the other way round

On target: cat > /dev/ttyGS<Y>
On host: cat /dev/ttyACM<X>

ecm)

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


Andrzej Pietrasiewicz (5):
  usb/gadget: add helpers for configfs support for USB Ethernet
  usb/gadget: f_ecm: convert to new function interface with backward
    compatibility
  usb/gadget: cdc2: convert to new interface of f_ecm
  usb/gadget: f_ecm: use usb_gstrings_attach
  usb/gadget: f_ecm: add configfs support

 drivers/usb/gadget/Kconfig            |    4 +
 drivers/usb/gadget/Makefile           |    2 +
 drivers/usb/gadget/cdc2.c             |   83 +++++++++------
 drivers/usb/gadget/ether.c            |    1 +
 drivers/usb/gadget/f_ecm.c            |  182 ++++++++++++++++++++++++++++++---
 drivers/usb/gadget/f_ncm.c            |  139 ++-----------------------
 drivers/usb/gadget/g_ffs.c            |    1 +
 drivers/usb/gadget/multi.c            |    1 +
 drivers/usb/gadget/nokia.c            |    3 +-
 drivers/usb/gadget/u_ecm.h            |   35 +++++++
 drivers/usb/gadget/u_ether_configfs.h |  164 +++++++++++++++++++++++++++++
 11 files changed, 439 insertions(+), 176 deletions(-)
 create mode 100644 drivers/usb/gadget/u_ecm.h
 create mode 100644 drivers/usb/gadget/u_ether_configfs.h

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