On Wed, Jun 08, 2016 at 04:11:11PM -0700, Caleb Crome wrote:
> 
> Here is the script I use for starting the gadget interface:
> 
> cd /sys/kernel/config/usb_gadget
> mkdir g1
> cd g1
> echo "0x1d6b" > idVendor
> echo "0x0104" > idProduct
> mkdir strings/0x409
> echo "0123456789" > strings/0x409/serialnumber
> echo "Foo Inc." > strings/0x409/manufacturer
> echo "Bar Gadget" > strings/0x409/product
> mkdir functions/uac2.aud0
> mkdir functions/ecm.usb0
> #echo 64000 > functions/uac2.aud0/c_srate
> #echo 64000 > functions/uac2.aud0/p_srate
> mkdir configs/c.1
> mkdir configs/c.1/strings/0x409
> echo "CDC ECM + audio" > configs/c.1/strings/0x409/configuration
> ln -s functions/uac2.aud0 configs/c.1
> ln -s functions/ecm.usb0 configs/c.1
> echo `ls /sys/class/udc/` > /sys/kernel/config/usb_gadget/g1/UDC
> 

Try to use below command to see if it works, it works at my i.mx6 board.

1. **** List of PLAYBACK Hardware Devices ****
root@imx6sxsabresd:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: imxspdif [imx-spdif], device 0: S/PDIF PCM Playback dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: UAC2Gadget [UAC2_Gadget], device 0: UAC2 PCM [UAC2 PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
2. **** List of CAPTURE Hardware Devices ****
root@imx6sxsabresd:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: wm8962audio [wm8962-audio], device 0: HiFi wm8962-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: UAC2Gadget [UAC2_Gadget], device 0: UAC2 PCM [UAC2 PCM]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
3. Using below command to play (it is playback, the audio file is from
PC)
root@imx6sxsabresd:~# arecord -f dat -t wav -D hw:2,0 | aplay -D hw:0,0 &

NOTE: arecord uses uac2_gadget to record, aplay uses real codec to play

> 
> When I run the script above I get the following dumped into /var/log/syslog:
> Jun  8 23:08:14 wandboard kernel: [  139.994081] using random self
> ethernet address
> Jun  8 23:08:14 wandboard kernel: [  139.994107] using random host
> ethernet address
> Jun  8 23:08:14 wandboard NetworkManager[359]:
> nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed
> Jun  8 23:08:14 wandboard NetworkManager[359]: <info>  (usb0): new
> Generic device (carrier: OFF, driver: 'g_ether', ifindex: 4)
> Jun  8 23:08:14 wandboard kernel: [  140.125255] usb0: HOST MAC
> 3e:52:2d:0d:98:fe
> Jun  8 23:08:14 wandboard kernel: [  140.153803] usb0: MAC 0e:cf:aa:06:aa:8a
> Jun  8 23:08:14 wandboard systemd-udevd[773]: Failed to apply ACL on
> /dev/snd/controlC3: Operation not supported
> Jun  8 23:08:14 wandboard systemd-udevd[776]: Failed to apply ACL on
> /dev/snd/pcmC3D0c: Operation not supported
> Jun  8 23:08:14 wandboard systemd-udevd[775]: Failed to apply ACL on
> /dev/snd/pcmC3D0p: Operation not supported
> Jun  8 23:08:14 wandboard systemd-udevd[773]: Process
> '/usr/sbin/alsactl -E HOME=/var/run/alsa restore 3' failed with exit
> code 99.
> Jun  8 23:08:14 wandboard NetworkManager[359]: <info>  devices added
> (path: 
> /sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/gadget/net/usb0,
> iface: usb0)
> Jun  8 23:08:14 wandboard NetworkManager[359]: <info>  device added
> (path: 
> /sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/gadget/net/usb0,
> iface: usb0): no ifupdown configuration found.
> 
> 
> Any idea what could be wrong?Is the 'Failed to apply ACL' relavent?

Sorry, I don't know what that mean, do that mean there is something
wrong with your local codec?

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to