Arksine / Easycam

Easycap viewer for android
BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

"Unable to load device" #7

Open amit2n opened 8 years ago

amit2n commented 8 years ago

Hello, I have UTV007 easycap device, I compiled and tested your project on 3 smartphones - LG g2 , sony xperia z5 premium, and LG g3, the device recognized by the app but show toast message : "Unable to load device" and then "Error connecting to device"

Tried it with EasyCap Viewer from play store and it worked good.

Any idea how to solve it?

Arksine commented 8 years ago

I assume each of those devices has Kitkat or later?

Easycap viewer has its own user space driver, my app uses V4l2 linux kernel space drivers. Its likely SELinux that is causing issues. I had hoped requesting usb permission have an effect on SELinux policy to allow access, but I hadn't been able to test it on a SELinux enforcing device. It isn't surprising that it had no effect.

The solution is to change SELinux to permissive mode, for that you will need root. There is an app called "SELinuxModeChanger" that will do this for you. Its available on F-Droid, or you can google it, find the XDA thread, and sideload it.

I could add this functionality to Easycam itself, however I would prefer to add userspace drivers rather than require root access and do something that google deems "dangerous". Creating a userspace driver is a large undertaking and at this point I simply do not have the time to do it.

Arksine commented 8 years ago

It also occurs to me that its possible that your kernel doesn't have the UTV007 module loaded. To my knowledge they are never compiled by default. You would need a custom kernel that supports easycap devices.

amit2n commented 8 years ago

yes, my devices run kitkat and lolipop, I followed your suggest and I root my device and installed "SELinuxModeChanger" which changed SELinux to permissive mode and I still facing the same problem .

can you provide information on how to load the UTV007 module and where can i get it? or any other option to solve this issue?

Arise commented 8 years ago

I also have "Unable to load device" and then "Error connecting to device". One Plus One device running Cyanogenmod Lollipop.

Tried with SELinuxModeChanger and no difference.

I took a look at /dev folder and there I see I have a /video folder and then more files like /dev/video0, /dev//video1, /dev/video2, etc...

Is /dev/video supposed to be a folder or a file?

