WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: V4L2 module for USB webcams?  (Read 11777 times)

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
V4L2 module for USB webcams?
« on: October 30, 2016, 03:16:05 AM »
Plugged a USB camera in (Sony PS Eyecam3) - dmesg shows the USB audio and USB camera VID/PID is present.
However lsmod only shows the driver module for the USB sound part, there is no /dev/video0.

Googling on Raspberry forums show the V4l2 module is part of the kernel and loads when a video camera is detected.

Just wondering if piCore 8 was compiled without the V4L2 module?

I know the pi camera uses v4l2, just wondering if the driver is in rpi-vc.tcz or maybe start_x.elf?
Ok maybe not.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: V4L2 module for USB webcams?
« Reply #1 on: October 30, 2016, 04:59:22 AM »
v4l modules are not in the repo but in the full module pack on the server, see

armv6: http://tinycorelinux.net/8.x/armv6/releases/RPi/src/kernel/4.4.20-piCore+_modules.tar.xz
armv7: http://tinycorelinux.net/8.x/armv7/releases/RPi/src/kernel/4.4.20-piCore_v7+_modules.tar.xz

If there is a demand, I can extract them to a tcz but first try them.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: V4L2 module for USB webcams?
« Reply #2 on: October 30, 2016, 07:20:46 PM »
Might be looking in the wrong folder but I did not see any video/V4L2 stuff in the module files.

Search on Pi forum
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=160433&p=1040482&hilit=V4L2+driver#p1040482

Cannot seem to find that either but there is 705MB in the kernel source :'(

Looking here too
https://github.com/raspberrypi/linux/tree/rpi-4.4.y/drivers

Ok it is in the /media folder.
I have only built kernels with buildroot once, that's my entire kernel knowledge.
I know some options have to be enabled before compiling.
Maybe the /media/v4l2-core option was not enabled on the picore kernel?



Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: V4L2 module for USB webcams?
« Reply #3 on: October 30, 2016, 10:48:28 PM »
These modules built with the current kernels:

Code: [Select]
# ls -l v4l2-core
total 431
-rw-r--r-- 1 root root  28128 Sep  7 22:20 tuner.ko
-rw-r--r-- 1 root root  12052 Sep  7 22:20 v4l2-common.ko
-rw-r--r-- 1 root root  26936 Sep  7 22:20 v4l2-dv-timings.ko
-rw-r--r-- 1 root root  30728 Sep  7 22:20 videobuf-core.ko
-rw-r--r-- 1 root root  13916 Sep  7 22:20 videobuf-dvb.ko
-rw-r--r-- 1 root root  11464 Sep  7 22:20 videobuf-vmalloc.ko
-rw-r--r-- 1 root root  35520 Sep  7 22:20 videobuf2-core.ko
-rw-r--r-- 1 root root   5760 Sep  7 22:20 videobuf2-memops.ko
-rw-r--r-- 1 root root  34908 Sep  7 22:20 videobuf2-v4l2.ko
-rw-r--r-- 1 root root  13264 Sep  7 22:20 videobuf2-vmalloc.ko
-rw-r--r-- 1 root root 222772 Sep  7 22:20 videodev.ko

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: V4L2 module for USB webcams?
« Reply #4 on: October 30, 2016, 11:33:19 PM »
Thanks Bela, found them.

Will need uvcvideo.ko too? and maybe media.ko?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: V4L2 module for USB webcams?
« Reply #5 on: October 31, 2016, 12:22:03 AM »
Thanks Bela, found them.

Will need uvcvideo.ko too? and maybe media.ko?

Do not know. Check deps with modinfo and try with a camera, check dmesg, ...
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: V4L2 module for USB webcams?
« Reply #6 on: November 02, 2016, 07:52:08 PM »
Plugged webcam into Raspbian and checked what modules it used.
I confirmed these modules are present in the 4.4.20....modules.tar.xz

