您尚未登录。

楼主 #1 2019-09-19 23:23:47

firstman
会员
注册时间: 2019-04-06
已发帖子: 279
积分: 279

V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

# modprobe g_webcam
[   13.884493] g_webcam gadget: uvc: uvc_function_bind()
[   13.889574] g_webcam gadget: uvc: Unable to allocate streaming EP
[   13.895850] g_webcam musb-hdrc.1.auto: failed to start g_webcam: -22
[   13.905209] g_webcam gadget: uvc: uvc_function_bind()
[   13.910284] g_webcam gadget: uvc: Unable to allocate streaming EP
[   13.916566] g_webcam musb-hdrc.1.auto: failed to start g_webcam: -22
modprobe: can't load module g_webcam (kernel/drivers/usb/gadget/legacy/g_webcam.ko): Invalid argument

发现 HI3518 也有一模一样的问题 http://bbs.ebaina.com/thread-39433-1-1.html

离线

楼主 #2 2019-09-19 23:28:37

firstman
会员
注册时间: 2019-04-06
已发帖子: 279
积分: 279

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://devtalk.nvidia.com/default/topic/1036885/tx1-usb-uvc-gadget-troubles/

问题:
TX1的OTG端口是否支持等时模式?
是否有不同的方法来配置系统以解决此错误?
我可以提供其他日志/信息,以便更容易调试吗?

在设备模式下,OTG端口不支持等时模式。

看来有点悲剧了

离线

楼主 #3 2019-09-19 23:35:07

firstman
会员
注册时间: 2019-04-06
已发帖子: 279
积分: 279

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

不知道这个补丁有没有用哦: https://gitlab-beta.engr.illinois.edu/ejclark2/linux/commit/f82a689faeb328ba7c194782f42cc438519d508e

		musb_writew(hw_ep->regs, MUSB_RXCSR, val);

#ifdef CONFIG_USB_INVENTRA_DMA
		if (usb_pipeisoc(pipe)) {
			struct usb_iso_packet_descriptor *d;

			d = urb->iso_frame_desc + qh->iso_idx;
			d->actual_length = xfer_len;

			/* even if there was an error, we did the dma
			 * for iso_frame_desc->length
			 */
			if (d->status != EILSEQ && d->status != -EOVERFLOW)
				d->status = 0;

			if (++qh->iso_idx >= urb->number_of_packets)
				done = true;
			else
				done = false;

		} else  {
		/* done if urb buffer is full or short packet is recd */
		done = (urb->actual_length + xfer_len >=
				urb->transfer_buffer_length
			|| dma->actual_len < qh->maxpacket);
		}

		/* send IN token for next packet, without AUTOREQ */
		if (!done) {
		if (dma) {
			struct dma_controller	*c;
			u16			rx_count;
			int			ret;
			int			ret, length;
			dma_addr_t		buf;

			rx_count = musb_readw(epio, MUSB_RXCOUNT);


			c = musb->dma_controller;

			if (usb_pipeisoc(pipe)) {
				int status = 0;
				struct usb_iso_packet_descriptor *d;

				d = urb->iso_frame_desc + qh->iso_idx;

				if (iso_err) {
					status = -EILSEQ;
					urb->error_count++;
				}
				if (rx_count > d->length) {
					if (status == 0) {
						status = -EOVERFLOW;
						urb->error_count++;
					}
					DBG(2, "** OVERFLOW %d into %d\n",\
					    rx_count, d->length);

					length = d->length;
				} else
					length = rx_count;
				d->status = status;
				buf = urb->transfer_dma + d->offset;
			} else {
				length = rx_count;
				buf = urb->transfer_dma +
						urb->actual_length;
			}

			dma->desired_mode = 0;
#ifdef USE_MODE1
			/* because of the issue below, mode 1 will
						urb->actual_length)
					> qh->maxpacket)
				dma->desired_mode = 1;
			if (rx_count < hw_ep->max_packet_sz_rx) {
				length = rx_count;
				dma->bDesiredMode = 0;
			} else {
				length = urb->transfer_buffer_length;
			}
#endif

/* Disadvantage of using mode 1:
			 */
			ret = c->channel_program(
				dma, qh->maxpacket,
				dma->desired_mode,
				urb->transfer_dma
					+ urb->actual_length,
				(dma->desired_mode == 0)
					? rx_count
					: urb->transfer_buffer_length);
				dma->desired_mode, buf, length);

			if (!ret) {
				c->channel_release(dma);
		}
	}

	if (dma && usb_pipeisoc(pipe)) {
		struct usb_iso_packet_descriptor	*d;
		int					iso_stat = status;

		d = urb->iso_frame_desc + qh->iso_idx;
		d->actual_length += xfer_len;
		if (iso_err) {
			iso_stat = -EILSEQ;
			urb->error_count++;
		}
		d->status = iso_stat;
	}

