2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 20:23:57 +08:00
linux-next/drivers/usb/gadget
Sebastian Andrzej Siewior 88af8bbe4e usb: gadget: the start of the configfs interface
|# modprobe dummy_hcd num=2
|# modprobe libcomposite

|# lsmod
|Module                  Size  Used by
|libcomposite           31648  0
|dummy_hcd              19871  0

|# mkdir /sys/kernel/config/usb_gadget/oha
|# cd /sys/kernel/config/usb_gadget/oha
|# mkdir configs/def.1
|# mkdir configs/def.2
|# mkdir functions/acm.ttyS1
|# mkdir strings/0x1
|mkdir: cannot create directory `strings/0x1': Invalid argument
|# mkdir strings/0x409
|# mkdir strings/1033
|mkdir: cannot create directory `strings/1033': File exists
|# mkdir strings/1032
|# mkdir configs/def.1/strings/0x409
|# mkdir configs/def.2/strings/0x409

|#find . -ls
|   975    0 drwxr-xr-x   5 root     root            0 Dec 23 17:40 .
|   978    0 drwxr-xr-x   4 root     root            0 Dec 23 17:43 ./strings
|  4100    0 drwxr-xr-x   2 root     root            0 Dec 23 17:43 ./strings/1032
|   995    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/serialnumber
|   996    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/product
|   997    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/manufacturer
|  2002    0 drwxr-xr-x   2 root     root            0 Dec 23 17:41 ./strings/0x409
|   998    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/serialnumber
|   999    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/product
|  1000    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/manufacturer
|   977    0 drwxr-xr-x   4 root     root            0 Dec 23 17:41 ./configs
|  4081    0 drwxr-xr-x   3 root     root            0 Dec 23 17:41 ./configs/def.2
|  4082    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.2/strings
|  2016    0 drwxr-xr-x   2 root     root            0 Dec 23 17:42 ./configs/def.2/strings/0x409
|  1001    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/strings/0x409/configuration
|  1002    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/bmAttributes
|  1003    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/MaxPower
|   979    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.1
|   980    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.1/strings
|  5122    0 drwxr-xr-x   2 root     root            0 Dec 23 17:42 ./configs/def.1/strings/0x409
|  1004    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/strings/0x409/configuration
|  1005    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/bmAttributes
|  1006    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/MaxPower
|   976    0 drwxr-xr-x   3 root     root            0 Dec 23 17:41 ./functions
|   981    0 drwxr-xr-x   2 root     root            0 Dec 23 17:41 ./functions/acm.ttyS1
|  1007    0 -r--r--r--   1 root     root         4096 Dec 23 17:43 ./functions/acm.ttyS1/port_num
|  1008    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./UDC
|  1009    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bcdUSB
|  1010    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bcdDevice
|  1011    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./idProduct
|  1012    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./idVendor
|  1013    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bMaxPacketSize0
|  1014    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceProtocol
|  1015    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceSubClass
|  1016    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceClass

|# cat functions/acm.ttyS1/port_num
|0
|# ls -lah /dev/ttyGS*
|crw-rw---T 1 root dialout 252, 0 Dec 23 17:41 /dev/ttyGS0
|
|# echo 0x1234 > idProduct
|# echo 0xabcd > idVendor
|# echo 1122 > strings/0x409/serialnumber
|# echo "The manufacturer" > strings/0x409/manufacturer
|# echo 1 > strings/1032/manufacturer
|# echo 1sa > strings/1032/product
|# echo tada > strings/1032/serialnumber
|echo "Primary configuration" > configs/def.1/strings/0x409/configuration
|# echo "Secondary configuration" > configs/def.2/strings/0x409/configuration
|# ln -s functions/acm.ttyS1 configs/def.1/
|# ln -s functions/acm.ttyS1 configs/def.2/
|find configs/def.1/ -ls
|   979    0 drwxr-xr-x   3 root     root            0 Dec 23 17:49 configs/def.1/
|  6264    0 lrwxrwxrwx   1 root     root            0 Dec 23 17:48 configs/def.1/acm.ttyS1 -> ../../../../usb_gadget/oha/functions/acm.ttyS1
|   980    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 configs/def.1/strings
|  5122    0 drwxr-xr-x   2 root     root            0 Dec 23 17:49 configs/def.1/strings/0x409
|  6284    0 -rw-r--r--   1 root     root         4096 Dec 23 17:47 configs/def.1/strings/0x409/configuration
|  6285    0 -rw-r--r--   1 root     root         4096 Dec 23 17:49 configs/def.1/bmAttributes
|  6286    0 -rw-r--r--   1 root     root         4096 Dec 23 17:49 configs/def.1/MaxPower
|
|echo 120 > configs/def.1/MaxPower
|
|# ls -lh /sys/class/udc/
|total 0
|lrwxrwxrwx 1 root root 0 Dec 23 17:50 dummy_udc.0 -> ../../devices/platform/dummy_udc.0/udc/dummy_udc.0
|lrwxrwxrwx 1 root root 0 Dec 23 17:50 dummy_udc.1 -> ../../devices/platform/dummy_udc.1/udc/dummy_udc.1
|# echo dummy_udc.0 > UDC
|# lsusb
|Bus 001 Device 002: ID abcd:1234 Unknown
|
|lsusb -d abcd:1234 -v
|Device Descriptor:
…
|  idVendor           0xabcd Unknown
|  idProduct          0x1234
|  bcdDevice            3.06
|  iManufacturer           1 The manufacturer
|  iProduct                2
|  iSerial                 3 1122
|  bNumConfigurations      2
…
|echo "" > UDC

