Skip to contentSkip to conversation

gspca, linux 2.6.26 and ioctl(VIDIOC_QUERYCAP) returning -1, what's wrong?

DISCUSSION Stefano Sabatini 2 participants 3 messages Dec 24, 2008 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hi all,

I'm using linux 2.6.26 and the Debian gspca module, and I'm getting ioctl(VIDIOC_QUERYCAP) return -1 after the device is opened.

Do you have any hint to share?

Here there are some relevant informations:

stefano@geppetto ~/s/ffmpeg> uname -a
Linux geppetto 2.6.26-1-686 #1 SMP Sat Oct 18 16:22:25 UTC 2008 i686 GNU/Linux stefano@geppetto ~/s/ffmpeg> sudo modinfo gspca

filename:       /lib/modules/2.6.26-1-686/kernel/drivers/usb/media/gspca.ko
author:         Michel Xhaard <[email protected]> based on spca50x driver by Joel Crisp <[email protected]>,ov511 driver by Mark McClelland <[email protected]>
description:    GSPCA/SPCA5XX USB Camera Driver
license:        GPL
vermagic:       2.6.26-1-686 SMP mod_unload modversions 686 
depends:        usbcore,videodev
alias:          usb:v093Ap2463d*dc*dsc*dp*ic*isc*ip*
[...]
parm:           force_gamma_id:Forced assigning ID of contrast settings (0=default,1,2,3) Zc03xx only (int)
parm:           force_sensor_id:Forced assigning ID sensor (Zc03xx only). Dangerous, only for experts !!! (int)
parm:           lightfreq:Light frequency banding filter. Set to 50 or 60 Hz, or 0 for NoFlicker (default=50) Zc03xx only (int)
parm:           usbgrabber:Is a usb grabber 0x0733:0x0430 ? (default 1)  (int)
parm:           compress:Turn on/off compression (not functional yet) (int)
parm:           GGreen:Gain Green setting range 0 to 512 /256  (int)
parm:           GBlue:Gain Blue setting range 0 to 512 /256  (int)
parm:           GRed:Gain Red setting range 0 to 512 /256  (int)
parm:           OffGreen:OffGreen setting range -128 to 128 (int)
parm:           OffBlue:OffBlue setting range -128 to 128 (int)
parm:           OffRed:OffRed setting range -128 to 128 (int)
parm:           gamma:gamma setting range 0 to 7 3-> gamma=1 (int)
parm:           force_rgb:Read RGB instead of BGR (int)
parm:           debug:Debug level: 0=none, 1=init/detection, 2=warning, 3=config/control, 4=function call, 5=max (int)
parm:           autoexpo:Enable/Disable auto exposure (default=1: enabled) (PC-CAM 600/Zc03xx/spca561a/Etoms Only !!!) (int)

stefano@geppetto ~/s/ffmpeg> dmesg
[...]

[38586.942147] Linux video capture interface: v2.00
[38586.945359] gspca: USB GSPCA camera found.(ZC3XX) 
[38586.945359] gspca: [spca5xx_probe:4275] Camera type JPEG 
[38587.582486] gspca: [zc3xx_config:669] Find Sensor HV7131R(c)
[38587.586948] gspca: [spca5xx_getcapability:1249] maxw 640 maxh 480 minw 160 minh 120
[38587.586948] usbcore: registered new interface driver gspca
[38587.586948] gspca: gspca driver 01.00.20 registered
[38611.561635] gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
[38611.561740] gspca: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7
[38627.563632] gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
[38627.563726] gspca: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7
[38629.217385] gspca: [spca5xx_do_ioctl:2124] Bridge ZC301-2 
[38634.087208] gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
[38634.087208] gspca: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7

The failing application is ffplay (ffplay -s 320x240 -f video4linux2 /dev/video0) if that matters.

Regards.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

#1 lore raw
Quoted 1 line · Stefano Sabatini

Hi all,

Hi Stefano,

Quoted 2 lines

I'm using linux 2.6.26 and the Debian gspca module, and I'm getting ioctl(VIDIOC_QUERYCAP) return -1 after the device is opened.

	[snip]
Quoted 4 lines

stefano@geppetto ~/s/ffmpeg> sudo modinfo gspca

filename:       /lib/modules/2.6.26-1-686/kernel/drivers/usb/media/gspca.ko
author:         Michel Xhaard <[email protected]> based on spca50x driver by Joel Crisp <[email protected]>,ov511 driver by Mark McClelland <[email protected]>
description:    GSPCA/SPCA5XX USB Camera Driver
	[snip]

You use the gspca version 1. This one is obsoleted by the gspca v2 which is included in the latest linux kernels (>= 2.6.27). You should try the stable or development versions at LinuxTv.org. Look at my page (see below) for more information.

Regards.

Signature · 8 lines
Ken ar c'hentañ |             ** Breizh ha Linux atav! **
Jef             |               http://moinejf.free.fr/


--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
#2 lore raw
Quoted 12 lines · Jean-Francois Moine
Quoted 1 line · Stefano Sabatini

Hi all,

Hi Stefano,

Quoted 2 lines

I'm using linux 2.6.26 and the Debian gspca module, and I'm getting ioctl(VIDIOC_QUERYCAP) return -1 after the device is opened.

	[snip]
Quoted 4 lines

stefano@geppetto ~/s/ffmpeg> sudo modinfo gspca

filename:       /lib/modules/2.6.26-1-686/kernel/drivers/usb/media/gspca.ko
author:         Michel Xhaard <[email protected]> based on spca50x driver by Joel Crisp <[email protected]>,ov511 driver by Mark McClelland <[email protected]>
description:    GSPCA/SPCA5XX USB Camera Driver
Quoted 6 lines
	[snip]

You use the gspca version 1. This one is obsoleted by the gspca v2 which is included in the latest linux kernels (>= 2.6.27). You should try the stable or development versions at LinuxTv.org. Look at my page (see below) for more information.

Many thanks Jean-Francois,

indeed it was what I suspected, but the line I found in dmesg was misleading:

[38586.942147] Linux video capture interface: v2.00

BTW, would be possible to get a more informative error message from the module (either in the kernel log either in the strerror string)?, also I expected to get a different ioctl() code in that case (namely ENOIOCTLCMD).

Check for example the code in libavdevice/v4l2.c of FFmpeg:

    res = ioctl(fd, VIDIOC_QUERYCAP, &cap);
    // ENOIOCTLCMD definition only availble on __KERNEL__
    if (res < 0 && errno == 515) {
        av_log(ctx, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but not supporting V4L2\n");
        close(fd);

        return -1;
    }
    if (res < 0) {
        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
                 strerror(errno));
        close(fd);

        return -1;
    }

This is supposed to nicely warn the user if the device doesn't support V4L2.

Is this a problem with V4L* or is the ENOIOCTLCMD assumption wrong?

Again thanks in advance.

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list