simon3z / usbtv Goto Github PK
View Code? Open in Web Editor NEWFushicai USBTV007 Audio-Video Grabber
Fushicai USBTV007 Audio-Video Grabber
I've compiled this driver as a module for Linux 3.10.25 (I've rewrittten Makefile to achieve that) and for single device, it worked fine. When I connected second device, it cannot start simultaneous grabbing as it fails on ioctl VIDIOC_STREAMON.
When two devices are connected, two device files are created in /dev tree:
/dev/video0 and /dev/video1. When I start grab live image from either of them, I cannot start grab from the other, i.e. when I start grab from /dev/video1, I can't start grab from /dev/video0 until grab on /dev/video1 is stopped. Similarly, when I start grab on /dev/video0 first, I can't start grab on /dev/video1 until grab on /dev/video0 is stopped. Problem is, I need to grab live image from both devices simultaneously. On userspace, all I see is failed ioctl. The only trace that something went wrong in dmesg is:
ehci-pci 0000:00:1d.7: iso sched full d5e93200
Do you have any idea how to overcome this problem?
The default saturation and sharpness values are way too high on my device, do you have any idea what it would take to implement v4l2 controls?
Is this possible to have param to the module (default is 1) saying how many video devices should be created? I've tried to modify usbtv-core.c
and duplicated code that creates/initializes usbtv
struct. It created 2 devices but the first "died" when the second started stream. Unfortunately, I'm not good in C and in v4l2 and don't know how to do it.
Let me know if it's possible maybe there's another easiest way to duplicate existing video device.
The driver support only 48k of sample rate.
Since I'm not kernel hacker, I couldn't do much try for it.
Just modifying fp->rates_min to 16000 didn't make it.
Also I tried not using CONTINUOUS and KNOT flag and specified each SNDRV_PCM_RATE_XXXX but no luck.
So could you let me point out where to start?
Anyway, your driver works well /w rpi-3.12.y kernel on raspberry pi. Thanks!
Hi @simon3z
Currently i am working on following kernel in Beaglebone Black.
4.1.10-ti-r21
I am trying to insert my usbtv module in this kernel version.I am using driver from following link
https://github.com/simon3z/usbtv
So i am able to successfully compile my usbtv driver with my linux headers linux-headers-4.1.10-ti-r21
But when i am inserting my module using insmod. Then I am getting following errors on dmesg
[ 208.683602] usbtv: Unknown symbol vb2_queue_init (err 0)
[ 208.683744] usbtv: Unknown symbol video_ioctl2 (err 0)
[ 208.683824] usbtv: Unknown symbol v4l2_device_put (err 0)
[ 208.683885] usbtv: Unknown symbol vb2_queue_release (err 0)
[ 208.684039] usbtv: Unknown symbol vb2_ioctl_streamoff (err 0)
[ 208.684282] usbtv: Unknown symbol vb2_ioctl_querybuf (err 0)
[ 208.684348] usbtv: Unknown symbol v4l2_fh_open (err 0)
[ 208.684447] usbtv: Unknown symbol video_devdata (err 0)
[ 208.684508] usbtv: Unknown symbol vb2_fop_release (err 0)
[ 208.684610] usbtv: Unknown symbol vb2_ioctl_dqbuf (err 0)
[ 208.684669] usbtv: Unknown symbol vb2_ioctl_create_bufs (err 0)
[ 208.684729] usbtv: Unknown symbol vb2_ioctl_prepare_buf (err 0)
[ 208.684845] usbtv: Unknown symbol vb2_buffer_done (err 0)
[ 208.684905] usbtv: Unknown symbol vb2_plane_vaddr (err 0)
[ 208.684978] usbtv: Unknown symbol video_unregister_device (err 0)
[ 208.685059] usbtv: Unknown symbol vb2_ioctl_qbuf (err 0)
[ 208.685118] usbtv: Unknown symbol vb2_fop_mmap (err 0)
[ 208.685188] usbtv: Unknown symbol vb2_vmalloc_memops (err 0)
[ 208.685246] usbtv: Unknown symbol v4l2_device_disconnect (err 0)
[ 208.685305] usbtv: Unknown symbol vb2_fop_read (err 0)
[ 208.685363] usbtv: Unknown symbol v4l2_device_register (err 0)
[ 208.685449] usbtv: Unknown symbol __video_register_device (err 0)
[ 208.685530] usbtv: Unknown symbol vb2_ioctl_streamon (err 0)
[ 208.685589] usbtv: Unknown symbol vb2_fop_poll (err 0)
[ 208.685649] usbtv: Unknown symbol v4l2_device_unregister (err 0)
[ 208.685718] usbtv: Unknown symbol video_device_release_empty (err 0)
[ 208.685794] usbtv: Unknown symbol vb2_ioctl_reqbufs (err 0)
So can you please suggest some solution for above problem
UsbTV kernel driver causes complete system freeze on Armbian OrangePi PC kernel 4.14
How to reproduce:
cat /dev/video0>/dev/null
)What happens:
The system becomes unresponsive and later freezes completely.
The following log is found in the /var/log/syslog:
[ 491.108750] INFO: rcu_sched self-detected stall on CPU
[ 491.109524] 2-...: (1 GPs behind) idle=b82/140000000000002/0 softirq=19961/19962 fqs=4050
[ 491.109601] (t=21000 jiffies g=6765 c=6764 q=265)
[ 491.110023] NMI backtrace for cpu 2
[ 491.110328] CPU: 2 PID: 2077 Comm: kworker/2:0 Not tainted 4.14.65-sunxi #68
[ 491.110464] Hardware name: Allwinner sun8i Family
[ 491.110888] Workqueue: events dbs_work_handler
[ 491.111689] [<c010dacd>] (unwind_backtrace) from [<c010a0b5>] (show_stack+0x11/0x14)
[ 491.112147] [<c010a0b5>] (show_stack) from [<c086b7fd>] (dump_stack+0x69/0x78)
[ 491.112612] [<c086b7fd>] (dump_stack) from [<c086f5ef>] (nmi_cpu_backtrace+0xd3/0xd4)
[ 491.113015] [<c086f5ef>] (nmi_cpu_backtrace) from [<c086f67d>] (nmi_trigger_cpumask_backtrace+0x8d/0xc4)
[ 491.113505] [<c086f67d>] (nmi_trigger_cpumask_backtrace) from [<c01663c5>] (rcu_dump_cpu_stacks+0x77/0x96)
[ 491.113952] [<c01663c5>] (rcu_dump_cpu_stacks) from [<c0165b85>] (rcu_check_callbacks+0x4d5/0x690)
[ 491.114476] [<c0165b85>] (rcu_check_callbacks) from [<c016a203>] (update_process_times+0x2b/0x48)
[ 491.114974] [<c016a203>] (update_process_times) from [<c0178001>] (tick_sched_timer+0x31/0x68)
[ 491.115425] [<c0178001>] (tick_sched_timer) from [<c016af8d>] (__hrtimer_run_queues+0xf5/0x224)
[ 491.115812] [<c016af8d>] (__hrtimer_run_queues) from [<c016b289>] (hrtimer_interrupt+0x81/0x180)
[ 491.116293] [<c016b289>] (hrtimer_interrupt) from [<c074aae1>] (arch_timer_handler_phys+0x25/0x28)
[ 491.116793] [<c074aae1>] (arch_timer_handler_phys) from [<c015d637>] (handle_percpu_devid_irq+0x57/0x19c)
[ 491.117282] [<c015d637>] (handle_percpu_devid_irq) from [<c0159b4d>] (generic_handle_irq+0x1d/0x28)
[ 491.117795] [<c0159b4d>] (generic_handle_irq) from [<c0159f5d>] (__handle_domain_irq+0x45/0x84)
[ 491.118243] [<c0159f5d>] (__handle_domain_irq) from [<c01013b5>] (gic_handle_irq+0x39/0x68)
[ 491.118619] [<c01013b5>] (gic_handle_irq) from [<c010a9e5>] (__irq_svc+0x65/0x94)
[ 491.118786] Exception stack(0xee5a5c70 to 0xee5a5cb8)
[ 491.119081] 5c60: 00000000 40070193 9cb0c842 9cb0c842
[ 491.119463] 5c80: c9c45900 60070113 00000000 00000000 c987acdc c0d03f48 c0d02080 4000001f
[ 491.119771] 5ca0: 2ea10000 ee5a5cc0 c06cd097 c06b8fee 60070133 ffffffff
[ 491.120267] [<c010a9e5>] (__irq_svc) from [<c06b8fee>] (__usb_hcd_giveback_urb+0x5a/0xc0)
[ 491.120731] [<c06b8fee>] (__usb_hcd_giveback_urb) from [<c06b90cb>] (usb_giveback_urb_bh+0x77/0xb8)
[ 491.121242] [<c06b90cb>] (usb_giveback_urb_bh) from [<c011f231>] (tasklet_hi_action+0x3d/0x9c)
[ 491.121695] [<c011f231>] (tasklet_hi_action) from [<c01014a1>] (__do_softirq+0xb9/0x25c)
[ 491.122104] [<c01014a1>] (__do_softirq) from [<c011ef01>] (irq_exit+0x99/0xf0)
[ 491.122577] [<c011ef01>] (irq_exit) from [<c0159f61>] (__handle_domain_irq+0x49/0x84)
[ 491.122994] [<c0159f61>] (__handle_domain_irq) from [<c01013b5>] (gic_handle_irq+0x39/0x68)
[ 491.123362] [<c01013b5>] (gic_handle_irq) from [<c010a9e5>] (__irq_svc+0x65/0x94)
[ 491.123535] Exception stack(0xee5a5db0 to 0xee5a5df8)
[ 491.123793] 5da0: 00000000 00000000 9cb0c842 c05ccd11
[ 491.124174] 5dc0: ef003480 00000000 016e3600 1c9c3800 ffffe000 c9cf6100 ef003300 c0d03f6c
[ 491.124481] 5de0: 00000078 ee5a5e00 c016aa75 c05c57d2 60070033 ffffffff
[ 491.124946] [<c010a9e5>] (__irq_svc) from [<c05c57d2>] (clk_change_rate+0xa6/0x2b0)
[ 491.125474] [<c05c57d2>] (clk_change_rate) from [<c05c5c37>] (clk_core_set_rate_nolock+0x3f/0x68)
[ 491.125942] [<c05c5c37>] (clk_core_set_rate_nolock) from [<c05c5c7b>] (clk_set_rate+0x1b/0x24)
[ 491.126489] [<c05c5c7b>] (clk_set_rate) from [<c063b3b3>] (dev_pm_opp_set_rate+0x12f/0x28c)
[ 491.127065] [<c063b3b3>] (dev_pm_opp_set_rate) from [<c0731fdb>] (__cpufreq_driver_target+0x123/0x364)
[ 491.127511] [<c0731fdb>] (__cpufreq_driver_target) from [<c073500b>] (od_dbs_update+0x8f/0x108)
[ 491.127885] [<c073500b>] (od_dbs_update) from [<c0735871>] (dbs_work_handler+0x29/0x50)
[ 491.128334] [<c0735871>] (dbs_work_handler) from [<c012d4d1>] (process_one_work+0x155/0x37c)
[ 491.128760] [<c012d4d1>] (process_one_work) from [<c012e073>] (worker_thread+0xff/0x408)
[ 491.129213] [<c012e073>] (worker_thread) from [<c0131b3d>] (kthread+0xfd/0x104)
[ 491.129699] [<c0131b3d>] (kthread) from [<c01066f9>] (ret_from_fork+0x11/0x38)
[ 491.132532] hrtimer: interrupt took 24317996 ns
[ 499.171529] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.336672] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.438560] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.463659] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.484783] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.504574] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.522563] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.538389] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.552215] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.564230] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.575130] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.583608] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.592606] usbtv 4-1:1.0: Could not resubmit ISO URB
[ 499.604653] usbtv 4-1:1.0: Could not resubmit ISO URB
The process using the /dev/video0 starts to eat all system resources 390%load (on 4 cpu system) before the log message appears.
What is expected:
The system should process the video with average load approx 30% (tested with other USB grabbers and USB cameras).
System info
Linux orangepipc 4.14.65-sunxi #68 SMP Tue Aug 21 19:57:06 CEST 2018 armv7l armv7l armv7l GNU/Linux
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 61.71
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 1
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 61.71
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 2
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 61.71
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
processor : 3
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 61.71
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
Hardware : Allwinner sun8i Family
Revision : 0000
Serial : 02c0008179908356
Bus 008 Device 002: ID 1bcf:05cf Sunplus Innovation Technology Inc. Micro keyboard & mouse receiver
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 005: ID 1b71:3002 Fushicai USBTV007 Video Grabber [EasyCAP]
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
filename: /lib/modules/4.14.65-sunxi/kernel/drivers/media/usb/usbtv/usbtv.ko
license: Dual BSD/GPL
description: Fushicai USBTV007 Audio-Video Grabber Driver
author: Lubomir Rintel, Federico Simoncelli
alias: usb:v1F71p3301d*dc*dsc*dp*ic*isc*ip*in*
alias: usb:v1B71p3002d*dc*dsc*dp*ic*isc*ip*in*
depends: videobuf2-v4l2,snd-pcm,videobuf2-vmalloc,videobuf2-core,snd
intree: Y
name: usbtv
vermagic: 4.14.65-sunxi SMP mod_unload ARMv7 thumb2 p2v8
[ 4993.686404] usb 4-1: New USB device found, idVendor=1b71, idProduct=3002
[ 4993.686424] usb 4-1: New USB device strings: Mfr=3, Product=4, SerialNumber=2
[ 4993.686435] usb 4-1: Product: usbtv007
[ 4993.686446] usb 4-1: Manufacturer: fushicai
[ 4993.686458] usb 4-1: SerialNumber: 300000000002
[ 4993.689798] usbtv 4-1:1.0: Fushicai USBTV007 Audio-Video Grabber
Should this be wrong place to report such bug, please let me know.
I also opened discussion topic at the Armbian forum
I'd previously compiled this module with no problems with kernel 3.13 on Ubuntu 14.04 but it failed to compile with kernel 3.16 on Ubuntu 14.10. The error message being "warning: initialization from incompatible pointer type". Any ideas, please?
$ make -C /lib/modules/$(uname -r)/build M=$PWD
make: Entering directory '/usr/src/linux-headers-3.16.0-24-generic'
LD /work/sys/drivers/usbtv-master/built-in.o
CC [M] /work/sys/drivers/usbtv-master/usbtv-core.o
CC [M] /work/sys/drivers/usbtv-master/usbtv-video.o
/work/sys/drivers/usbtv-master/usbtv-video.c:653:2: warning: initialization from incompatible pointer type
.stop_streaming = usbtv_stop_streaming,
^
/work/sys/drivers/usbtv-master/usbtv-video.c:653:2: warning: (near initialization for ‘usbtv_vb2_ops.stop_streaming’)
/work/sys/drivers/usbtv-master/usbtv-video.c: In function ‘usbtv_video_init’:
/work/sys/drivers/usbtv-master/usbtv-video.c:683:13: error: ‘struct vb2_queue’ has no member named ‘timestamp_type’
usbtv->vb2q.timestamp_type = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
^
scripts/Makefile.build:257: recipe for target '/work/sys/drivers/usbtv-master/usbtv-video.o' failed
make[1]: *** [/work/sys/drivers/usbtv-master/usbtv-video.o] Error 1
Makefile:1345: recipe for target '_module_/work/sys/drivers/usbtv-master' failed
make: *** [_module_/work/sys/drivers/usbtv-master] Error 2
make: Leaving directory '/usr/src/linux-headers-3.16.0-24-generic'
Hi Federico,
i trying to build your kernel module under linux-sunxi 3.4 but i have many errors: http://pastebin.com/ZDUEp396
could you help me
regards
Armando B.
My make file is
usbtv-y := usbtv-core.o \ usbtv-video.o \ usbtv-audio.o obj-$(CONFIG_VIDEO_USBTV) += usbtv.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
but when i make the file I get the following error
Makefile:6: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
My file does not have any spaces except for the empty lines. i can not make it work. Please help.
Module can be built on this kernel.
How to compile this module ??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.