Dear All, I have changed the way of aiming at a configurable configfs-based gadget. After Sebastian has laid the foundation for the conversion I thought of doing the conversion to configfs like this: 1) convert the functions to the new function interface from Sebastian, 2) add configfs support. I have submitted more than 50 patches which did the step 1) for all functions but hid and multimedia. The patches are here: http://www.spinics.net/lists/linux-usb/msg82418.html http://www.spinics.net/lists/linux-usb/msg83094.html For your convenience I have set up a branch which contains all of them: git://git.infradead.org/users/kmpark/linux-samsung usb-gadgdet-configfs-old But now I think it is better to think of the conversion having the perspective of old gadgets in mind. So the process would be like this: provide the equivalent of g_serial.ko, provide the equivalent of usb ethernet gadgets, provide the equivalent of g_multi.ko and so on. Here I present the conversion of everthing that is required to provide the equivalent of g_serial.ko with configfs. A branch will be available here (from 29th March 2013): git://git.infradead.org/users/kmpark/linux-samsung usb-gadget-configfs BACKWARD COMPATIBILITY ====================== Please note that the old g_serial.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_serial.ko equivalent. The old g_serial.ko during runtime provides exclusively one of the following functions: - acm - serial - obex The selection is based on the module parameters use_acm and use_obex. By default acm is used, if use_acm is false then serial is used unless use_obex is true. There is also an n_ports parameter, which controls how many ports will be created for the actually used function. With configfs the procedure is as follows, compared to the information mentioned above (*): instead of mkdir functions/acm.ttyS1 do mkdir functions/<acm|gser|obex>.<instance name> e.g. mkdir functions/obex.tty1 To achieve the equivalent of n_ports > 1 repeat the above step the desired number of times, each time using a new instance name. 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> serial) On host: insmod usbserial vendor=<vendorID> product=<productID> On host: cat > /dev/ttyUSB<X> On target: cat /dev/ttyGS<Y> then the other way round On target: cat > /dev/ttyGS<Y> On host: cat /dev/ttyUSB<X> obex) On target: seriald -f /dev/ttyGS<Y> -s 1024 On host: serialc -v <vendorID> -p <productID> -i<interface#> -a1 -s1024 \ -t<out endpoint addr> -r<in endpoint addr> where seriald and serialc are Felipe's utilities found here: https://git.gitorious.org/usb/usb-tools.git master This patch series depends on the following patches: http://www.spinics.net/lists/linux-usb/msg78752.html usb/gadget: nokia: use function framework for ACM http://www.spinics.net/lists/linux-usb/msg78733.html usb/gadget: move the global the_dev variable to their users http://www.spinics.net/lists/linux-usb/msg78734.html usb/gadget: push tty port allocation from gadget into f_acm http://www.spinics.net/lists/linux-usb/msg76388.html usb/gadget: the start of the configfs interface Andrzej Pietrasiewicz (9): usb/gadget: use consistent naming scheme for usb function modules usb/gadget: nokia: remove unused include usb/gadget: f_serial: convert to new function interface with backward compatibility usb/gadget: serial: convert to new interface of f_serial usb/gadget: f_serial: remove compatibility layer usb/gadget: f_serial: add configfs support usb/gadget: f_obex: convert to new function interface with backward compatibility usb/gadget: serial: convert to new interface of f_obex usb/gadget: f_obex: add configfs support drivers/usb/gadget/Kconfig | 8 ++ drivers/usb/gadget/Makefile | 11 ++- drivers/usb/gadget/f_obex.c | 226 ++++++++++++++++++++++++++++++++--------- drivers/usb/gadget/f_serial.c | 174 +++++++++++++++++++++++-------- drivers/usb/gadget/nokia.c | 3 +- drivers/usb/gadget/serial.c | 59 ++---------- 6 files changed, 334 insertions(+), 147 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