finish:
	urb->actual_length += xfer_len;
	qh->offset += xfer_len;

离线

楼主 #4 2019-09-19 23:36:15

firstman
会员
注册时间: 2019-04-06
已发帖子: 279
积分: 279

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://linux-sunxi.org/USB_OTG_Controller_Register_Guide

Supports up to 5 user configurable endpoints for bulk, isochronous, control, and interrupt bi-directional transfers

离线

楼主 #5 2019-09-20 08:59:57

firstman
会员
注册时间: 2019-04-06
已发帖子: 279
积分: 279

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

http://davinci-linux-open-source.1494791.n2.nabble.com/DM365-uvc-gadget-td5992168.html

对USB协议没有研究, 这个问题太难了,等大神帮我填坑,或者以后再说吧

离线

#6 2020-10-03 19:18:29

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

启动文件: /etc/init.d/S99uvc

mount -t configfs none /sys/kernel/config

mkdir /sys/kernel/config/usb_gadget/g1
cd /sys/kernel/config/usb_gadget/g1
mkdir configs/c.1
mkdir strings/0x409
mkdir configs/c.1/strings/0x409
echo 0x3290 > idProduct
echo 0x18ec > idVendor
echo 0x0310 > bcdUSB
echo serial > strings/0x409/serialnumber
echo manufacturer > strings/0x409/manufacturer
echo UVC Gadget > strings/0x409/product
echo "Conf 1" > configs/c.1/strings/0x409/configuration
echo 120 > configs/c.1/MaxPower
mkdir functions/uvc.usb0
mkdir -p functions/uvc.usb0/streaming/uncompressed/u/480p
cat <<EOF > functions/uvc.usb0/streaming/uncompressed/u/480p/dwFrameInterval
333333
1000000
5000000
EOF
echo 480 > functions/uvc.usb0/streaming/uncompressed/u/480p/wHeight
echo 333333 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwDefaultFrameInterval
echo 614400 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMaxVideoFrameBufferSize
echo 73728000 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMaxBitRate
echo 24576000 > functions/uvc.usb0/streaming/uncompressed/u/480p/dwMinBitRate
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 ../../class/ss
ln -s ../../header/h
cd ../../../control
mkdir header/h
ln -s header/h class/fs
ln -s header/h class/hs
ln -s header/h class/ss
cd /sys/kernel/config/usb_gadget/g1
echo 1024 > functions/uvc.usb0/streaming_maxpacket
echo 15 > functions/uvc.usb0/streaming_maxburst
ln -s functions/uvc.usb0 configs/c.1

ls /sys/class/udc/ > /sys/kernel/config/usb_gadget/g1/UDC

/etc/init.d/S99uvc
ln: class/hs: Operation not permitted
[  342.174711] configfs-gadget gadget: uvc: uvc_function_bind()
[  342.180408] configfs-gadget gadget: uvc: Unable to allocate streaming EP
[  342.187336] configfs-gadget musb-hdrc.1.auto: failed to start g1: -22


请问楼主解决了吗?我的也是一样的问题.

离线

#7 2020-10-03 19:24:35

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://forum.pine64.org/printthread.php?tid=6227

RE: Problem setting Pine64 as a USB device - martin357 - 07-02-2018

Thank you for your response.

Trying different USB cable, also sudo lsusb but I see no change.

In the meanwhile I tried:
Modprobe g_webcam as the only gadget module that is included in armbain 5.3x 3.10.105/107, it failed to load:
Code:
[  125.143273] g_webcam gadget: uvc_function_bind
[  125.143306] gadget_is_softwinner_otg is not -int # << this is the same error I get when loading
[  125.143314] gadget_is_softwinner_otg is not -int #    the g_serial module without the use_acm=0
[  125.143322] gadget_is_softwinner_otg is not -int #    option. In both cases it doesn't work.
[  125.143330] gadget_is_softwinner_otg is not -int
[  125.143347] g_webcam gadget: Unable to allocate streaming EP
[  125.143382] g_webcam 1c19000.udc-controller: failed to start g_webcam: -22