So how do I get the 5 needed driver .ko files into the kernel?
Google just confused me

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: V4L2 module for USB webcams?
« Reply #7 on: November 02, 2016, 09:30:03 PM »
Extract them, study kermel module tcz's in the repo for layout and create a .tcz as described in the Wiki.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: V4L2 module for USB webcams?
« Reply #8 on: August 14, 2017, 01:26:32 AM »
I created a v4l-dvb-4.9.22-piCore-v7 extension and gave this a go with the RPi camera - I had to manually load the modules - but it didn't work with guvcview.

Maybe you'll have more luck with a usb webcam?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: V4L2 module for USB webcams?
« Reply #9 on: August 14, 2017, 03:27:11 AM »
at least things work manually.

Edit config.txt:
Code: [Select]
$ cat /mnt/mmcblk0p1/config.txt
...
[ALL]
# Enable camera
start_x=1
gpu_mem=128

Load kernel driver:
Code: [Select]
$ tce-load -i libv4l2
$ sudo modprobe bcm2835-v4l2

$ dmesg | tail -10
...
[  518.025413] media: Linux media interface: v0.10
[  518.036981] Linux video capture interface: v2.00
[  518.080558] bcm2835-v4l2: scene mode selected 0, was 0
[  518.080934] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[  518.085780] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded

Take a photo:
Code: [Select]
$ v4l2-ctl --overlay=1 [enable viewfinder]

$ v4l2-ctl --set-fmt-video=width=2592,height=1944,pixelformat=3
$ v4l2-ctl --stream-mmap=3 --stream-count=1 --stream-to=photo.jpg

Offline Iampegram

  • Newbie
  • *
  • Posts: 1
Re: V4L2 module for USB webcams?
« Reply #10 on: September 17, 2019, 08:29:05 AM »
Load kernel driver:
Code: [Select]
$ tce-load -i libv4l2
$ sudo modprobe bcm2835-v4l2
Sorry to resurrect a thread, but is there a ready-made ARMv6 version of libv4l2.tcz? I didn't see one listed in the repo...

If not, where would I get the source to make my own?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: V4L2 module for USB webcams?
« Reply #11 on: September 17, 2019, 08:32:31 AM »
see http://tinycorelinux.net/9.x/armv7/tcz/src/libv4l2/

..but I believe the armv7 extension should work for armv6 - maybe you could give it a try?
« Last Edit: September 17, 2019, 08:59:35 AM by Juanito »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10960
Re: V4L2 module for USB webcams?
« Reply #12 on: September 17, 2019, 10:34:36 AM »
Isn't that the other way around, older arm stuff will work on newer?
The only barriers that can stop you are the ones you create yourself.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14535
Re: V4L2 module for USB webcams?
« Reply #13 on: September 17, 2019, 10:37:53 AM »
With the compiler flags used, I believe it should work for both armv6 and armv7.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11213
Re: V4L2 module for USB webcams?
« Reply #14 on: September 17, 2019, 12:20:03 PM »
Hi curaga
Isn't that the other way around, older arm stuff will work on newer?
Yes, but I think I remember reading that bmarkus wanted to keep extensions compatible between both ARM versions. I guess
kind of like the x86 extensions all try to maintain 486 compatibility. A couple of randomly chosen MD5s suggest that may be the case:

http://tinycorelinux.net/9.x/armv6/tcz/acl.tcz.md5.txt
Code: [Select]
6fef8807a93ab5191598b1d0dffb9f21  acl.tczhttp://tinycorelinux.net/9.x/armv7/tcz/acl.tcz.md5.txt
Code: [Select]
6fef8807a93ab5191598b1d0dffb9f21  acl.tcz
http://tinycorelinux.net/9.x/armv6/tcz/dnsmasq.tcz.md5.txt
Code: [Select]
818d1584188e8be233cf28584d89953c  dnsmasq.tczhttp://tinycorelinux.net/9.x/armv7/tcz/dnsmasq.tcz.md5.txt
Code: [Select]
818d1584188e8be233cf28584d89953c  dnsmasq.tcz