A133 Android USB摄像头无法使用,请问是什么问题?
-
/dev/video0 权限正常
APP权限也都正常但是几个APP都不能使用.
-
我看摄像头拔插的时候,日志都正常.
-
不懂安卓,但是linux上好像要配置uvc驱动和gadget
-
insmod $MODULES_DIR/sunxi_usb_udc.ko insmod $MODULES_DIR/sunxi_usbc.ko mount -t configfs none /sys/kernel/config mkdir /sys/kernel/config/usb_gadget/g1 echo "0x18d1" > /sys/kernel/config/usb_gadget/g1/idVendor echo "0x0002" > /sys/kernel/config/usb_gadget/g1/idProduct mkdir /sys/kernel/config/usb_gadget/g1/strings/0x409 echo "20080411" > /sys/kernel/config/usb_gadget/g1/strings/0x409/serialnumber echo "Android" > /sys/kernel/config/usb_gadget/g1/strings/0x409/manufacturer mkdir /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0 mkdir -p /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p echo 1280 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/wWidth echo 720 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/wHeight echo 333333 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/dwFrameInterval echo 333333 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/dwDefaultFrameInterval echo 442368000 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMinBitRate echo 442368000 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMaxBitRate echo 1843200 > /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize mkdir /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/header/h ln -s /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/mjpeg/m/ /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/header/h/ ln -s /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/header/h/ /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/class/fs ln -s /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/header/h/ /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/streaming/class/hs mkdir /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/control/header/h ln -s /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/control/header/h/ /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/control/class/fs/ ln -s /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/control/header/h/ /sys/kernel/config/usb_gadget/g1/functions/uvc.usb0/control/class/ss/ mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1 echo 0xc0 > /sys/kernel/config/usb_gadget/g1/configs/c.1/bmAttributes echo 500 > /sys/kernel/config/usb_gadget/g1/configs/c.1/MaxPower mkdir /sys/kernel/config/usb_gadget/g1/configs/c.1/strings/0x409 mkdir /sys/kernel/config/usb_gadget/g1/functions/ffs.adb ln -s /sys/kernel/config/usb_gadget/g1/functions/ffs.adb/ /sys/kernel/config/usb_gadget/g1/configs/c.1/ffs.adb mkdir /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0 ln -s /sys/kernel/config/usb_gadget/g1/functions/mass_storage.usb0/ /sys/kernel/config/usb_gadget/g1/configs/c.1/mass_storage.usb0 mkdir /dev/usb-ffs mkdir /dev/usb-ffs/adb mount -o uid=2000,gid=2000 -t functionfs adb /dev/usb-ffs/adb/ adbd > /dev/null & sleep 2 udc=`ls /sys/class/udc` isudc=0 echo $udc > /sys/kernel/config/usb_gadget/g1/UDC
-
@yteraa
这个脚本貌似把 dvp/mipi 摄像头转为 uvc 摄像头输出,楼主这个刚好相反,要接市场上的uvc摄像头输入. -
console:/ # console:/ # [ 51.065683] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 51.287297] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device disconnect [ 51.296303] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 51.305433] usb 1-1: new high-speed USB device number 2 using sunxi-ehci [ 51.643945] usb 1-1: device descriptor read/64, error -71 [ 52.130666] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device disconnect [ 52.139635] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 52.165187] usb 1-1: 1:1: cannot set freq 16000 to ep 0x86 [ 52.179819] usb 1-1: 1:2: cannot set freq 24000 to ep 0x86 [ 52.194463] usb 1-1: 1:3: cannot set freq 32000 to ep 0x86 [ 52.209099] usb 1-1: 1:4: cannot set freq 48000 to ep 0x86 [ 52.261975] usb 1-1: 5:0: cannot get min/max values for control 2 (id 5) [ 52.274606] uvcvideo: Found UVC 1.00 device HD Webcam C615 (046d:082c) [ 52.290675] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround. [ 52.304438] uvcvideo: Failed to query (129) UVC probe control : -71 (exp. 26). [ 52.314829] uvcvideo 1-1:1.2: Entity type for entity Extension 5 was not initialized! [ 52.323704] uvcvideo 1-1:1.2: Entity type for entity Processing 2 was not initialized! [ 52.332705] uvcvideo 1-1:1.2: Entity type for entity Camera 1 was not initialized! [ 52.341254] uvcvideo 1-1:1.2: Entity type for entity Extension 6 was not initialized! [ 52.350132] uvcvideo 1-1:1.2: Entity type for entity Extension 7 was not initialized! [ 52.358975] uvcvideo 1-1:1.2: Entity type for entity Extension 8 was not initialized! [ 52.369065] input: HD Webcam C615 as /devices/platform/soc/5200000.ehci1-controller/usb1/1-1/1-1:1.2/input/input4 [ 52.382455] usb 1-1: USB disconnect, device number 2 [ 52.680196] usb 1-1: new high-speed USB device number 3 using sunxi-ehci [ 53.298306] uvcvideo: Found UVC 1.00 device HD Webcam C615 (046d:082c) [ 53.319567] uvcvideo 1-1:1.2: Entity type for entity Extension 5 was not initialized! [ 53.328459] uvcvideo 1-1:1.2: Entity type for entity Processing 2 was not initialized! [ 53.337409] uvcvideo 1-1:1.2: Entity type for entity Camera 1 was not initialized! [ 53.345989] uvcvideo 1-1:1.2: Entity type for entity Extension 6 was not initialized! [ 53.354840] uvcvideo 1-1:1.2: Entity type for entity Extension 7 was not initialized! [ 53.363694] uvcvideo 1-1:1.2: Entity type for entity Extension 8 was not initialized! [ 53.374086] input: HD Webcam C615 as /devices/platform/soc/5200000.ehci1-controller/usb1/1-1/1-1:1.2/input/input5
第一个摄像头挂了
console:/ # ls /dev/video0 -l crwxrwxrwx 1 camera camera 81, 14 2022-08-23 14:45 /dev/video0
-
console:/ # [ 369.196274] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 369.204982] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device disconnect [ 369.280957] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 369.556709] usb 1-1: new high-speed USB device number 5 using sunxi-ehci [ 369.921976] uvcvideo: Found UVC 1.00 device <unnamed> (046d:0825) [ 370.020356] uvcvideo 1-1:1.0: Entity type for entity Extension 4 was not initialized! [ 370.029242] uvcvideo 1-1:1.0: Entity type for entity Extension 6 was not initialized! [ 370.038105] uvcvideo 1-1:1.0: Entity type for entity Extension 7 was not initialized! [ 370.046961] uvcvideo 1-1:1.0: Entity type for entity Processing 2 was not initialized! [ 370.055931] uvcvideo 1-1:1.0: Entity type for entity Extension 3 was not initialized! [ 370.064788] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized! [ 370.074708] input: UVC Camera (046d:0825) as /devices/platform/soc/5200000.ehci1-controller/usb1/1-1/1-1:1.0/input/input7 [ 371.431060] usb 1-1: set resolution quirk: cval->res = 384 console:/ # ls /dev/video0 -l crwxrwxrwx 1 camera camera 81, 14 2022-08-23 14:50 /dev/video0 console:/ #
第二个摄像头也不行
-
[ 857.588025] sunxi-ehci 5200000.ehci1-controller: ehci_irq: highspeed device connect [ 857.816669] usb 1-1: new high-speed USB device number 5 using sunxi-ehci [ 858.459117] uvcvideo: Found UVC 1.00 device HD Webcam C615 (046d:082c) [ 858.481164] uvcvideo 1-1:1.2: Entity type for entity Extension 5 was not initialized! [ 858.490158] uvcvideo 1-1:1.2: Entity type for entity Processing 2 was not initialized! [ 858.499225] uvcvideo 1-1:1.2: Entity type for entity Camera 1 was not initialized! [ 858.507814] uvcvideo 1-1:1.2: Entity type for entity Extension 6 was not initialized! [ 858.516687] uvcvideo 1-1:1.2: Entity type for entity Extension 7 was not initialized! [ 858.525548] uvcvideo 1-1:1.2: Entity type for entity Extension 8 was not initialized! [ 858.535914] input: HD Webcam C615 as /devices/platform/soc/5200000.ehci1-controller/usb1/1-1/1-1:1.2/input/input7 [ 867.189097] type=1400 audit(1661238994.534:336): avc: denied { getattr } for comm="m.webview_shell" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c59,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=org.chromium.webview_shell [ 867.218001] type=1400 audit(1661239007.918:337): avc: denied { dac_override } for comm="irqbalance" capability=1 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=1 [ 908.161265] type=1400 audit(1661239007.918:337): avc: denied { dac_override } for comm="irqbalance" capability=1 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=1 [ 908.181605] type=1400 audit(1661239048.891:338): avc: denied { open } for comm="droid.usbcamera" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c71,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=com.shenyaocn.android.usbcamera [ 908.210824] type=1400 audit(1661239048.891:338): avc: denied { open } for comm="droid.usbcamera" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c71,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=com.shenyaocn.android.usbcamera [ 908.240915] type=1400 audit(1661239048.891:339): avc: denied { getattr } for comm="droid.usbcamera" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c71,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=com.shenyaocn.android.usbcamera [ 913.804113] type=1400 audit(1661239048.891:339): avc: denied { getattr } for comm="droid.usbcamera" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c71,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=com.shenyaocn.android.usbcamera [ 913.834604] type=1400 audit(1661239054.534:340): avc: denied { open } for comm="m.webview_shell" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c59,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=org.chromium.webview_shell [ 913.863385] type=1400 audit(1661239054.534:340): avc: denied { open } for comm="m.webview_shell" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c59,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=org.chromium.webview_shell [ 913.893175] type=1400 audit(1661239054.534:341): avc: denied { getattr } for comm="m.webview_shell" path="/proc/vmstat" dev="proc" ino=4026532021 scontext=u:r:untrusted_app_27:s0:c59,c256,c512,c768 tcontext=u:object_r:proc_vmstat:s0 tclass=file permissive=1 app=org.chromium.webview_shell
再看了一下日志,貌似还是权限问题.
-
USB摄像头设备是可以检测到的
-
收摊,不搞了,可能是Android 10的bug.
-
楼主,先不要放弃治疗,我家里还有一个a133平板电脑,跑的是安卓11,我回去接摄像头帮你试一试。
-
@whycan 大神 可以求救一下吗
-
@cola123456
抱歉,失败了,但是手机是可以用的。 -
@whycan 我现在想要PC端两路预览,然后demo里只有1路UVC的 我改了cofigfs,但是电脑端始终只有一个逻辑设备,实在搞不清楚是什么原因了 可以帮帮忙看看吗?
-
@cola123456
可以发个帖子说一下一路 uvc怎么出来的吗?我这边找小伙伴重现问题试一试。 -
@whycan 好的 已经发帖,板子是V853S的,感谢您,期待回复~
Copyright © 2023 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号