I get the same errors about endpoints when I try to insert my compiled g_serial without the use_acm=0 option. It realy does seem that gadgets simply do not work with this(BSP/mostly BSP) kernel 3.10.107 and that's why it's not included .  However I can't find any further information about it.
I using configfs to setup the gadget seem to get the same result.(and functionfs is not configured on Armbian with 3.10.105/107 kernel)

I found out that USB gadgets actualy do work with the mainline kernel(4.13.xx), which is great, but does not really solve my problem, because the mainline kernel does not support DSI MIPI displays at this time. Because of that, I am still trying to make it work on the 3.10.xx kernel.

I am looking for a way to get both of those features working.

一样的错误 ...

离线

#8 2020-10-03 19:27:36

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://forums.developer.nvidia.com/t/tx2-usb-3-0-device-mode-support-iso-transfer/62626

i want to know did the usb 3.0 host can support ISO transfer

i have apply the patch to set usb 3.0 into device mode

when i set it to bulk mode ,it can work well

but when i try to set it as ISO mode ,it can’t int succeed

[ 176.034876] g_webcam 3550000.xudc: failed to start g_webcam: -22
[ 207.267492] tegra-xotg xotg: update_vbus_state: VBUS detected
[ 207.482267] tegra-usb-cd usb_cd: notification status (0x0, 0x10)
[ 207.488345] tegra-usb-cd usb_cd: connected to CDP
[ 207.493170] tegra-usb-cd usb_cd: set current 0ma
[ 207.497874] tegra-xudc-new 3550000.xudc: exiting ELPG
[ 207.505957] tegra-xudc-new 3550000.xudc: exiting ELPG done
[ 207.511482] tegra-xudc-new 3550000.xudc: device mode on
[ 211.845324] g_webcam gadget: Linux USB Audio Gadget, version: Feb 2, 2012
[ 211.852259] g_webcam gadget: uvc_function_bind
[ 211.856761] g_webcam gadget: Unable to allocate streaming EP
[ 211.862458] ac_intf:0
[ 211.864742] as_in_intf:1
[ 211.867315] f_audio_bind:671
[ 211.870230] g_webcam 3550000.xudc: failed to start g_webcam: -22

any one can help me to confirm that?

是usb 不支持 iso 模式?

离线

#9 2020-10-03 19:41:27

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

http://bbs.ebaina.com/thread-39433-1-1.html

请问有没有在3518EV200上做uvc gadget webcam的?加载驱动报下面的错误,似乎usb ep没申请到,可能是什么问题?
# insmod g_webcam.ko
g_webcam gadget: uvc_function_bind
g_webcam gadget: Unable to allocate streaming EP
insmod: can't insert 'g_webcam.ko': Invalid argument

好像节点不够啊

申请了一个control的EP IN的节点成功了。再申请一个Stream的EP In的节点就失败了。难道3518EV200这个芯片的USB只能支持1个EP In的节点?从哪里可以确认?技术手册?什么文档?

代码里面加了打印,竟然dwc_otg在初始化的时候,只有一个In和一个Out ep。这个是硬件决定的?还是可以修改配置?

硬件决定的,看GHWCFG2这个寄存器。

是的,确实是读这个寄存器,dwc_otg加载的时候,判断的。
就是不清楚是否可以修改。如果改不了,那这个芯片就用不了了。
有没有芯片支持的EP可以多点的?3516、3519、3518?

离线

#10 2020-10-03 19:53:28

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://blog.csdn.net/xiaofeng881105/article/details/82530515

如果驱动加载成功且没有报错的话,在电脑端应该能识别到UVC camera。但由于3516av100可用的usb 端点数量有限,g_webcam加载时报错:

g_webcam gadget: uvc_function_bind

g_webcam gadget: Unable to allocate streaming EP

himm 0x10080044  ---> 0x00000024

himm 0x10080048  ---> 0x2288C8D4