v5…v6
- wired up strings with usb_gstrings_attach()
- add UDC attribe. Write "udc-name" will bind the gadget. Write an empty
  string (it should contain \n since 0 bytes write get optimzed away)
  will unbind the UDC from the gadget. The name of available UDCs can be
  obtained from /sys/class/udc/

v4…v5
- string rework. This will add a strings folder incl. language code like
    strings/409/manufacturer
  as suggested by Alan.
- rebased ontop reworked functions.c which has usb_function_instance
  which is used prior after "mkdir acm.instance" and can be directly
  used for configuration via configfs.

v3…v4
 - moved functions from the root folde down to the gadget as suggested
   by Michał
 - configs have now their own configs folder as suggested by Michał.
   The folder is still name.bConfigurationValue where name becomes the
   sConfiguration. Is this usefull should we just stilc
   configs/bConfigurationValue/ ?
 - added configfs support to the ACM function. The port_num attribute is
   exported by f_acm. An argument has been added to the USB alloc
   function to distinguish between "old" (use facm_configure() to
   configure and configfs interface (expose a config_node).
   The port_num is currently a dumb counter. It will
   require some function re-work to make it work.

scheduled for v5:
- sym linking function into config.

v2…v3
- replaced one ifndef by ifdef as suggested by Micahał
- strstr()/strchr() function_make as suggested by Micahł
- replace [iSerialNumber|iProduct|iManufacturer] with
  [sSerialNumber|sProduct|sManufacturer] as suggested by Alan
- added creation of config descriptors

v1…v2
- moved gadgets from configfs' root directory into /udcs/ within our
  "usb_gadget" folder. Requested by Andrzej & Michał
- use a dot as a delimiter between function's name and its instance's name
  as suggested by Michał
- renamed all config_item_type, configfs_group_operations, make_group,
  drop_item as suggested by suggested by Andrzej to remain consisten
  within this file and within other configfs users
- Since configfs.c and functions.c are now part of the udc-core module,
  the module itself is now called udc. Also added a tiny ifdef around
  init code becuase udc-core is subsys init and this is too early for
  configfs in the built-in case. In the module case, we can only have
  one init function.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-04-03 14:43:32 +03:00
..
acm_ms.c usb: gadget: push tty port allocation from gadget into f_acm 2013-04-03 14:43:31 +03:00
amd5536udc.c usb: gadget: amd5536udc: don't assign gadget.dev.release directly 2013-03-18 11:17:46 +02:00
amd5536udc.h usb: gadget: amd5536udc: remove unused structure member 2013-03-18 11:16:56 +02:00
at91_udc.c usb: gadget: at91_udc: don't touch gadget.dev.driver 2013-03-18 11:17:32 +02:00
at91_udc.h
atmel_usba_udc.c usb: gadget: atmel_usba_udc: don't touch gadget.dev.driver 2013-03-18 11:17:33 +02:00
atmel_usba_udc.h usb: gadget: atmel: remove unused DMA_ADDR_INVALID 2013-03-18 11:18:11 +02:00
audio.c usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
bcm63xx_udc.c usb: gadget: bcm63xx_udc: don't assign gadget.dev.release directly 2013-03-18 11:17:46 +02:00
cdc2.c usb: gadget: push tty port allocation from gadget into f_acm 2013-04-03 14:43:31 +03:00
composite.c usb: gadget: the start of the configfs interface 2013-04-03 14:43:32 +03:00
config.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
configfs.c usb: gadget: the start of the configfs interface 2013-04-03 14:43:32 +03:00
dbgp.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
dummy_hcd.c usb: gadget: dummy: fix sparse warning 2013-03-27 13:18:58 +02:00
epautoconf.c usb: gadget: libcomposite: add epautoconf.c to libcomposite 2012-09-10 15:37:51 +03:00
ether.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_acm.c usb: gadget: the start of the configfs interface 2013-04-03 14:43:32 +03:00
f_ecm.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_eem.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_fs.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
f_hid.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_loopback.c usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
f_mass_storage.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
f_midi.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_ncm.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_obex.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
f_phonet.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_rndis.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_serial.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
f_sourcesink.c usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
f_subset.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
f_uac1.c usb: gadget: f_uac1: silence an info leak warning 2013-03-04 13:13:58 +02:00
f_uac2.c usb: gadget: f_uac2: fix compile warning 2013-01-21 20:52:49 +02:00
f_uvc.c usb: gadget: uvc: Delay the status stage when setting alternate setting 1 2013-03-18 11:18:21 +02:00
f_uvc.h usb: gadget: uvc: Fix coding style issues introduced by SS support 2013-03-18 11:18:18 +02:00
fsl_mxc_udc.c usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap 2013-01-18 14:08:21 +02:00
fsl_qe_udc.c usb: gadget: fsl_qe_udc: don't assign gadget.dev.release directly 2013-03-18 11:17:47 +02:00
fsl_qe_udc.h usb: gadget: Complete fsl qe/udc driver conversion 2012-06-12 13:32:29 +03:00
fsl_udc_core.c usb: gadget: fsl_udc_core: Use module_platform_driver_probe macro 2013-03-18 11:18:00 +02:00
fsl_usb2_udc.h usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap 2013-01-18 14:08:21 +02:00
functions.c usb: gadget: add a forward pointer from usb_function to its "instance" 2013-01-21 20:52:46 +02:00
fusb300_udc.c usb: gadget: fusb300_udc: bug fix of not doing idma reset for each time 2013-04-02 16:58:39 +03:00
fusb300_udc.h usb: gadget: fusb300_udc: add FUSB300_EPSET0_STL_CLR for clearing EP0 stall 2013-04-02 16:57:24 +03:00
g_ffs.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
g_zero.h usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
gadget_chips.h usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
gmidi.c usb: gadget: consider link speed for bMaxPower 2013-01-10 12:38:52 +02:00
goku_udc.c usb: gadget: goku_udc: don't assign gadget.dev.release directly 2013-03-18 11:17:49 +02:00
goku_udc.h usb: gadget: goku_udc: let udc-core manage gadget->dev 2013-03-18 11:16:45 +02:00
hid.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
imx_udc.c usb: gadget: imx_udc: don't touch gadget.dev.driver 2013-03-18 11:17:36 +02:00
imx_udc.h
inode.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
Kconfig usb: gadget: the start of the configfs interface 2013-04-03 14:43:32 +03:00
lpc32xx_udc.c usb: gadget: lpc32xx_udc: don't touch gadget.dev.driver 2013-03-18 11:17:37 +02:00
m66592-udc.c usb: gadget: m66592-udc: don't assign gadget.dev.release directly 2013-03-18 11:17:49 +02:00
m66592-udc.h usb: gadget: m66592-udc: convert to udc_start/udc_stop 2013-01-24 21:11:29 +02:00
Makefile usb: gadget: the start of the configfs interface 2013-04-03 14:43:32 +03:00
mass_storage.c usb: gadget: libcomposite: move composite.c into libcomposite 2012-09-10 16:13:03 +03:00
multi.c usb: gadget: push tty port allocation from gadget into f_acm 2013-04-03 14:43:31 +03:00
mv_u3d_core.c usb: gadget: mv_u3d_core: remove unused clock 2013-04-02 11:42:47 +03:00
mv_u3d.h usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip. 2012-06-22 13:08:21 +03:00
mv_udc_core.c usb: gadget: mv_udc_core: remove unused clock 2013-04-02 11:42:45 +03:00
mv_udc.h usb: gadget: mv_udc_core: remove unused clock 2013-04-02 11:42:45 +03:00
ncm.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
ndis.h
net2272.c usb: gadget: net2272: fix sparse warnings 2013-03-27 13:18:57 +02:00
net2272.h
net2280.c usb: gadget: net2280: fix sparse warnings 2013-03-27 13:18:58 +02:00
net2280.h
nokia.c usb: gadget: push tty port allocation from gadget into f_acm 2013-04-03 14:43:31 +03:00
omap_udc.c usb: gadget: omap_udc: don't assign gadget.dev.release directly 2013-03-18 11:17:53 +02:00
omap_udc.h
pch_udc.c usb: gadget: pch_udc: fix sparse warnings 2013-03-27 13:18:59 +02:00
printer.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
pxa25x_udc.c usb: gadget: pxa25x_udc: don't touch gadget.dev.driver 2013-03-18 11:17:41 +02:00
pxa25x_udc.h usb: gadget: pxa25x_udc: convert to udc_start/udc_stop 2013-01-24 21:11:31 +02:00
pxa27x_udc.c usb: gadget: pxa27x_udc: fix Section Mismatches 2013-04-02 17:13:40 +03:00
pxa27x_udc.h usb: gadget: pxa27x_udc: convert to udc_start/udc_stop 2013-01-24 21:11:31 +02:00
r8a66597-udc.c usb: gadget: r8a66597-udc: don't assign gadget.dev.release directly 2013-03-18 11:17:54 +02:00
r8a66597-udc.h gadget/r8a66597: remove conditional compilation of clk code 2012-07-30 17:25:12 -07:00
rndis.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
rndis.h
s3c2410_udc.c usb: gadget: s3c2410_udc: don't touch gadget.dev.driver 2013-03-18 11:17:43 +02:00
s3c2410_udc.h usb: gadget: s3c2410: convert to udc_start/udc_stop 2013-01-24 21:11:32 +02:00
s3c-hsotg.c usb: gadget: s3c-hsotg: fix PHY error handling 2013-03-18 11:18:29 +02:00
s3c-hsotg.h
s3c-hsudc.c usb: gadget: s3c-hsudc: delete outdated comment 2013-03-18 11:18:10 +02:00
serial.c usb: gadget: push tty port allocation from gadget into f_acm 2013-04-03 14:43:31 +03:00
storage_common.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
tcm_usb_gadget.c usb: gadget: tcm_usb_gadge: fix to return error or 0 in tcm_usbg_drop_nexus() 2012-12-13 12:04:00 +02:00
tcm_usb_gadget.h usb: gadget: make sure each gadget is using same index for Product, Serial,… 2012-09-10 16:13:00 +03:00
u_ether.c usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
u_ether.h usb: gadget: move the global the_dev variable to their users 2013-04-03 14:43:31 +03:00
u_phonet.h
u_serial.c tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
u_serial.h usb: gadget: nokia: use function framework for ACM 2013-04-03 14:43:20 +03:00
u_uac1.c usb: gadget: u_uac1: NULL dereference on error path 2013-03-04 13:16:45 +02:00
u_uac1.h
udc-core.c usb: gadget: udc-core: prevent a memory leak 2013-04-02 17:07:06 +03:00
usbstring.c usb: gadget: libcomposite: move MODULE_VERSION to composite.c 2012-09-10 16:13:03 +03:00
uvc_queue.c usb: gadget/uvc: Add support for 'get_unmapped_area' for MMUless architectures 2013-04-02 11:42:49 +03:00
uvc_queue.h usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework 2013-04-02 11:42:48 +03:00
uvc_v4l2.c usb: gadget/uvc: Add support for 'get_unmapped_area' for MMUless architectures 2013-04-02 11:42:49 +03:00
uvc_video.c usb: gadget/uvc: Port UVC webcam gadget to use videobuf2 framework 2013-04-02 11:42:48 +03:00
uvc.h usb: gadget: uvc: Delay the status stage when setting alternate setting 1 2013-03-18 11:18:21 +02:00
webcam.c usb: gadget: consider link speed for bMaxPower 2013-01-10 12:38:52 +02:00
zero.c usb: gadget: fix two sparse warnings 2013-01-21 20:52:49 +02:00