Arise commented 8 years ago
<6>[ 1034.843926] msm-dwc3 msm_dwc3: DWC3 exited from low power mode
<6>[ 1034.846029] qpnp_chg_ext_charger_reset: qpnp_chg_ext_charger_reset reset:1
<6>[ 1034.848490] qpnp_chg_ext_charger_reset: qpnp_chg_ext_charger_reset reset:0
<6>[ 1034.853862] qpnp_chg_ext_charger_wdt_set: qpnp_chg_ext_charger_wdt_set seconds:0
<6>[ 1034.857996] bq24196_charge_en enable:0
<6>[ 1034.861099] bq24196_vddmax_set voltage:4350
<6>[ 1034.881320] bq24196_charge_en enable:2
<6>[ 1034.888248] xhci-hcd xhci-hcd: xHCI Host Controller
<6>[ 1034.893606] xhci-hcd xhci-hcd: new USB bus registered, assigned bus number 1
<6>[ 1034.899038] xhci-hcd xhci-hcd: irq 163, io mem 0xf9200000
<6>[ 1034.907307] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 1034.907446] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1034.907665] usb usb1: Product: xHCI Host Controller
<6>[ 1034.907787] usb usb1: Manufacturer: Linux 3.4.67-cyanogenmod xhci-hcd
<6>[ 1034.907913] usb usb1: SerialNumber: xhci-hcd
<7>[ 1034.908988] xHCI xhci_add_endpoint called for root hub
<7>[ 1034.909003] xHCI xhci_check_bandwidth called for root hub
<6>[ 1034.910726] hub 1-0:1.0: USB hub found
<6>[ 1034.910996] hub 1-0:1.0: 1 port detected
<6>[ 1034.912099] xhci-hcd xhci-hcd: xHCI Host Controller
<6>[ 1034.912646] xhci-hcd xhci-hcd: new USB bus registered, assigned bus number 2
<6>[ 1034.913686] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
<6>[ 1034.913904] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1034.914014] usb usb2: Product: xHCI Host Controller
<6>[ 1034.914223] usb usb2: Manufacturer: Linux 3.4.67-cyanogenmod xhci-hcd
<6>[ 1034.914343] usb usb2: SerialNumber: xhci-hcd
<7>[ 1034.915876] xHCI xhci_add_endpoint called for root hub
<7>[ 1034.915891] xHCI xhci_check_bandwidth called for root hub
<6>[ 1034.916567] hub 2-0:1.0: USB hub found
<6>[ 1034.916705] hub 2-0:1.0: 1 port detected
<6>[ 1035.595662] usb 1-1: new high-speed USB device number 2 using xhci-hcd
<4>[ 1035.621628] usb 1-1: config 1 interface 0 altsetting 1 bulk endpoint 0x83 has invalid maxpacket 256
<6>[ 1035.626960] usb 1-1: New USB device found, idVendor=1b71, idProduct=3002
<6>[ 1035.627204] usb 1-1: New USB device strings: Mfr=3, Product=4, SerialNumber=2
<6>[ 1035.627600] usb 1-1: Product: usbtv007
<6>[ 1035.627816] usb 1-1: Manufacturer: fushicai
<6>[ 1035.628203] usb 1-1: SerialNumber: 300000000002
root@A0001:/ #
Arise commented 8 years ago
<38>[` 1360.429239] type=1400 audit(1464167968.032:1938): avc: denied { getattr } for pid=14059 comm="arksine.easycam" path="/dev/video" dev="tmpfs" ino=3932 sco
ntext=u:r:untrusted_app:s0 tcontext=u:object_r:video_device:s0 tclass=dir permissive=1
<36>[ 1360.430169] type=1300 audit(1464167968.032:1938): arch=40000028 syscall=327 per=800000 success=yes exit=0 a0=ffffff9c a1=9f407260 a2=bef54978 a3=0 items=
0 ppid=289 pid=14059 auid=4294967295 uid=10192 gid=10192 euid=10192 suid=10192 fsuid=10192 egid=10192 sgid=10192 fsgid=10192 tty=(none) ses=4294967295 comm="ark
sine.easycam" exe="/system/bin/app_process32_original" subj=u:r:untrusted_app:s0 key=(null)
<36>[ 1360.430526] type=1320 audit(1464167968.032:1938):
Arise commented 8 years ago
D/EasycamView(14059): EasycamView constructed
V/WindowManager(  883): Adding window Window{af76fe2 u0 SurfaceView} at 4 of 10 (before Window{1a7c4500 u0 com.arksine.easycam/com.arksine.easycam.easycam})
D/EasycamView(14059): Surface created
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video0': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video0': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video1': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video1': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video2': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video2': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video32': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video32': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video33': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video33': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video34': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video34': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video35': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video35': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video38': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video38': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Cannot open '/dev/video39': 13, Permission denied
E/NativeEasyCaptureJNI(14059): Insufficient permissions on '/dev/video39': 13, Permission denied
E/NativeEasycam(14059): Unable to V4L2 driver for 1b71 @ /dev/bus/usb/001/002
E/NativeEasycam(14059): Unable to load device settings.
E/EasycamView(14059): Error connecting device
D/Easycam (14059): surfaceChanged
I/Timeline(  883): Timeline: Activity_windows_visible id: ActivityRecord{373a5da u0 com.arksine.easycam/.easycam t57} time:1296299
Arksine commented 8 years ago

Each /dev/videoX is a file. Linux reads and writes to this file to control the device. Your output does show that you are in permissive mode, so it appears that permissions on the videoX files prevent user apps from access. Most lilkely all of those /dev/video files are created by the system, and none of them actually represent your usbtv device.

Typically when a v4l2 driver is loaded, the corresponding /dev/videoX file is created with the correct permissions. Are you using a kernel with the usbtv driver compiled? Assuming you have busybox installed, you can check with the lsmod command. If you don't see "usbtv", you don't have the driver.

Initiale commented 8 years ago

hi, i need compiled usb.ko module for arm kitkat how can i?

Initiale commented 7 years ago

anyone can provide me usbtv driver for kitkat ?????