读取硬件配置寄存器GHWCFG1和GHWCFG2,可以查看到除了ep0(双向)之外,只有两个可用端点,一个in一个out。Usb协议中ep0为必备端点,上电即可使用,而其他端点需要通过ep0和主机建立连接时进行配置,配置后才可以使用。UVC协议中需要使用两个IN ep,一个用作视频控制VC,一个用作视频流VS,因此在加载该驱动时获取ep失败,在绑定uvc功能模块时报的错。(海思方面答复是3516av100不支持)

注意:驱动本身最大支持到16个端点(含ep0),但是实际可用的受限于硬件,通过读取寄存器获取到可用端点总数和in/out端点数。

理论上可以复用ep0作为uvc的VC端点,因为ep0是双向的;但实际验证行不通,为此做了如下修改尝试:

VC复用ep0
VC为空
VC和VS共用端点
主要修改f_uvd.c中uvc_function_bind函数。

上面的修改均行不通,修改后再host对设备进行配置时,setup报错。

实际查看代码,关于uvc的描述符中定义了uvc控制类和uvc视频流类:uvc_control_cls和uvc_fs_streaming_cls,还有一个uvc_hs_streaming_cls类。

如果要修改还需要对uvc协议和驱动代码深入的了解,时间有限,没有深入去理解。

离线

#11 2020-10-03 20:02:50

听风识雨
会员
注册时间: 2020-08-15
已发帖子: 72
积分: 70

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

可能是端点不够, 有空我到 A33 试一试.

离线

#12 2020-11-26 10:14:10

盘中餐
会员
注册时间: 2020-08-21
已发帖子: 2
积分: 2

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

https://github.com/rockchip-linux/rk-rootfs-build/blob/master/overlay/etc/init.d/adbd.sh

#!/bin/bash -e
### BEGIN INIT INFO
# Provides:          adbd
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop: 6
# Short-Description:
# Description:       Linux ADB
### END INIT INFO

# setup configfs for adbd, usb mass storage and MTP....

UMS_EN=off
ADB_EN=off
MTP_EN=off
NTB_EN=off
ACM_EN=off
UAC1_EN=off
UAC2_EN=off
UVC_EN=off
RNDIS_EN=off

USB_ATTRIBUTE=0x409
USB_GROUP=rockchip
USB_SKELETON=b.1

CONFIGFS_DIR=/sys/kernel/config
USB_CONFIGFS_DIR=${CONFIGFS_DIR}/usb_gadget/${USB_GROUP}
USB_STRINGS_DIR=${USB_CONFIGFS_DIR}/strings/${USB_ATTRIBUTE}
USB_FUNCTIONS_DIR=${USB_CONFIGFS_DIR}/functions
USB_CONFIGS_DIR=${USB_CONFIGFS_DIR}/configs/${USB_SKELETON}

make_config_string()
{
	tmp=$CONFIG_STRING
	if [ -n "$CONFIG_STRING" ]; then
		CONFIG_STRING=${tmp}_${1}
	else
		CONFIG_STRING=$1
	fi
}

parameter_init()
{
	while read line
	do
		case "$line" in
			usb_mtp_en)
				MTP_EN=on
				make_config_string mtp
				;;
			usb_adb_en)
				ADB_EN=on
				make_config_string adb
				;;
			usb_ums_en)
				UMS_EN=on
				make_config_string ums
				;;
			usb_ntb_en)
				NTB_EN=on
				make_config_string ntb
				;;
			usb_acm_en)
				ACM_EN=on
				make_config_string acm
				;;
			usb_uac1_en)
				UAC1_EN=on
				make_config_string uac1
				;;
			usb_uac2_en)
				UAC2_EN=on
				make_config_string uac2
				;;
			usb_uvc_en)
				UVC_EN=on
				make_config_string uvc
				;;
			usb_rndis_en)
                               RNDIS_EN=on
                               make_config_string rndis
                               ;;

		esac
	done < $DIR/.usb_config


	case "$CONFIG_STRING" in
		ums)
			PID=0x0000
			;;
		mtp)
			PID=0x0001
			;;
		adb)
			PID=0x0006
			;;
		mtp_adb | adb_mtp)
			PID=0x0011
			;;
		ums_adb | adb_ums)
			PID=0x0018
			;;
		acm)
			PID=0x1005
			;;
		*)
			PID=0x0019
	esac
}

