usb: gadget: configfs: uvc and mass storage on single udc?

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

 



Hello experts,

I'm trying to implement two functions on single udc configuration i.e
uvc device class and mass storage. individually it is working fine but
coming to multi role it is failing.

kernel 4.4:

mount -t debugfs debugfs /mnt/
echo "device" > /mnt/488d0000.usb/mode
modprobe -v configfs
modprobe -v libcomposite
sleep 2
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 "TI Inc." > strings/0x409/manufacturer
echo "MS+UVC gadget" > strings/0x409/product
modprobe -v usb_f_mass_storage
mkdir functions/mass_storage.ms0
# create backing store(s): in this example 2 LUN's 16MB each
dd bs=1M count=16 if=/dev/zero of=/tmp/lun0.img # 16MB
chmod 777 /tmp/lun0.img
modprobe -v usb_f_uvc
mkdir functions/uvc.usb0
mkdir configs/c.1
mkdir configs/c.1/strings/0x409
echo "mass-storage + uvc" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower
mkdir functions/uvc.usb0/control/header/h
cd functions/uvc.usb0/control/
ln -s header/h class/fs
ln -s header/h class/ss
cd ../../../
mkdir -p functions/uvc.usb0/streaming/uncompressed/u/360p
cat <<EOF > functions/uvc.usb0/streaming/uncompressed/u/360p/dwFrameInterval
666666
1000000
5000000
EOF
mkdir functions/uvc.usb0/streaming/header/h
cd functions/uvc.usb0/streaming/header/h
ln -s ../../uncompressed/u
cd ../../class/fs
ln -s ../../header/h
cd ../../class/hs
ln -s ../../header/h
cd ../../../control
cd ../../../
echo /tmp/lun0.img > functions/mass_storage.ms0/lun.0/file
echo 1 > functions/mass_storage.ms0/lun.0/removable
ln -s functions/mass_storage.ms0 configs/c.1/
ln -s functions/uvc.usb0 configs/c.1/
echo "488d0000.usb" > UDC

=====================
dmesg:
=====================
insmod /lib/modules/4.4.23/kernel/fs/configfs/configfs.ko
insmod /lib/modules/4.4.23/kernel/drivers/usb/gadget/libcomposite.ko
insmod /lib/modules/4.4.23/kernel/drivers/usb/gadget/function/usb_f_mass_storage.ko
[   58.376548] Mass Storage Function, version: 2009/09/11
[   58.381720] LUN: removable file: (no medium)
16+0 records in
16+0 records out
insmod /lib/modules/4.4.23/kernel/drivers/media/v4l2-core/videobuf2-vmalloc.ko
insmod /lib/modules/4.4.23/kernel/drivers/usb/gadget/function/usb_f_uvc.ko
[   58.525130] configfs-gadget gadget: uvc_function_bind


# modprobe vivid

# ./uvc-gadget -u /dev/video0 -v /dev/video1
V4L2 device is vivid on bus platform:vivid-000
V4L2: Getting current format: YUYV 640x360
V4L2: Setting format to: YUYV 640x360
V4L2: Getting current format: YUYV 640x360
v4l2 open succeeded, file descriptor = 3
uvc device is dwc3-gadget on bus gadget
uvc open succeeded, file descriptor = 4
V4L2: Buffer 0 mapped at address 0xb6e26000.
V4L2: Buffer 1 mapped at address 0xb6db5000.
V4L2: 2 buffers allocated.
[  267.245560] configfs-gadget gadget: uvc_function_disable
[  267.492271] configfs-gadget gadget: high-speed config #1: c
[  267.497885] configfs-gadget gadget: uvc_function_set_alt(1, 0)
[  267.503742] configfs-gadget gadget: reset UVC Control
[  267.508822] configfs-gadget gadget: uvc_function_set_alt(2, 0)
[  267.516769] configfs-gadget gadget: uvc_function_set_alt(2, 0)

=====================================
Host side
=======================================
[105697.232059] usb 1-3: new high-speed USB device number 91 using ehci-pci
[105697.366556] usb 1-3: New USB device found, idVendor=1d6b, idProduct=0104
[105697.366563] usb 1-3: New USB device strings: Mfr=1, Product=2,
SerialNumber=3
[105697.366567] usb 1-3: Product: MS+UVC gadget
[105697.366571] usb 1-3: Manufacturer: TI Inc.
[105697.366574] usb 1-3: SerialNumber: 0123456789
[105697.390430] usb-storage 1-3:1.0: USB Mass Storage device detected
[105697.390625] scsi11 : usb-storage 1-3:1.0
[105697.391255] uvcvideo: Found UVC 1.00 device MS+UVC gadget (1d6b:0104)
[105697.400076] uvcvideo: UVC non compliance - GET_DEF(PROBE) not
supported. Enabling workaround.
[105697.400573] uvcvideo: Failed to query (129) UVC probe control :
-32 (exp. 26).
[105697.400582] uvcvideo: Failed to initialize the device (-5).
[105698.389100] scsi 11:0:0:0: Direct-Access     Linux    File-Stor
Gadget 0404 PQ: 0 ANSI: 2
[105698.389676] sd 11:0:0:0: Attached scsi generic sg2 type 0
[105698.390850] sd 11:0:0:0: [sdb] 32768 512-byte logical blocks:
(16.7 MB/16.0 MiB)
[105698.391539] sd 11:0:0:0: [sdb] Write Protect is off
[105698.391550] sd 11:0:0:0: [sdb] Mode Sense: 0f 00 00 00
[105698.392557] sd 11:0:0:0: [sdb] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
[105698.403242]  sdb: unknown partition table
[105698.409739] sd 11:0:0:0: [sdb] Attached SCSI removable disk

Can anybody tell what i have missed, first is it possible have uvc + ms.

regards,
Ganesh Biradar
--
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