Bug 12180

Summary: [sn9c102] Webcam 0c45:600d doesn't work (ioctl query failed)
Product: Drivers Reporter: Rafał Miłecki (zajec5)
Component: Video(Other)Assignee: Hans de Goede (jwrdegoede)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: moinejf
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.28-rc6 Subsystem:
Regression: --- Bisected commit-id:
Attachments: Part of lsusb --verbose
My kernel configuration (/boot/config-2.6.28-rc6-bl)

Description Rafał Miłecki 2008-12-08 01:30:21 UTC
I tested this webcam using openSUSE 11.0 with pre-compiled kernel 2.6.25.18 and self-compiled vanilla 2.6.28-rc6. It doesn't work in any, following information comes from 2.6.28-rc6:


Loading module:
# modprobe sn9c102 debug=3 && dmesg | tail
sn9c102: V4L2 driver for SN9C1xx PC Camera Controllers v1:1.47pre49
usb 3-2: SN9C10[12] PC Camera Controller detected (vid:pid 0x0C45:0x600D)
usb 3-2: [sn9c102_i2c_try_raw_write:468] I2C write failed for MT9V111 image sensor
usb 3-2: PAS106B image sensor detected
usb 3-2: [sn9c102_usb_probe:3313] Support for PAS106B maintained by Luca Risolia <luca.risolia@studio.unibo.it>
usb 3-2: [sn9c102_init:1686] Uncompressed video format is active
usb 3-2: [sn9c102_init:1707] Image sensor supports 'exposure' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'global gain' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'contrast' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'red balance' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'blue balance' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'green balance' control
usb 3-2: [sn9c102_init:1707] Image sensor supports 'DAC magnitude' control
usb 3-2: Initialization succeeded
usb 3-2: V4L2 device registered as /dev/video1
usb 3-2: Optional device control through 'sysfs' interface disabled
usb 3-2: [sn9c102_usb_probe:3370] Compile the kernel with the 'CONFIG_VIDEO_ADV_DEBUG' configuration option to enable it.
usbcore: registered new interface driver sn9c102
usb 3-2: [sn9c102_open:1848] Video device /dev/video1 is open
sn9c102: VIDIOC_QUERYCAP<7>sn9c102: VIDIOCGCAP<6>usb 3-2: [sn9c102_release:1873] Video device /dev/video1 closed


I try play video:
> mplayer -vo x11 tv:// -tv device=/dev/video1
MPlayer dev-SVN-r27937-4.3 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Core(TM)2 Duo CPU     P8400  @ 2.26GHz (Family: 6, Model: 23, Stepping: 6)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: SN9C1xx PC Camera
 Capabilites:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = Camera;
 Current input: 0
 Current format: unknown (0x31384142)
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: Cannot get fps
v4l2: ioctl set mute failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
v4l2: ioctl query control failed: Invalid argument
==========================================================================
Cannot find codec matching selected -vo and video format 0x31384142.
Read DOCS/HTML/en/codecs.html!
==========================================================================

v4l2: ioctl set mute failed: Invalid argument
v4l2: 0 frames successfully processed, 0 frames dropped.

Exiting... (End of file)


Check what appears after using mplayer:
> dmesg | tail
usb 3-2: [sn9c102_open:1848] Video device /dev/video1 is open
sn9c102: VIDIOC_QUERYCAP<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_G_STD<7>sn9c102: VIDIOC_G_PARM<7>sn9c102: VIDIOC_ENUMSTD<7>sn9c102: VIDIOC_ENUMINPUT<7>sn9c102: VIDIOC_ENUMINPUT<7>sn9c102: VIDIOC_G_INPUT<7>sn9c102: VIDIOC_ENUM_FMT<7>sn9c102: VIDIOC_ENUM_FMT<7>sn9c102: VIDIOC_ENUM_FMT<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_S_FMT<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_S_FMT<7>sn9c102: VIDIOC_ENUMINPUT<7>sn9c102: VIDIOC_S_INPUT<7>sn9c102: VIDIOC_ENUMSTD<7>sn9c102: VIDIOC_ENUMSTD<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_G_FMT<7>sn9c102: VIDIOC_REQBUFS<7>sn9c102: VIDIOC_QUERYBUF<7>sn9c102: VIDIOC_QBUF<7>sn9c102: VIDIOC_QUERYBUF<7>sn9c102: VIDIOC_QBUF<7>sn9c102: VIDIOC_S_CTRL<7>sn9c102: VIDIOC_QUERYCTRL<7>sn9c102: VIDIOC_QUERYCTRL<7>sn9c102: VIDIOC_QUERYCTRL<7>sn9c102: VIDIOC_QUERYCTRL<7>sn9c102: VIDIOC_S_CTRL<7>sn9c102: VIDIOC_S_CTRL<6>usb 3-2: [sn9c102_release:1873] Video device /dev/video1 closed