configfs_init()
{
	mkdir -p ${USB_CONFIGFS_DIR} -m 0770
	echo 0x2207 > ${USB_CONFIGFS_DIR}/idVendor
	echo $PID > ${USB_CONFIGFS_DIR}/idProduct
	mkdir -p ${USB_STRINGS_DIR}   -m 0770

	SERIAL=`cat /proc/cpuinfo | grep Serial | awk '{print $3}'`
	if [ -z $SERIAL ];then
		SERIAL=0123456789ABCDEF
	fi
	echo $SERIAL > ${USB_STRINGS_DIR}/serialnumber
	echo "rockchip"  > ${USB_STRINGS_DIR}/manufacturer
	echo "rk3xxx"  > ${USB_STRINGS_DIR}/product
	mkdir -p ${USB_CONFIGS_DIR}  -m 0770
	mkdir -p ${USB_CONFIGS_DIR}/strings/${USB_ATTRIBUTE}  -m 0770
	echo 500 > ${USB_CONFIGS_DIR}/MaxPower
	echo ${CONFIG_STRING} > ${USB_CONFIGS_DIR}/strings/${USB_ATTRIBUTE}/configuration

}

configure_uvc_resolution()
{
	mkdir ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H
	echo $UVC_DISPLAY_W > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/wWidth
	echo $UVC_DISPLAY_H > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/wHeight
	echo 666666 > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/dwDefaultFrameInterval
	echo $((UVC_DISPLAY_W*UVC_DISPLAY_H*80)) > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/dwMinBitRate
	echo $((UVC_DISPLAY_W*UVC_DISPLAY_H*160)) > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/dwMaxBitRate
	echo $((UVC_DISPLAY_W*UVC_DISPLAY_H*2)) > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/dwMaxVideoFrameBufferSize
	echo -e "666666\n1000000\n2000000" > ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m/$UVC_DISPLAY_H/dwFrameInterval
}

function_init()
{
	# UAC must be first setup when multi function composite.
	if [ $UAC1_EN = on ];then
		if [ ! -e "${USB_FUNCTIONS_DIR}/uac1.gs0" ] ;
		then
			mkdir ${USB_FUNCTIONS_DIR}/uac1.gs0
			ln -s ${USB_FUNCTIONS_DIR}/uac1.gs0 ${USB_CONFIGS_DIR}/uac1.gs0
		fi
	fi

	if [ $UAC2_EN = on ];then
		if [ ! -e "${USB_FUNCTIONS_DIR}/uac2.gs0" ] ;
		then
			mkdir ${USB_FUNCTIONS_DIR}/uac2.gs0
			ln -s ${USB_FUNCTIONS_DIR}/uac2.gs0 ${USB_CONFIGS_DIR}/uac2.gs0
		fi
	fi

	if [ $UMS_EN = on ];then
		if [ ! -e "${USB_FUNCTIONS_DIR}/mass_storage.0" ] ;
		then
			mkdir -p ${USB_FUNCTIONS_DIR}/mass_storage.0
			echo /dev/disk/by-partlabel/userdata > ${USB_FUNCTIONS_DIR}/mass_storage.0/lun.0/file
			ln -s ${USB_FUNCTIONS_DIR}/mass_storage.0 ${USB_CONFIGS_DIR}/mass_storage.0
		fi
	fi

	if [ $ADB_EN = on ];then
		if [ ! -e "${USB_FUNCTIONS_DIR}/ffs.adb" ] ;
		then
			mkdir -p ${USB_FUNCTIONS_DIR}/ffs.adb
			ln -s ${USB_FUNCTIONS_DIR}/ffs.adb ${USB_CONFIGS_DIR}/ffs.adb
		fi
	fi

	if [ $MTP_EN = on ];then
		if [ ! -e "mkdir -p ${USB_FUNCTIONS_DIR}/mtp.gs0" ] ;
		then
			mkdir -p ${USB_FUNCTIONS_DIR}/mtp.gs0
			ln -s ${USB_FUNCTIONS_DIR}/mtp.gs0 ${USB_CONFIGS_DIR}/mtp.gs0
		fi
	fi

	if [ $NTB_EN = on ];then
		if [ ! -e "mkdir -p ${USB_FUNCTIONS_DIR}/ffs.ntb" ] ;
		then
			mkdir -p ${USB_FUNCTIONS_DIR}/ffs.ntb
			ln -s ${USB_FUNCTIONS_DIR}/ffs.ntb ${USB_CONFIGS_DIR}/ffs.ntb
		fi
	fi

	if [ $ACM_EN = on ];then
		if [ ! -e "mkdir -p ${USB_FUNCTIONS_DIR}/acm.gs6" ] ;
		then
			mkdir -p ${USB_FUNCTIONS_DIR}/acm.gs6
			ln -s ${USB_FUNCTIONS_DIR}/acm.gs6 ${USB_CONFIGS_DIR}/acm.gs6
		fi
	fi
	if [ $UVC_EN = on ];then
		mkdir ${USB_FUNCTIONS_DIR}/uvc.gs6

		cat ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming_maxpacket
		echo 1 > /sys/kernel/config/usb_gadget/rockchip/functions/uvc.gs6/streaming_bulk

		mkdir ${USB_FUNCTIONS_DIR}/uvc.gs6/control/header/h
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/control/header/h ${USB_FUNCTIONS_DIR}/uvc.gs6/control/class/fs/h
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/control/header/h ${USB_FUNCTIONS_DIR}/uvc.gs6/control/class/ss/h

		mkdir ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m
		UVC_DISPLAY_W=640
		UVC_DISPLAY_H=480
		configure_uvc_resolution

		UVC_DISPLAY_W=1280
		UVC_DISPLAY_H=720
		configure_uvc_resolution

		UVC_DISPLAY_W=1920
		UVC_DISPLAY_H=1080
		configure_uvc_resolution

		UVC_DISPLAY_W=2560
		UVC_DISPLAY_H=1440
		configure_uvc_resolution

		mkdir ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/uncompressed/u ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h/u
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/mjpeg/m ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h/m
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/class/fs/h
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/class/hs/h
		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/header/h ${USB_FUNCTIONS_DIR}/uvc.gs6/streaming/class/ss/h

		ln -s ${USB_FUNCTIONS_DIR}/uvc.gs6 ${USB_CONFIGS_DIR}/uvc.gs6
	fi

}

