WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 295
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: 6995
    • 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: 295
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: 6995
    • 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: 295
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: 6995
    • 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: 295
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: 6995
    • 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: 10492
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: 10492
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