赞
踩
新买的开发板RK3399外接USB摄像头,查看了下,RK3399 Android系统rom是支持底层UVC驱动的,将一些测试结果和测试demo记录下来,以免他人踩坑,如果有帮到你,请点个关注和start,谢谢
当打开不存在相机时warn错误警告,监听该异常处理即可。几个错误问题:
获取Camera支持的分辨率列表,当USB摄像头不在列表之内,系统相机打开崩溃,当然自己软件调用相机没有问题
打开不存在相机时warn错误警告,监听该异常处理即可
System.err: java.lang.RuntimeException: Fail to connect to camera service
System.err: at android.hardware.Camera.<init>(Camera.java:496)
System.err: at android.hardware.Camera.open(Camera.java:345)
System.err: at com.yue.customcamera.handler.Camera1Control.startCamera(Camera1Control.java:169)
System.err: at com.yue.customcamera.handler.Camera1Control.access$000(Camera1Control.java:39)
System.err: at com.yue.customcamera.handler.Camera1Control$1.run(Camera1Control.java:138)
System.err: at android.os.Handler.handleCallback(Handler.java:755)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
插入:
EventHub: No input device configuration file found for device 'UVC Camera (046d:0825)'. EventHub: Unable to disable kernel key repeat for /dev/input/event4: Function not implemented EventHub: New device: id=17, fd=280, path='/dev/input/event4', name='UVC Camera (046d:0825)', classes=0x80000401, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false, wakeMechanism=EPOLLWAKEUP, usingClockIoctl=true InputReader: Device added: id=17, name='UVC Camera (046d:0825)', sources=0x00002103 Added device UsbDevice[mName=/dev/bus/usb/005/002,mVendorId=1133,mProductId=2085,mClass=239,mSubclass=2,mProtocol=1,mManufacturerName=null,mProductName=null,mVersion=2.0,mSerialNumber=87430990,mConfigurations=[ UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=250,mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=14,mSubclass=1,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=135,mAttributes=3,mMaxPacketSize=16,mInterval=8]] UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[] UsbInterface[mId=1,mAlternateSetting=1,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=192,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=2,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=384,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=3,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=512,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=4,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=640,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=5,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=800,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=6,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=944,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=7,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=2688,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=8,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=2848,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=9,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=3040,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=10,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=4992,mInterval=1]] UsbInterface[mId=1,mAlternateSetting=11,mName=null,mClass=14,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=5,mMaxPacketSize=5116,mInterval=1]] UsbInterface[mId=2,mAlternateSetting=0,mName=null,mClass=1,mSubclass=1,mProtocol=0,mEndpoints=[] UsbInterface[mId=3,mAlternateSetting=0,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[] UsbInterface[mId=3,mAlternateSetting=1,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=134,mAttributes=5,mMaxPacketSize=68,mInterval=4]] UsbInterface[mId=3,mAlternateSetting=2,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=134,mAttributes=5,mMaxPacketSize=100,mInterval=4]] UsbInterface[mId=3,mAlternateSetting=3,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=134,mAttributes=5,mMaxPacketSize=132,mInterval=4]] UsbInterface[mId=3,mAlternateSetting=4,mName=null,mClass=1,mSubclass=2,mProtocol=0,mEndpoints=[ UsbEndpoint[mAddress=134,mAttributes=5,mMaxPacketSize=196,mInterval=4]]]]
拔出:
EventHub: Removing device UVC Camera (046d:0825) due to epoll hang-up event.
EventHub: Removed device: path=/dev/input/event5 name=UVC Camera (046d:0825) id=18 fd=304 classes=0x80000401
InputReader: Device removed: id=18, name='UVC Camera (046d:0825)', sources=0x00002103
EventHub: Removing device '/dev/input/event5' due to inotify event
UsbAlsaManager: ALSA device removed: AlsaDevice: [card: 3, device: 0, type: 2]
UsbAlsaManager: USB Audio Device Removed: UsbAudioDevice: [card: 3, device: 0, name: USB-Audio - USB Device 0x46d:0x825, hasPlayback: false, hasCapture: true, class: 0x80000002]
插入:
EventHub: Unable to disable kernel key repeat for /dev/input/event5: Function not implemented EventHub: New device: id=12, fd=245, path='/dev/input/event5', name='USB3.0 Camera', classes=0x80000401, configuration='', keyLayout='/system/usr/keylayout/Generic.kl', keyCharacterMap='/system/usr/keychars/Generic.kcm', builtinKeyboard=false, wakeMechanism=EPOLLWAKEUP, usingClockIoctl=true InputReader: Device added: id=12, name='USB3.0 Camera', sources=0x00002103 UsbHostManager: Added device UsbDevice[ mName=/dev/bus/usb/004/008, mVendorId=1423, mProductId=866, mClass=239, mSubclass=2, mProtocol=1, mManufacturerName=LRCP_USB3.0, mProductName=USB3.0 Camera,mVersion=3.0, mSerialNumber=200901010001, mConfigurations=[ UsbConfiguration[ mId=1,mName=USB3.0 Camera,mAttributes=128,mMaxPower=100, mInterfaces=[ UsbInterface[mId=0,mAlternateSetting=0,mName=LRCP_USB3.0,mClass=14,mSubclass=1,mProtocol=0, mEndpoints=[ UsbEndpoint[mAddress=131,mAttributes=3,mMaxPacketSize=16,mInterval=6] ] UsbInterface[mId=1,mAlternateSetting=0,mName=null,mClass=14,mSubclass=2,mProtocol=0, mEndpoints=[ UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=1024,mInterval=0] ] UsbInterface[mId=2,mAlternateSetting=0,mName=null,mClass=3,mSubclass=0,mProtocol=0, mEndpoints=[ UsbEndpoint[mAddress=132,mAttributes=3,mMaxPacketSize=1,mInterval=6] ] ] ] ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:877 com.android.server.usb.UsbSettingsManager.deviceAttached:739 com.android.server.usb.UsbHostManager.endUsbDeviceAdded:225 com.android.server.usb.UsbHostManager.monitorUsbHostBus:-2 com.android.server.usb.UsbHostManager.-wrap0:-1 UsbSettingsManager: no meta-data for ResolveInfo{7fc2aba com.serenegiant.usbcameratest4/com.serenegiant.usbcamerazxing.MainActivity m=0x108000}
支持的分辨率列表和USB摄像头关联,不同的摄像头支持的不一样
--getSupportedPreviewSizes -----begin------------------------------------------------- --getSupportedPreviewSizes --0:1920x1080 --getSupportedPreviewSizes --1:1280x720 --getSupportedPreviewSizes --2:1920x1080 --getSupportedPreviewSizes --3:1280x720 --getSupportedPreviewSizes --4:3840x2160 --getSupportedPreviewSizes --5:1920x1080 --getSupportedPreviewSizes --6:1920x1080 --getSupportedPreviewSizes --7:1280x720 --getSupportedPreviewSizes --8:1280x720 --getSupportedPreviewSizes --9:2560x720 --getSupportedPreviewSizes -----end------------------------------------------- --picturesize-----begin-------------------------------------------- --picturesize--0:1920x1080 --picturesize--1:1280x720 --picturesize--2:1920x1080 --picturesize--3:1280x720 --picturesize--4:3840x2160 --picturesize--5:1920x1080 --picturesize--6:1920x1080 --picturesize--7:1280x720 --picturesize--8:1280x720 --picturesize--9:2560x720 --picturesize-----end-------------------------------------------
罗技摄像头
--getSupportedPreviewSizes -----begin------------------------------------------------- --getSupportedPreviewSizes --0:640x480 --getSupportedPreviewSizes --1:176x144 --getSupportedPreviewSizes --2:320x176 --getSupportedPreviewSizes --3:320x240 --getSupportedPreviewSizes --4:352x288 --getSupportedPreviewSizes --5:432x240 --getSupportedPreviewSizes --6:544x288 --getSupportedPreviewSizes --7:752x416 --getSupportedPreviewSizes --8:800x448 --getSupportedPreviewSizes --9:864x480 --getSupportedPreviewSizes --10:960x544 --getSupportedPreviewSizes --11:960x720 --getSupportedPreviewSizes --12:1024x576 --getSupportedPreviewSizes --13:1184x656 --getSupportedPreviewSizes --14:1280x720 --getSupportedPreviewSizes --15:1280x960 --getSupportedPreviewSizes -----end------------------------------------------- --picturesize-----begin------------------------------------------------- --picturesize--0:640x480 --picturesize--1:176x144 --picturesize--2:320x176 --picturesize--3:320x240 --picturesize--4:352x288 --picturesize--5:432x240 --picturesize--6:544x288 --picturesize--7:752x416 --picturesize--8:800x448 --picturesize--9:864x480 --picturesize--10:960x544 --picturesize--11:960x720 --picturesize--12:1024x576 --picturesize--13:1184x656 --picturesize--14:1280x720 --picturesize--15:1280x960 --picturesize-----end-------------------------------------------
部分USB识别log,怀疑时获取不到支持分辨率,因此调用默认params模板
initDefaultParameters(565): mIsCtsTest:0 Support video sizes:(null) initDefaultParameters(582): Support Preview format: yuv420sp,yuv420p .. yuv420sp initDefaultParameters(584): Support Preview sizes: 1920x1080,1280x720,1920x1080,1280x720,3840x2160,1920x1080,1920x1080,1280x720,1280x720 initDefaultParameters(585): Support Preview FPS range: (25000,150000) initDefaultParameters(586): Support Preview framerate: 25,150 initDefaultParameters(587): Support Picture sizes: 1920x1080,1280x720,1920x1080,1280x720,3840x2160,1920x1080,1920x1080,1280x720,1280x720 initDefaultParameters(597): Support focus: fixed focus zone: 0 initDefaultParameters(599): Support zoom: true(ratios: 100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,2 initDefaultParameters(603): Support exposure: (-3 -> 3) initDefaultParameters(609): Support hardware faces detecte: 2 initDefaultParameters(610): Support software faces detecte: 0 initDefaultParameters(611): Support video stabilization: false initDefaultParameters(612): Support recording hint: false cameraConfig(744): cameraConfig(744): Set framerate(150 fps) success cameraConfig(945): cameraConfig(945): Set exposure 0 127 isNeedToRestartPreview(144): mPreviewFrame2AppW (640x480) isNeedToRestartPreview(145): mCamPreviewW (1920x1080) isNeedToRestartPreview(146): video width (640x480) camera_get_camera_info(1441): camera_get_camera_info(1441): camera_0 facing(0), orientation(0)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。