> xawtv -hwscan
This is xawtv-3.95, running on Linux/x86_64 (2.6.28-rc6-bl)
looking for available devices
/dev/video0: OK                         [ -device /dev/video0 ]
    type : v4l2
    name : UVC Camera (05ca:183d)
    flags:  capture

/dev/video1: OK                         [ -device /dev/video1 ]
    type : v4l2
    name : SN9C1xx PC Camera
    flags:  capture


xawtv also doesn't work (black picture only):
> xawtv -c /dev/video1
This is xawtv-3.95, running on Linux/x86_64 (2.6.28-rc6-bl)
xinerama 0: 1600x900+0+0
WARNING: No DGA support available for this display.
/dev/video1 [v4l2]: no overlay support
v4l-conf had some trouble, trying to continue anyway
ioctl: VIDIOC_G_STD(std=0x7fff9cbea9c4 [PAL_G,PAL_D1,PAL_K,PAL_M,PAL_60,NTSC_M_JP,?,SECAM_D,SECAM_G,SECAM_H,SECAM_K,SECAM_K1,?ATSC_8_VSB,(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)]): Zły argument
ioctl: VIDIOC_S_CTRL(id=9963777;value=0): Zły argument
ioctl: VIDIOC_S_STD(std=0x0 []): Zły argument


Is there some additional info I could provide to help fix problem with this webcam?
Comment 1 Rafał Miłecki 2008-12-08 01:31:59 UTC
Created attachment 19205 [details]
Part of lsusb --verbose
Comment 2 Rafał Miłecki 2008-12-08 01:32:47 UTC
Created attachment 19206 [details]
My kernel configuration (/boot/config-2.6.28-rc6-bl)
Comment 3 Rafał Miłecki 2008-12-08 01:36:43 UTC
I can not add Luca Risolia to CC list:
> CC:   luca.risolia@studio.unibo.it did not match anything
Could someone, please?
Comment 4 Hans de Goede 2008-12-09 01:13:50 UTC
Rafal,

Luca is no longer maintaining the sn9c102 driver, nor is anyone else I'm afraid.

It is being replaced by the gspca driver. The gspca sonixb driver should support your cam. As both the sn9c102 driver and the gspca driver support it, the gspca driver contains conditional code to only enable its support when the sn9c102 driver is not compiled in to the kernel.

So pleae try compiling 2.6.28.rcX with the sn9c102 driver disabled and the gspca driver and all its subdrivers enabled.

Note then things will still not work, as the sn9c102 bridge produces data in a format most applications do not understand. As a solution to this I
I've written libv4l. You can get the latest version here:
http://people.atrpms.net/~hdegoede/libv4l-0.5.7.tar.gz

Then after unpacking do:
make
sudo make install PREFIX=/usr
or on a 64 bit system:
sudo make install PREFIX=/usr LIBDIR=/usr/lib64

Then run any applications like this:
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so xawtv
Or on a 64 bit system:
LD_PRELOAD=/usr/lib64/libv4l/v4l1compat.so xawtv

Distributions including OpenSUSE are working on integrating libv4l in to the distro and patching applications to directly use libv4l, so this will only be necessary temporarily (Shameless plug: in Fedora 10 libv4l is already fully integrated).

For more on libv4l see:
http://hansdegoede.livejournal.com/3636.html
http://hansdegoede.livejournal.com/6317.html
http://www.linuxtv.org/v4lwiki/index.php/Libv4l_Progress
Comment 5 Rafał Miłecki 2008-12-13 14:38:46 UTC
OK, first I tried 2.6.28-rc8 without sn9c102 and with full gspca. As you predicted, this didn't work. Then I tried mplayer with libv4l and it works fine now! I really hope libv4l will become standard soon.

How should I resolve/reject this bug? Description on http://bugzilla.kernel.org/page.cgi?id=fields.html#resolution doesn't cover available options.
Comment 6 Hans de Goede 2008-12-16 10:33:24 UTC
I guess the closest resolution is patch a;ready available, so i'm closing this with that as resolution.