[PATCH v2 0/8] Equivalent of g_ncm.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_ncm.ko with configfs.

This is the second version of the series after discussion with Alan
and Michal's review - thank you guys.

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

v1..v2:

- delayed registering a network interface until gadgets's bind
  (per Alan's request)
- created a helper macro to define USB Ethernet modules' parameters (Michal's
  review)
- fixed and simplified some helper functions (Michal's review)
- changed hostaddr variable name to host_mac in several modules
  (Michal's review)


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_ncm.ko equivalent.

The old g_ncm.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/ncm.<instance name>

e.g. mkdir functions/ncm.usb0

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

qmult
dev_addr
host_addr
ifname

and after creating the functions/ncm.<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 (actually there is just one)
==================================================

ncm)

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


Andrzej Pietrasiewicz (8):
  usb/gadget: u_ether: convert into module
  usb/gadget: rndis: convert into module
  usb/gadget: u_ether: construct with default values and add
    setters/getters
  usb/gadget: f_ncm: convert to new function interface with backward
    compatibility
  usb/gadget: ncm: convert to new function interface
  usb/gadget: f_ncm: remove compatibility layer
  usb/gadget: f_ncm: use usb_gstrings_attach
  usb/gadget: f_ncm: add configfs support

 drivers/usb/gadget/Kconfig   |   20 +++
 drivers/usb/gadget/Makefile  |    5 +
 drivers/usb/gadget/cdc2.c    |   10 +-
 drivers/usb/gadget/ether.c   |   18 ++-
 drivers/usb/gadget/f_ncm.c   |  323 +++++++++++++++++++++++++++++++++---------
 drivers/usb/gadget/g_ffs.c   |   15 ++-
 drivers/usb/gadget/multi.c   |   15 ++-
 drivers/usb/gadget/ncm.c     |   58 +++++---
 drivers/usb/gadget/nokia.c   |   11 +-
 drivers/usb/gadget/rndis.c   |   16 ++
 drivers/usb/gadget/rndis.h   |    1 +
 drivers/usb/gadget/u_ether.c |  223 ++++++++++++++++++++++++++---
 drivers/usb/gadget/u_ether.h |  155 +++++++++++++++++++-
 drivers/usb/gadget/u_ncm.h   |   35 +++++
 14 files changed, 765 insertions(+), 140 deletions(-)
 create mode 100644 drivers/usb/gadget/u_ncm.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