Bug 11400

Summary: gspca driver in 2.6.27-rc4 doesn't work but out-of-tree gspca driver works with 2.6.26
Product: Drivers Reporter: Török Edwin (edwin+bugs)
Component: Video(Other)Assignee: Jean-Francois Moine (moinejf)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: andrej, colindarie, mchehab, moinejf
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27-rc4 Subsystem:
Regression: --- Bisected commit-id:
Attachments: 2.6.27-rc4 .config
2.6.27-rc4: cat /dev/video0 >tmp.jpg
2.6.27-rc4 .config
2.6.27-rc4 Camorama image splitted in 3 vertically

Description Török Edwin 2008-08-22 02:07:23 UTC
Latest working kernel version:
2.6.26 + out-of-tree gspca driver (apt-get install gspca-source)
Earliest failing kernel version:
2.6.27-rc, first to include gspca driver
Distribution:
 Debian sid
Hardware Environment:
Dell Inspiron 6400
lsusb:
Bus 005 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 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Software Environment:
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
 
Linux thunder 2.6.27-rc4 #46 SMP PREEMPT Thu Aug 21 09:21:51 EEST 2008 i686 GNU/Linux
 
Gnu C                  4.3.1
Gnu make               3.81
binutils               2.18.0.20080103
util-linux             2.13.1.1
mount                  2.13.1.1
module-init-tools      found
Linux C Library        2.7
Dynamic linker (ldd)   2.7
Procps                 3.2.7
Console-tools          0.2.3
oprofile               0.9.3
Sh-utils               6.10
udev                   125
Modules Loaded         gspca_zc3xx gspca_main videodev v4l1_compat aes_generic acpi_cpufreq cpufreq_userspace cpufreq_powersave fuse coretemp i8k i830 drm arc4 ecb crypto_blkcipher cryptomgr crypto_algapi iwl3945 rfkill mac80211 led_class cfg80211 video backlight output wmi snd_pcsp snd_hda_intel battery ac snd_pcm_oss snd_mixer_oss snd_pcm iTCO_wdt rtc_cmos rtc_core iTCO_vendor_support dcdbas snd_timer intel_agp snd_hwdep rtc_lib i2c_i801 i2c_core agpgart snd_page_alloc snd dm_mirror dm_log dm_snapshot b44 ssb pcmcia pcmcia_core

Problem Description:
When I boot the 2.6.27-rc4 kernel and plug in my USB webcam (Genius Look312p) camorama and xawtv can't use it. camorama says 'unable to capture image', and xawtv shows a black window. I enabled V4L1 compatibility but still the same.
I can grab some images via 'cat /dev/video0 >tmp.jpg', but the image is cut in the middle, or at the end (I have to interrupt cat to see the image).

If I boot 2.6.26 and compile the out-of-tree gspca driver, like this (on debian):
# m-a a-i gspcaLatest working kernel version:
2.6.26 + out-of-tree gspca driver (apt-get install gspca-source)
Earliest failing kernel version:
2.6.27-rc, first to include gspca driver
Distribution:
 Debian sid
Hardware Environment:
Dell Inspiron 6400
lsusb:
Bus 005 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 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Software Environment:
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
 
Linux thunder 2.6.27-rc4 #46 SMP PREEMPT Thu Aug 21 09:21:51 EEST 2008 i686 GNU/Linux
 
Gnu C                  4.3.1
Gnu make               3.81
binutils               2.18.0.20080103
util-linux             2.13.1.1
mount                  2.13.1.1
module-init-tools      found
Linux C Library        2.7
Dynamic linker (ldd)   2.7
Procps                 3.2.7
Console-tools          0.2.3
oprofile               0.9.3
Sh-utils               6.10
udev                   125
Modules Loaded         gspca_zc3xx gspca_main videodev v4l1_compat aes_generic acpi_cpufreq cpufreq_userspace cpufreq_powersave fuse coretemp i8k i830 drm arc4 ecb crypto_blkcipher cryptomgr crypto_algapi iwl3945 rfkill mac80211 led_class cfg80211 video backlight output wmi snd_pcsp snd_hda_intel battery ac snd_pcm_oss snd_mixer_oss snd_pcm iTCO_wdt rtc_cmos rtc_core iTCO_vendor_support dcdbas snd_timer intel_agp snd_hwdep rtc_lib i2c_i801 i2c_core agpgart snd_page_alloc snd dm_mirror dm_log dm_snapshot b44 ssb pcmcia pcmcia_core

Problem Description:
When I boot the 2.6.27-rc4 kernel and plug in my USB webcam (Genius Look312p) camorama and xawtv can't use it. camorama says 'unable to capture image', and xawtv shows a black window. I enabled V4L1 compatibility but still the same.
I can grab some images via 'cat /dev/video0 >tmp.jpg', but the image is cut in the middle, or at the end (I have to interrupt cat to see the image).

If I boot 2.6.26 and compile the out-of-tree gspca driver, like this (on debian):
# m-a a-i gspca
And plug in the webcam, both camorama and xawtv show the image.

I cannot compile the out-of-tree module with 2.6.27-rc4, because it doesn't find asm/semaphore.h.

Conclusion: webcam is unusable under 2.6.27-rc4 for me.

I thought that 2.6.27-rc4 included the gspca drivers from http://mxhaard.free.fr/download.html and updated them to work with V4L2, isn't that the case?

I don't know how to debug this any further, since I cannot bisect it (2.6.26 has out-of-tree driver).

Another thing to note:
2.6.26 without out-of-tree module does recognize the webcam, using the zc3xx driver, but it doesn't recognize the sensor chip ( HV7131R(c), which is not supported by mainline 2.6.26 AFAICT)

Steps to reproduce:
1. Boot 2.6.27-rc4
2. plug in Genius Look312p webcam
3. start camorama or xawtv -> no image

Output of dmesg from working 2.6.26 + out-of-tree gspca:
[  163.743215] usb 2-1: new full speed USB device using uhci_hcd and address 2
[  163.932532] usb 2-1: configuration #1 chosen from 1 choice
[  163.940510] usb 2-1: New USB device found, idVendor=0ac8, idProduct=301b
[  163.940520] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  163.940526] usb 2-1: Product: PC Camera
[  163.940530] usb 2-1: Manufacturer: Z-Star Corp.
[  164.078342] Linux video capture interface: v2.00
[  164.124306] gspca: USB GSPCA camera found.(ZC3XX) 
[  164.124306] gspca: [spca5xx_probe:4275] Camera type JPEG 
[  164.746017] gspca: [zc3xx_config:669] Find Sensor HV7131R(c)
[  164.749922] gspca: [spca5xx_getcapability:1249] maxw 640 maxh 480 minw 160 minh 120
[  164.749922] usbcore: registered new interface driver gspca
[  164.749922] gspca: gspca driver 01.00.20 registered
[  164.777251] zc0301: V4L2 driver for ZC0301[P] Image Processor and Control Chip v1:1.10
[  164.777251] usbcore: registered new interface driver zc0301
[  164.945611] gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
[  164.945611] gspca: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7

Output from bad 2.6.27-rc4:
[  117.326765] usb 3-1: new full speed USB device using uhci_hcd and address 2
[  117.569997] usb 3-1: configuration #1 chosen from 1 choice
[  117.573330] usb 3-1: New USB device found, idVendor=0ac8, idProduct=301b
[  117.573330] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  117.573330] usb 3-1: Product: PC Camera
[  117.573330] usb 3-1: Manufacturer: Z-Star Corp.
[  117.704208] Linux video capture interface: v2.00
[  117.754181] gspca: main v2.2.0 registered
[  117.794990] gspca: probing 0ac8:301b
[  119.359634] zc3xx: probe 2wr ov vga 0x0000
[  119.403629] zc3xx: probe sensor -> 11
[  119.403629] zc3xx: Find Sensor HV7131R(c)
[  119.407247] gspca: probe ok
[  119.407679] usbcore: registered new interface driver zc3xx
[  119.407986] zc3xx: registered
[  224.017012] zc3xx: probe 2wr ov vga 0x0000
Comment 1 Török Edwin 2008-08-22 02:08:29 UTC
Created attachment 17369 [details]
2.6.27-rc4 .config

.config
Comment 2 Török Edwin 2008-08-22 02:09:32 UTC
Created attachment 17370 [details]
2.6.27-rc4: cat /dev/video0 >tmp.jpg
Comment 3 Török Edwin 2008-08-22 02:10:36 UTC
I compiled the kernel with gcc-4.2.4, because I've heard that 4.3.1 breaks the kernel.
Comment 4 Colin Darie 2008-08-28 02:40:11 UTC
I can confirm this bug.
The gspca-source is working fine with <= 2.6.26, but not the module included in 2.6.27-rc4 (tested in each rc from 2.6.27-rc1).

Distribution : Debian Sid
Hardware: Toshiba Satellite P100-284 (i686)
Webcam : Logitech, Inc. QuickCam Chat
Product ID : 046d:092c
Driver : gspca_spca561


$ lsusb
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 046d:092c Logitech, Inc. QuickCam Chat
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


$ sh scripts/ver_linux
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux ivano 2.6.27-rc4 #1 SMP Fri Aug 22 16:27:25 CEST 2008 i686 GNU/Linux

Gnu C                  4.3.1
Gnu make               3.81
binutils               2.18.0.20080103
util-linux             2.13.1.1
mount                  2.13.1.1
module-init-tools      found
Linux C Library        2.7
Dynamic linker (ldd)   2.7
Procps                 3.2.7
Console-tools          0.2.3
Sh-utils               6.10
udev                   125
Modules Loaded         gspca_spca561 gspca_main videodev v4l1_compat nfnetlink_queue nfnetlink xt_mark xt_iprange xt_NFQUEUE xt_multiport binfmt_misc ipt_REJECT xt_tcpudp xt_state iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack iptable_filter ip_tables x_tables ipv6 acpi_cpufreq cpufreq_stats dm_crypt dm_mod aes_generic coretemp loop snd_hda_intel snd_pcm_oss snd_pcm snd_mixer_oss snd_seq_dummy snd_seq_oss snd_seq_midi arc4 snd_rawmidi ecb crypto_blkcipher snd_seq_midi_event snd_seq snd_timer iwl3945 snd_seq_device mac80211 rtc_cmos tifm_7xx1 rtc_core container led_class snd rtc_lib video iTCO_wdt serio_raw output tifm_core pcspkr cfg80211 battery i2c_i801 soundcore wmi button ac intel_agp agpgart i2c_core rng_core snd_page_alloc psmouse evdev ext3 jbd mbcache sg sr_mod cdrom sd_mod ide_pci_generic ide_core ata_generic sdhci_pci sdhci mmc_core ohci1394 ata_piix ieee1394 ehci_hcd libata scsi_mod dock uhci_hcd usbcore thermal processor fan thermal_sys


$ lsmod |grep -E "(gspca|v4l)" (in kernel 2.6.26)
gspca                 639888  0
videodev               27520  1 gspca
v4l1_compat            12260  1 videodev
usbcore               118160  4 gspca,ehci_hcd,uhci_hcd


$ dmesg
[ 2719.606415] usb 2-1: new full speed USB device using uhci_hcd and address 2
[ 2719.795409] usb 2-1: configuration #1 chosen from 1 choice
[ 2719.798109] usb 2-1: New USB device found, idVendor=046d, idProduct=092c
[ 2719.798109] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2719.798109] usb 2-1: Product: Camera
[ 2719.798109] usb 2-1: Manufacturer:
[ 2720.558778] Linux video capture interface: v2.00
[ 2720.609021] gspca: main v2.2.0 registered
[ 2720.622641] gspca: probing 046d:092c
[ 2720.627105] gspca: probe ok
[ 2720.627947] usbcore: registered new interface driver spca561
[ 2720.627947] spca561: registered

$ dmesg with 2.6.26 (debian kernel)
[  176.799946] usb 2-1: new full speed USB device using uhci_hcd and address 4
[  176.996521] usb 2-1: configuration #1 chosen from 1 choice
[  177.000280] gspca: USB GSPCA camera found.(SPCA561A)
[  177.000290] gspca: [spca5xx_probe:4275] Camera type S561
[  177.006264] gspca: [spca5xx_getcapability:1249] maxw 352 maxh 288 minw 160 minh 120
[  177.006409] usb 2-1: New USB device found, idVendor=046d, idProduct=092c
[  177.006416] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  177.006421] usb 2-1: Product: Camera
[  177.006424] usb 2-1: Manufacturer:
[  177.095587] gspca: [spca561_init:467] Find spca561 USB Product ID 92c
[  177.173272] gspca: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
[  177.173272] gspca: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 7


$ xawtv
This is xawtv-3.95.dfsg.1, running on Linux/i686 (2.6.27-rc4.22)
/dev/video0 [v4l2]: no overlay support
v4l-conf had some trouble, trying to continue anyway
Warning: Cannot convert string "-*-ledfixed-medium-r-*--39-*-*-*-c-*-*-*" to type FontStruct
Xlib:  extension "GLX" missing on display ":0.0".
no way to get: 384x288 32 bit TrueColor (LE: bgr-)

(xawtv shows a black screen.)

Camorama says "Unable to capture image (VIDIOCSYNC)" and shows a static image in black and white splitted vertically in 3 identical parts (cf attachment).

The usb ports are working fine with other hardware.
Comment 5 Colin Darie 2008-08-28 02:41:17 UTC
Created attachment 17500 [details]
2.6.27-rc4 .config
Comment 6 Colin Darie 2008-08-28 02:42:18 UTC
Created attachment 17501 [details]
2.6.27-rc4 Camorama image splitted in 3 vertically
Comment 7 Jean-Francois Moine 2008-09-25 03:52:36 UTC
There were many bugs in the gspa driver prior to the kernel 2.6.27-rc6.
May you get and test the last driver version at
   http://linuxtv.org/hg/~jfrancois/gspca/

Also, the new driver gives raw images to the applications.
You need the V4L library from Hans de Goede.
More information may be found in my page:
    http://moinejf.free.fr/
Comment 8 Colin Darie 2008-09-25 06:07:31 UTC
Yes, it works now for me since the -rc6 (and the git of today) with libv4l (0.4.3 and 0.5.0).

Thanks a lot !
Comment 9 Török Edwin 2008-09-25 07:55:52 UTC
(In reply to comment #7)
> There were many bugs in the gspa driver prior to the kernel 2.6.27-rc6.
> May you get and test the last driver version at
>    http://linuxtv.org/hg/~jfrancois/gspca/
> 

This works with the svv application.

> Also, the new driver gives raw images to the applications.
> You need the V4L library from Hans de Goede.
> More information may be found in my page:
>     http://moinejf.free.fr/
> 

I tried, but as soon as I use LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so the application crashes (tried camorama, xawtv, mplayer). Tried latest git and 0.5.0, 32-bit.

Without the library only svv is able to display the image, mplayer complains that it cannot seek.
Comment 10 Jean-Francois Moine 2008-09-25 10:22:11 UTC
(In reply to comment #9)
> This works with the svv application.
> 
> I tried, but as soon as I use LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so
> the application crashes (tried camorama, xawtv, mplayer). Tried latest git
> and
> 0.5.0, 32-bit.

May you give me more information about the crashes?

> Without the library only svv is able to display the image, mplayer complains
> that it cannot seek.

Did you call maplayer with v4l2, as:
    LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so \
    mplayer tv:// -tv driver=v4l2:width=352:height=288 -quiet
Comment 11 Török Edwin 2008-09-25 11:36:18 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > This works with the svv application.
> > 
> > I tried, but as soon as I use
> LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so
> > the application crashes (tried camorama, xawtv, mplayer). Tried latest git
> and
> > 0.5.0, 32-bit.
> 
> May you give me more information about the crashes?

Sorry, it was because I made a typo:
LD_PRELOAD= /usr/local/lib/libv4l/v4l1compat.so camorama
^segfaults

Instead of:
LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so camorama
^works

So it wasn't preloading anything, but trying to execute v4l1compat.so.
I removed execute permission from v4l1compat.so now to prevent such typos of mine in the future.

> 
> > Without the library only svv is able to display the image, mplayer
> complains
> > that it cannot seek.
> 
> Did you call maplayer with v4l2, as:
>     LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so \

I've used mplayer /dev/video0, which didn't work.

>     mplayer tv:// -tv driver=v4l2:width=352:height=288 -quiet
> 

Thanks, this works, but LD_PRELOAD is not needed in this case!

Everything is ok now, both the latest git from Linus's tree, and the one from 
http://linuxtv.org/hg/~jfrancois/gspca/ works.

Thanks for the assistance, you can close this bug now.
Comment 12 Andrej Podzimek 2008-10-30 16:16:31 UTC
My webcam still doesn't work with 2.6.27.4. Shell I try a git revision or wait for a new kernel version?

BTW, these weird messages probably have something in common with this bug:

BUG: unable to handle kernel NULL pointer dereference at 000001e7
IP: [<f02aef4a>] :usbcore:usb_hcd_unlink_urb+0xa/0x20
*pde = 00000000
Oops: 0000 [#1] PREEMPT
Modules linked in: quickcam pppoe pppox ppp_synctty ppp_async ppp_generic slhc aes_i586 aes_generic ieee80211_crypt_ccmp sit tunnel4 ipv6 pktcdvd rng_core video output usbhid ohci1394 ieee1394 tun ipw2200 ieee80211 ieee80211_crypt 8139too mii lp ppdev parport_pc parport ehci_hcd uhci_hcd ohci_hcd usbcore i915 drm pcspkr snd_intel8x0m evdev snd_seq_oss snd_intel8x0 snd_seq_midi_event snd_seq snd_seq_device snd_ac97_codec snd_pcm_oss snd_mixer_oss ac97_bus snd_pcm snd_page_alloc snd_rtctimer snd_timer snd soundcore rtc psmouse nsc_ircc irda crc_ccitt cpufreq_ondemand pcmcia yenta_socket rsrc_nonstatic pcmcia_core asus_laptop backlight speedstep_centrino freq_table lm90 hwmon i2c_i801

Pid: 12913, comm: camorama Not tainted (2.6.27.4-AP #1)
EIP: 0060:[<f02aef4a>] EFLAGS: 00010202 CPU: 0
EIP is at usb_hcd_unlink_urb+0xa/0x20 [usbcore]
EAX: 000001b7 EBX: ed5b3000 ECX: fffffffe EDX: ed5b3000
ESI: c3bf0080 EDI: ec13a000 EBP: ec143a80 ESP: d2d84ee0
 DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
Process camorama (pid: 12913, ti=d2d84000 task=c1c4d180 task.ti=d2d84000)
Stack: ed5b3000 f02b02f8 00000000 00001388 ed582600 e426a000 c3bf0080 e426a000
       c3bf0080 f05ada0c ec13a0fc 00000246 e426a000 f05adba7 00000008 c0176b84
       00000000 00000000 ef3fbc80 c3bf0080 dbefa180 00000000 00000044 c0173a27
Call Trace:
 [<f02b02f8>] usb_kill_urb+0x48/0xd0 [usbcore]
 [<f05ada0c>] qc_isoc_stop+0x2c/0x100 [quickcam]
 [<f05adba7>] qc_v4l_close+0x47/0xa0 [quickcam]
 [<c0176b84>] __fput+0x94/0x180
 [<c0173a27>] filp_close+0x47/0x80
 [<c0121ab6>] put_files_struct+0x96/0xc0
 [<c012317c>] do_exit+0xfc/0x7f0
 [<c0138166>] hrtimer_interrupt+0x196/0x1e0
 [<c012389a>] do_group_exit+0x2a/0xa0
 [<c010327d>] sysenter_do_call+0x12/0x25
 =======================
Code: 00 e8 5b 94 0d d0 8d 76 00 e9 46 ff ff ff 8d 76 00 e8 4b 94 0d d0 8d 76 00 eb 86 8d b6 00 00 00 00 53 89 c3 8b 40 28 89 d1 89 da <8b> 40 30 e8 ae fd ff ff ba 8d ff ff ff 5b 85 c0 0f 44 c2 c3 66
EIP: [<f02aef4a>] usb_hcd_unlink_urb+0xa/0x20 [usbcore] SS:ESP 0068:d2d84ee0
---[ end trace a92f79b75b44495c ]---
Fixing recursive fault but reboot is needed!
usb 1-2: USB disconnect, address 5