case "$1" in
start)
	DIR=$(cd `dirname $0`; pwd)
	if [ ! -e "$DIR/.usb_config" ]; then
		echo "$0: Cannot find .usb_config"
		exit 0
	fi

	parameter_init
	if [ -z $CONFIG_STRING ]; then
		echo "$0: no function be selected"
		exit 0
	fi
	configfs_init
	function_init

	if [ $ADB_EN = on ];then
		if [ ! -e "/dev/usb-ffs/adb" ] ;
		then
			mkdir -p /dev/usb-ffs/adb
			mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb
		fi
		export service_adb_tcp_port=5555
		start-stop-daemon --start --oknodo --pidfile /var/run/adbd.pid --startas /usr/local/bin/adbd --background
		sleep 1
	fi

	if [ $MTP_EN = on ];then
		if [ $MTP_EN = on ]; then
			mtp-server&
		else
			sleep 1 && mtp-server&
		fi
	fi

	if [ $NTB_EN = on ];then
		if [ ! -e "/dev/usb-ffs/ntb" ] ;
		then
			mkdir -p /dev/usb-ffs/ntb
			mount -o uid=2000,gid=2000 -t functionfs ntb /dev/usb-ffs/ntb
		fi
	fi

	UDC=`ls /sys/class/udc/| awk '{print $1}'`
	 echo $UDC > ${USB_CONFIGFS_DIR}/UDC
	;;
stop)
	echo "none" > ${USB_CONFIGFS_DIR}/UDC
	if [ $ADB_EN = on ];then
		start-stop-daemon --stop --oknodo --pidfile /var/run/adbd.pid --retry 5
	fi
	;;
restart|reload)
	;;
*)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0

试一试 RK的芯片

离线

#13 2022-03-07 23:30:46

tigger
Moderator
注册时间: 2021-06-18
已发帖子: 172
积分: 111

Re: V3s Linux4.13执行modprobe g_webcam 出现端点错误, 是端点不够吗? 其他的 g_serial/g_ffs没问题

好消息, 据说全志 D1 / D1s 是可以的:

USB Gadget 模拟摄像头 g_webcam: musb-hdrc.4.auto: failed to start g_webcam: -22
https://bbs.aw-ol.com/topic/999/share/7

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn