[Em28xx] [PATCH][RESEND-2] clean up the functions which shall have the prototype of v4l2_kioctl

2009-02-18 Thread Németh Márton
Hello Markus,

do you have any comments on this patch?

Regards,

Márton Németh

 Original message 
Subject: [Em28xx] [PATCH][RESEND] clean up the functions which shall have the 
prototype of v4l2_kioctl
Date: Sat, 31 Jan 2009 08:20:59 +0100
From: Németh Márton nm...@freemail.hu
To: Markus Rechberger mrechber...@gmail.com
CC: em28xx em28xx@mcentral.de
References: 49796834.4040...@freemail.hu 497973ec.5010...@freemail.hu   
497c6e66.6050...@freemail.hu

The inode parameter of typedef v4l2_kioctl was removed at Linux 2.6.28.
Then the return value of typedef v4l2_kioctl was changed from int to long in 
2.6.29-rc2 (or
earlier, but not before 2.6.29-rc1).

The function em28xx_v4l2_ioctl() should have the prototype of typedef 
v4l2_kioctl.
The function em28xx_video_do_ioctl() should have the prototype which match the 
last
parameter of video_usercopy().

I tested this patch with 2.6.27 and 2.6.28.

diff -r fef4aba53836 em28xx-video.c
--- a/em28xx-video.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/em28xx-video.c	Sun Jan 25 13:46:13 2009 +0100
@@ -1901,14 +1901,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg);
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg);
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+#endif
 #endif
 
 
@@ -2431,9 +2437,17 @@
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
- */
+ *
+ * This function have the prototype which match the last parameter
+ * of video_usercopy() as defined in linux/include/media/v4l2-ioctl.h
+ */
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
  unsigned int cmd, void *arg)
+#else
+static long em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#endif
 {
 	struct em28xx_fh *fh = filp-private_data;
 	struct em28xx *dev = fh-dev;
@@ -2866,7 +2880,7 @@
 		return 0;
 	}
 	default:
-		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
+		return em28xx_do_ioctl(NULL, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
 	}
 	return 0;
@@ -2876,14 +2890,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg)
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg)
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
+#endif
 #endif
 {
 	int ret = 0;

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Page allocation failure and memory leak

2009-02-18 Thread Németh Márton
Németh Márton wrote:
 Hi,
 car...@lavabit.com wrote:
 As always, thanks for your reply! However I've been pretty busy, so I've
 had no time yet to try what you suggested. It's gonna happen either next
 week or the week after.
 Anyways, things are getting weirder and weirder:
 When I use xine to watch DVB, everytime I switch channels 15 2k-blocks of
 memory are leaked (which probably means, memory is leaked somewhere in the
 ioctl). When I use VDR there seems to be no such leak (even when switching
 transponders). However, after running VDR for a couple of hours I suddenly
 starts to leak a thousands of 2k-blocks at a time. Then, nothing again for
 a few hours... and then it was like 5 or so blocks leaked every few
 seconds.
 
 I could reproduce your problem with Pinnacle Hybrid Pro Stick (320e) and
 with analog TV channels. Each time the VIDIOC_QUERYSTD ioctl is called,
 5 2kByte blocks are leaked. I also added some debug messages before each
 usb_alloc_urb() calls (see the attached em28xx_memleak.patch) and found
 that the memory is allocated at em28xx_init_isoc() when the VIDIOC_QUERYSTD
 ioctl() is executed, but the memory never gets freed.
 
 Steps to reproduce:
 1. execute the following command in an xterm window:
while true; do clear; cat /proc/slab_allocators |grep usb_alloc; sleep 1; 
 done
 2. Download v4l-test-0.7 from http://v4l-test.sourceforge.net/
 3. Apply the attached test_memleak.patch to v4l-test which will disable the 
 execution
of several test cases, but one.
 4. Complile the modified v4l-test
 5. Execute v4l-test
 
 Current result: Each time the VIDIOC_QUERYSTD ioctl() is called by the 
 modified
 v4l-test, 5 new size-2048 blocks appears in /proc/slab_allocators:
 
size-2048: 5 usb_alloc_urb+0xc/0x2b [usbcore]
 
 Expected result: after the v4l-test execution finished the size-2048 blocks
 shall be freed, thus it shall disappear from /proc/slab_allocators.

I have done some more on this topic. The attached em28xx_memleak2.patch adds 
some
debug messages and dumps out the reference counter of the allocated urbs.

[ 6398.299134] usb 4-3: new high speed USB device using ehci_hcd and address 45
[ 6398.428284] usb 4-3: configuration #1 chosen from 1 choice
[ 6398.793898] em28xx v4l2 driver version 0.0.1 loaded
[ 6398.796600] em28xx: new video device (eb1a:2881): interface 0, class 255
[ 6398.796617] em28xx: device is attached to a USB 2.0 bus
[ 6398.796708] em28xx #0: Alternate settings: 8
[ 6398.796720] em28xx #0: Alternate setting 0, max size= 0
[ 6398.796729] em28xx #0: Alternate setting 1, max size= 0
[ 6398.796737] em28xx #0: Alternate setting 2, max size= 1448
[ 6398.796745] em28xx #0: Alternate setting 3, max size= 2048
[ 6398.796753] em28xx #0: Alternate setting 4, max size= 2304
[ 6398.796762] em28xx #0: Alternate setting 5, max size= 2580
[ 6398.796770] em28xx #0: Alternate setting 6, max size= 2892
[ 6398.796778] em28xx #0: Alternate setting 7, max size= 3072
[ 6399.291421] attach_inform: tvp5150 detected.
[ 6399.339614] tvp5150 1-005c: tvp5150am1 detected.
[ 6400.930289] successfully attached tuner
[ 6400.937745] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[ 6400.951283] em28xx #0: V4L2 device registered as /dev/video0
[ 6400.951824] Remote control disabled with disable_ir parameter
[ 6400.951829] em28xx #0: Found Pinnacle Hybrid Pro
[ 6400.955937] usbcore: registered new interface driver em28xx
[ 6401.325946] em2880-dvb.c: DVB Init
[ 6401.653714] DVB: registering new adapter (em2880 DVB-T)
[ 6401.654821] DVB: registering adapter 0 frontend 0 (Zarlink ZL10353 DVB-T)...
[ 6401.675607] Em28xx: Initialized (Em2880 DVB Extension) extension
[ 6451.390677] tvp5150 1-005c: tvp5150am1 detected.
[ 6451.582766] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1299: 
usb_alloc_urb(64, GFP_KERNEL) = f6697360, urb-kref.refcount=1
[ 6451.583295] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1309: after 
usb_buffer_alloc(), urb=f6697360, urb-kref.refcount=1
[ 6451.583578] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1299: 
usb_alloc_urb(64, GFP_KERNEL) = f6696330, urb-kref.refcount=1
[ 6451.583920] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1309: after 
usb_buffer_alloc(), urb=f6696330, urb-kref.refcount=1
[ 6451.584284] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1299: 
usb_alloc_urb(64, GFP_KERNEL) = f6696b48, urb-kref.refcount=1
[ 6451.585010] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1309: after 
usb_buffer_alloc(), urb=f6696b48, urb-kref.refcount=1
[ 6451.585362] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1299: 
usb_alloc_urb(64, GFP_KERNEL) = f45b13a0, urb-kref.refcount=1
[ 6451.585706] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1309: after 
usb_buffer_alloc(), urb=f45b13a0, urb-kref.refcount=1
[ 6451.585986] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1299: 
usb_alloc_urb(64, GFP_KERNEL) = f45b0b88, urb-kref.refcount=1
[ 6451.586394] /usr/src/mcentral.de/em28xx-new/em28xx-core.c:1309: after 
usb_buffer_alloc(), urb=f45b0b88, urb-kref.refcount=1

Re: [Em28xx] Page allocation failure and memory leak

2009-02-15 Thread Németh Márton
Hi,
car...@lavabit.com wrote:
 As always, thanks for your reply! However I've been pretty busy, so I've
 had no time yet to try what you suggested. It's gonna happen either next
 week or the week after.
 Anyways, things are getting weirder and weirder:
 When I use xine to watch DVB, everytime I switch channels 15 2k-blocks of
 memory are leaked (which probably means, memory is leaked somewhere in the
 ioctl). When I use VDR there seems to be no such leak (even when switching
 transponders). However, after running VDR for a couple of hours I suddenly
 starts to leak a thousands of 2k-blocks at a time. Then, nothing again for
 a few hours... and then it was like 5 or so blocks leaked every few
 seconds.

I could reproduce your problem with Pinnacle Hybrid Pro Stick (320e) and
with analog TV channels. Each time the VIDIOC_QUERYSTD ioctl is called,
5 2kByte blocks are leaked. I also added some debug messages before each
usb_alloc_urb() calls (see the attached em28xx_memleak.patch) and found
that the memory is allocated at em28xx_init_isoc() when the VIDIOC_QUERYSTD
ioctl() is executed, but the memory never gets freed.

Steps to reproduce:
1. execute the following command in an xterm window:
   while true; do clear; cat /proc/slab_allocators |grep usb_alloc; sleep 1; 
done
2. Download v4l-test-0.7 from http://v4l-test.sourceforge.net/
3. Apply the attached test_memleak.patch to v4l-test which will disable the 
execution
   of several test cases, but one.
4. Complile the modified v4l-test
5. Execute v4l-test

Current result: Each time the VIDIOC_QUERYSTD ioctl() is called by the modified
v4l-test, 5 new size-2048 blocks appears in /proc/slab_allocators:

   size-2048: 5 usb_alloc_urb+0xc/0x2b [usbcore]

Expected result: after the v4l-test execution finished the size-2048 blocks
shall be freed, thus it shall disappear from /proc/slab_allocators.


 Hi,

 car...@lavabit.com wrote:
 Sorry it took me so long, I've had a busy week. Anyways, I tried
 em28xx-new and VDR on a different machine, with the same results.
 What I forgot to mention in my previous post: The page allocation
 failures
 only occur when I use the SLUB allocator.

 So, trying what you said I got some very interesting results:

 -size-2048: 5 usb_alloc_urb+0xf/0x40 [usbcore]
 +size-2048: 47825 usb_alloc_urb+0xf/0x40 [usbcore]
 This looks interesting. This means that the URBs, which are used to
 send and receive messages on the USB bus, are not free()d. (You can
 read more on this topic in Linux Device Drivers, Chapter 13: USB
 Drivers available from http://lwn.net/Kernel/LDD3/ .)

 You could try applying the gcov patch from
 http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/gcov-kernel/ ,
 you can find the description about this at
 http://ltp.sourceforge.net/coverage/gcov.php .

 Then enable code coverage for your kernel, recompile it, enable code
 coverage for em28xx-new driver also for the em28xx-new driver like shown
 in the attached patch. Then boot the new system, load gcov-proc module
 and reproduce the problem.

 Install lcov and genhtml (in Debian these commands are included in lcov
 package). Then you can fetch the code coverage results, which will also
 contain some counters: which line was executed how many times.

 Search in the em28xx-code for usb_alloc_urb() calls and try to find a line
 which has a similar number what you see in /proc/slab_allocators . If
 we are lucky this would point out the critical call.

 On the other hand, we should not exclude, yet, that the usb_alloc_urb() is
 called from different driver than em28xx-new.

 The first line is from right after pluging the card in and starting VDR,
 the second line is from about a day later.
 So I guess now it is about finding out what calles usb_alloc_urb?

 Kind regards,
 Carl

 car...@lavabit.com wrote:
 I tried the new driver version, but it unfortunately didn't make any
 difference.
 You might try checking the differences between the output of
 cat /proc/slab_allocators (without grep) in different time like this:

 $ cat /proc/slab_allocators result1.txt
 # ... do something here with the video device
 $ cat /proc/slab_allocators result2.txt
 $ diff -u result1.txt result2.txt

 Maybe the memory is not actually allocated in em28xx, but in a function
 which
 is called by em28xx driver.

 On Sat, Jan 10, 2009 at 10:17 PM,  car...@lavabit.com wrote:
 Hello again!

 I tried
 $ cat /proc/slab_allocators | grep em28xx
 The output was quite always the same:

 size-1024: 1 em2880_dvb_init+0x2c/0x990 [em28xx_dvb]
 size-512: 1 em28xx_audio_init+0x30/0x1a0 [em28xx_audio]
 size-512: 1 em28xx_init_dev+0x5dd/0xfc0 [em28xx]
 size-512: 1 em28xx_init_dev+0x8de/0xfc0 [em28xx]
 size-256: 1 em2880_ir_attach+0x52/0x200 [em28xx]
 size-64: 1 em28xx_usb_probe+0x27a/0x1c60 [em28xx]


 did you try to update the driver? recently a memory leak got fixed in
 the audio code.

 regards,
 Markus

 Sometimes there was also the line

 size-32: 1 em28xx_write_regs_req+0x58/0x170 [em28xx]

 at the 

[Em28xx] [PATCH][RESEND] clean up the functions which shall have the prototype of v4l2_kioctl

2009-01-30 Thread Németh Márton
The inode parameter of typedef v4l2_kioctl was removed at Linux 2.6.28.
Then the return value of typedef v4l2_kioctl was changed from int to long in 
2.6.29-rc2 (or
earlier, but not before 2.6.29-rc1).

The function em28xx_v4l2_ioctl() should have the prototype of typedef 
v4l2_kioctl.
The function em28xx_video_do_ioctl() should have the prototype which match the 
last
parameter of video_usercopy().

I tested this patch with 2.6.27 and 2.6.28.
diff -r fef4aba53836 em28xx-video.c
--- a/em28xx-video.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/em28xx-video.c	Sun Jan 25 13:46:13 2009 +0100
@@ -1901,14 +1901,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg);
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg);
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+#endif
 #endif
 
 
@@ -2431,9 +2437,17 @@
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
- */
+ *
+ * This function have the prototype which match the last parameter
+ * of video_usercopy() as defined in linux/include/media/v4l2-ioctl.h
+ */
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
  unsigned int cmd, void *arg)
+#else
+static long em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#endif
 {
 	struct em28xx_fh *fh = filp-private_data;
 	struct em28xx *dev = fh-dev;
@@ -2866,7 +2880,7 @@
 		return 0;
 	}
 	default:
-		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
+		return em28xx_do_ioctl(NULL, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
 	}
 	return 0;
@@ -2876,14 +2890,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg)
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg)
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
+#endif
 #endif
 {
 	int ret = 0;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] V4L/DVB (10151): Fix I2C bridge error in zl10353

2009-01-25 Thread Németh Márton
Patch from 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=899a6f67b90206c330bd93c7c8f3f8bb8b80397a

From: Dmitri Belimov d.beli...@gmail.com
Date: Tue, 23 Dec 2008 06:50:09 + (-0300)
Subject: V4L/DVB (10151): Fix I2C bridge error in zl10353

V4L/DVB (10151): Fix I2C bridge error in zl10353

Fix I2C bridge error in zl10353 if no tunner attached to internal I2C
bus of zl10353 chip.

When set enable bridge from internal I2C bus to the main I2C bus
(saa7134) the main I2C bus stopped very hardly. No any communication. In
our next board we solder additional resistors to internal I2C bus.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov d.beli...@gmail.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff -r fef4aba53836 zl10353/zl10353.c
--- a/zl10353/zl10353.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/zl10353/zl10353.c	Sun Jan 25 07:38:24 2009 +0100
@@ -604,7 +604,14 @@
 
 static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
 {
+	struct zl10353_state *state = fe-demodulator_priv;
 	u8 val = 0x0a;
+
+	if (state-config.no_tuner) {
+		/* No tuner attached to the internal I2C bus */
+		/* If set enable I2C bridge, the main I2C bus stopped hardly */
+		return 0;
+	}
 
 	if (enable)
 		val |= 0x10;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Tevion VS-USB2800D install

2009-01-25 Thread Németh Márton
Hi,
drew wrote:
 Hiya,
 
 I have just tried my cheap Tevion VS-USB2800D (same as Kworld with same 
 model no.) which is just a simple framegrabber with no tuner based on 
 the EM2820
 
 When plugged in it is detected as a PointNix Intra-Oral Camera... which 
 it of course is not. This is the dmesg output from whatever version of 
 the EM28xx driver is built into the Mandriva 2009 kernel 
 2.6.27.7-desktop-1mnb
 
 usb 1-2: new high speed USB device using ehci_hcd and address 4 
 usb 1-2: configuration #1 chosen from 1 choice 
 usb 1-2: New USB device found, idVendor=eb1a, idProduct=2820 
 usb 1-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 
 Linux video capture interface: v2.00 
 em28xx v4l2 driver version 0.1.0 loaded 

Version 0.1.0 means that you are using the em28xx driver from the Linux
kernel sources. Please try fetching the em28xx-new driver from
mcentral.de/hg/~mrec/em28xx-new . This driver will show version 0.0.1.
Please send some feedback whether the em28xx-new driver is working
for you or not.

 em28xx new video device (eb1a:2820): interface 0, class 255 
 em28xx Doesn't have usb audio class 
 em28xx #0: Alternate settings: 8 
 em28xx #0: Alternate setting 0, max size= 0 
 em28xx #0: Alternate setting 1, max size= 1024 
 em28xx #0: Alternate setting 2, max size= 1448 
 em28xx #0: Alternate setting 3, max size= 2048 
 em28xx #0: Alternate setting 4, max size= 2304 
 em28xx #0: Alternate setting 5, max size= 2580 
 em28xx #0: Alternate setting 6, max size= 2892 
 em28xx #0: Alternate setting 7, max size= 3072 
 em28xx #0: em28xx chip ID = 18 
 em28xx #0: found i2c device @ 0x4a [saa7113h] 
 em28xx #0: Your board has no unique USB ID. 
 em28xx #0: A hint were successfully done, based on i2c devicelist hash. 
 em28xx #0: This method is not 100% failproof. 
 em28xx #0: If the board were missdetected, please email this log to: 
 em28xx #0:  V4L Mailing List  video4linux-l...@redhat.com 
 em28xx #0: Board detected as PointNix Intra-Oral Camera 
 em28xx #0: Registering snapshot button... 
 input: em28xx snapshot button as /class/input/input5 
 saa7115' 4-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0) 
 em28xx #0: V4L2 device registered as /dev/video0 and /dev/vbi0 
 em28xx #0: Found PointNix Intra-Oral Camera 
 usbcore: registered new interface driver em28xx 
 em28xx-audio.c: probing for em28x1 non standard usbaudio 
 em28xx-audio.c: Copyright (C) 2006 Markus Rechberger 
 Em28xx: Initialized (Em28xx Audio Extension) extension 
 
 When I try to run an application such as Xawtv I do not get a picture, 
 but the device does activate (green LED comes on).
 
 So my questions, should I persevere with this version, or compile the 
 latest?
 
 If the first, how should I proceed to make it work? if the second how do 
 I disable the kernel version?
 
 BTW, I did have this working with Mandriva 2008.1, but I have no idea 
 what it was detected as.
 
 Thanks everso.



___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] clean up the functions which shall have the prototype of v4l2_kioctl

2009-01-25 Thread Németh Márton
Németh Márton wrote:
 Márton Németh wrote:
 The inode parameter of typedef v4l2_kioctl was removed at Linux 2.6.28.
 Then the return value of typedef v4l2_kioctl was changed from int to long in 
 2.6.29-rc2 (or
 earlier, but not before 2.6.29-rc1).

 Currently the functions em28xx_v4l2_ioctl() and em28xx_video_do_ioctl() 
 should
 have the prototype of typedef v4l2_kioctl. The reason for this is the call 
 of video_usercopy()
 function which takes a function pointer for its last argument. This pointer 
 should have
 the type v4l2_kioctl.
 
 I tested the patch with 2.6.27 and it seems that the #elsif cannot be used. 
 Please find
 attached the updated patch.

I tested 2.6.27 and 2.6.28 and some mistakes were still in this patch. I 
attached
one which is working with 2.6.27 and 2.6.28, too.

It seems that for supporting 2.6.29-rc2 more work is needed because the type of 
fops field
of struct video_device has been changed from struct file_operations to
struct v4l2_file_operations. See linux/include/media/v4l2-dev.h for more 
details.

Regards,

Márton Németh

diff -r fef4aba53836 em28xx-video.c
--- a/em28xx-video.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/em28xx-video.c	Sun Jan 25 13:46:13 2009 +0100
@@ -1901,14 +1901,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg);
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg);
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+#endif
 #endif
 
 
@@ -2431,9 +2437,17 @@
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
- */
+ *
+ * This function have the prototype which match the last parameter
+ * of video_usercopy() as defined in linux/include/media/v4l2-ioctl.h
+ */
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
  unsigned int cmd, void *arg)
+#else
+static long em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#endif
 {
 	struct em28xx_fh *fh = filp-private_data;
 	struct em28xx *dev = fh-dev;
@@ -2866,7 +2880,7 @@
 		return 0;
 	}
 	default:
-		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
+		return em28xx_do_ioctl(NULL, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
 	}
 	return 0;
@@ -2876,14 +2890,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg)
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg)
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
+#endif
 #endif
 {
 	int ret = 0;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] MSI Digivox A/D II working OK

2009-01-25 Thread Németh Márton
Dusan Stloukal wrote:
 Németh Márton napsal(a):
 Hi,
 Viktor Vraniak wrote:
   
 hi markus

 MSI Digivox A/D II now working for me. thanks.
 everything except analogue sound.

 i tried to set it like described here
 http://www.mcentral.de/wiki/index.php5/Em2880#watching_analogue_TV
 but i got I/O error in /dev/dsp1 access

 the same error i get if i use usbaudio_setup.sh script
 

 Do you have problems with the sound when whatching analogue TV
 channels or also if watching digital TV channels? (I don't know
 whether your device supports it and whether you have access to
 digital TV broadcast.)

 I have also audio problems only when watching analog TV channels
 with Pinnacle Hybrid Pro Stick (320e). My device only have an RF
 input and a USB connector. I could, however, find the analogue sound
 signals on EMP202 IC on pins 29 (AFILT1: ADC left anti-aliasing filter
 capacitor) and 30 (AFILT2: ADC right anti-aliasing filter capacitor).
 The signals I could connect to my sound card and this is my workaround
 to this problem.

 Note that the datasheet of EMP202 is available at
 http://pdf1.alldatasheet.com/datasheet-pdf/view/216366/ETC/EMP202.html

 Hi all,

 I have the same status with my DigiVox A/D II. DVB-T works great (using
 Kaffeine), but analogue sound doesn't work. I am using Fedora 8 with the

For me it is necessary to change the input source to Television when I
am using xawtv with analog channels. It is necessary even if xawtv already
shows that the input is Television. I don't know the reason for this. I
am using Pinnacle Hybrid Pro Stick (320e).

 latest kernel version (2.6.26.8-57.fc8) and I compiled latest version of
 em28xx-new.

 Because it is a little bit confusing process of building the drivers for
 Fedora, I attach my steps, which work:

1. cd /usr/local/src  hg clone
   http://mcentral.de/hg/~mrec/em28xx-new
   http://mcentral.de/hg/%7Emrec/em28xx-new
   http://mcentral.de/hg/%7Emrec/em28xx-new
2. install package kernel-devel-`uname -r`
3. the kernel-devel package doesn't include some needed files, so you
   must download kernel-`uname -r`.src.rpm and install it into your
   rpmbuild directory (thanks to Edward J. Sheldrake
   ejs1...@yahoo.co.uk)
4. rpmbuild -bp ~/rpmbuild/SPEC/kernel.spec
5. cd ~/rpmbuild/BUILD/kernel-version/linux-version.arch 
   make oldconfig  make prepare
6. copy from
   ~/rpmbuild/BUILD/kernel-version/linux-version.arch/ to
   /usr/src/kernels/`uname -r`-`uname -m`/ some directories:
   * drivers/media/dvb/dvb-core/
   * drivers/media/dvb/frontends/
   * drivers/media/video/
7. cd /usr/local/src/em28xx-new  ./build.sh build  ./build.sh install
8. modules will load automatically after attaching your device



___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Page allocation failure and memory leak

2009-01-25 Thread Németh Márton
car...@lavabit.com wrote:
 I tried the new driver version, but it unfortunately didn't make any
 difference.

You might try checking the differences between the output of
cat /proc/slab_allocators (without grep) in different time like this:

$ cat /proc/slab_allocators result1.txt
# ... do something here with the video device
$ cat /proc/slab_allocators result2.txt
$ diff -u result1.txt result2.txt

Maybe the memory is not actually allocated in em28xx, but in a function which
is called by em28xx driver.

 On Sat, Jan 10, 2009 at 10:17 PM,  car...@lavabit.com wrote:
 Hello again!

 I tried
 $ cat /proc/slab_allocators | grep em28xx
 The output was quite always the same:

 size-1024: 1 em2880_dvb_init+0x2c/0x990 [em28xx_dvb]
 size-512: 1 em28xx_audio_init+0x30/0x1a0 [em28xx_audio]
 size-512: 1 em28xx_init_dev+0x5dd/0xfc0 [em28xx]
 size-512: 1 em28xx_init_dev+0x8de/0xfc0 [em28xx]
 size-256: 1 em2880_ir_attach+0x52/0x200 [em28xx]
 size-64: 1 em28xx_usb_probe+0x27a/0x1c60 [em28xx]


 did you try to update the driver? recently a memory leak got fixed in
 the audio code.

 regards,
 Markus

 Sometimes there was also the line

 size-32: 1 em28xx_write_regs_req+0x58/0x170 [em28xx]

 at the bottom. One thing though: I don't get any page allocation
 failures
 anymore. I'll try to find out whether this was due to using the  SLAB
 allocator now instead of SLUB or due to a kernel upgrade. The memory
 leak
 is still there, however.
 Plus, I have yet to try valgrind.

 Markus, did you find anything yet?

 Regards, Carl



 Hi Carl,

 Markus Rechberger wrote:
 On Sat, Dec 20, 2008 at 7:10 PM,  car...@lavabit.com wrote:
 Carl wrote:
 I own a Pinnacle PCTV Hybrid Pro (em2882) and I have a little home
 server
 running vdr. However, the server runs out of memory after about a
 week,
 which doesn't happen when the em28xx-drivers aren't loaded and the
 device
 isn't plugged in. Apperently no userspace process is using all the
 memory
 (see attached output of top -- top-with-em28xx.txt), which makes me
 think
 it has something to do with the driver. I am only watching DVB-T, so
 it
 should have nothing to do with the sound-device memory leak. I
 checked
 out
 the mercurial-repository about a week ago, when I rebooted the
 server
 and
 plugged in my PCTV, so the driver is fairly recent too. For
 comparison, I
 also attached the output of top after the server was running for 10
 days
 without em28xx + vdr (top-without-em28xx.txt).
 Additionally I get quite frequent page allocation failure messages
 from
 vdr in my syslog (see page-allocation-failure.txt), which may be
 related
 to the above problem.
 I am using a 2.6.27 kernel now, but these problems have also
 persisted
 in
 2.6.26. Couldn't try 2.6.25 since the driver didn't work too well,
 neither
 2.6.24 because nfs4 would cause kernel panics after only minutes.
 Unfortunately I do not have another DVB-T card to test.
 If there is something I can do, let me know, but I don't even have
 an
 idea
 where to start.

 Two weeks now and no reply? Isn't anyone experiencing similar
 problems?
 Am
 I the only one who is using his DVB device 24/7? Or am I missing
 something
 very obvious and am I making a fool of myself?
 Markus, you'd know your own driver best -- aren't there any hints you
 could give me as to where to start looking? Im not experienced at all
 as
 far as linux kernel internals are concerned.
 I haven't experienced that issue yet I looked through the
 corresponding driver and
 couldn't find anything that looks suspicious.
 I'll allocate a box for testing it for a week after Christmas.
 Carl, in the meantime Markus can test this, you can try the following
 things:

  - compile your kernel with CONFIG_DEBUG_SLAB=y and
 CONFIG_DEBUG_SLAB_LEAK=y
This will create the /proc/slab_allocators which contains
 information
 about
who is allocated memory. You can easily analyze the content with the
following one-liner shell command:

while true; do clear; cat /proc/slab_allocators | grep em28xx;
 sleep 1; done

  - you can restrict the available memory with the mem kernel
 parameter
 (see
linux/Documentation/kernel-parameters.txt). You can also disable
 swap
 space with
swapoff -a. This means that you will reach the out of memory
 condition
much faster.

  - you can try to use Valgrind ( http://valgrind.org/ ) with the user
 space vdr
application. Although you mentioned that you don't think the user
 space
application leaks, this might show some unexpected results.

 Regards,

   Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] remove #if 1 from zl10353

2009-01-24 Thread Németh Márton
Remove #if 1 from zl10353 so we are closer to the current
linux-2.6.28/drivers/media/dvb/frontends/zl10353.c implementation.

diff -r fef4aba53836 zl10353/zl10353.c
--- a/zl10353/zl10353.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/zl10353/zl10353.c	Sat Jan 24 12:48:47 2009 +0100
@@ -46,9 +46,7 @@
 		if (debug) printk(KERN_DEBUG zl10353:  args); \
 	} while (0)
 
-#if 1
 static int debug_regs;
-#endif
 
 static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
 {
@@ -97,7 +95,6 @@
 	return b1[0];
 }
 
-#if 1
 static void zl10353_dump_regs(struct dvb_frontend *fe)
 {
 	struct zl10353_state *state = fe-demodulator_priv;
@@ -123,7 +120,6 @@
 	}
 	printk(KERN_DEBUG %s\n, buf);
 }
-#endif
 
 static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
   enum fe_bandwidth bandwidth,
@@ -543,10 +539,8 @@
 	struct zl10353_state *state = fe-demodulator_priv;
 	u8 _snr;
 
-#if 1
 	if (debug_regs)
 		zl10353_dump_regs(fe);
-#endif
 
 	_snr = zl10353_read_register(state, SNR);
 	*snr = (_snr  8) | _snr;
@@ -581,10 +575,8 @@
 	u8 zl10353_reset_attach[6] = { 0x50, 0x03, 0x64, 0x46, 0x15, 0x0F };
 	int rc = 0;
 
-#if 1
 	if (debug_regs)
 		zl10353_dump_regs(fe);
-#endif
 	if (state-config.parallel_ts)
 		zl10353_reset_attach[2] = ~0x20;
 
@@ -593,10 +585,8 @@
 	zl10353_read_register(state, 0x51) != zl10353_reset_attach[2]) {
 		rc = zl10353_write(fe, zl10353_reset_attach,
    sizeof(zl10353_reset_attach));
-#if 1
 		if (debug_regs)
 			zl10353_dump_regs(fe);
-#endif
 	}
 
 	return 0;
@@ -687,10 +677,8 @@
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Turn on/off frontend debugging (default:off).);
 
-#if 1
 module_param(debug_regs, int, 0644);
 MODULE_PARM_DESC(debug_regs, Turn on/off frontend register dumps (default:off).);
-#endif
 
 MODULE_DESCRIPTION(Zarlink ZL10353 DVB-T demodulator driver);
 MODULE_AUTHOR(Chris Pascoe);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] differences in em28xx-new and current Linux zl10353.c implementation

2009-01-24 Thread Németh Márton
Hello Markus,

do you know the reason for these differences?

diff -upr em28xx-new/zl10353/zl10353.c 
/usr/src/linux-2.6.28/drivers/media/dvb/frontends/zl10353.c
--- em28xx-new/zl10353/zl10353.c2009-01-24 12:46:58.0 +0100
+++ /usr/src/linux-2.6.28/drivers/media/dvb/frontends/zl10353.c 2008-12-25 
00:26:37.0 +0100
@@ -206,8 +206,8 @@ static int zl10353_set_parameters(struct
zl10353_single_write(fe, 0xEA, 0x01);
udelay(200);
zl10353_single_write(fe, 0xEA, 0x00);
-   
-   zl10353_single_write(fe, AGC_TARGET, 0x31);
+
+   zl10353_single_write(fe, AGC_TARGET, 0x28);

if (op-transmission_mode != TRANSMISSION_MODE_AUTO)
acq_ctl |= (1  0);
@@ -218,27 +218,17 @@ static int zl10353_set_parameters(struct
switch (op-bandwidth) {
case BANDWIDTH_6_MHZ:
/* These are extrapolated from the 7 and 8MHz values */
-#if 0
zl10353_single_write(fe, MCLK_RATIO, 0x97);
zl10353_single_write(fe, 0x64, 0x34);
-#endif
-   
-   zl10353_single_write(fe, MCLK_RATIO, 0x9c);
-   zl10353_single_write(fe, 0x64, 0x3c);
-   zl10353_single_write(fe, 0xcc, 0xdd);
-
break;
case BANDWIDTH_7_MHZ:
zl10353_single_write(fe, MCLK_RATIO, 0x86);
zl10353_single_write(fe, 0x64, 0x35);
-   zl10353_single_write(fe, 0xcc, 0x73);
-
break;
case BANDWIDTH_8_MHZ:
default:
zl10353_single_write(fe, MCLK_RATIO, 0x75);
zl10353_single_write(fe, 0x64, 0x36);
-   zl10353_single_write(fe, 0xcc, 0x73);
}

zl10353_calc_nominal_rate(fe, op-bandwidth, nominal_rate);
@@ -377,7 +367,7 @@ static int zl10353_set_parameters(struct
zl10353_write(fe, pllbuf, sizeof(pllbuf));
}

-   zl10353_single_write(fe, 0x5F, 0x12);
+   zl10353_single_write(fe, 0x5F, 0x13);

/* If no attached tuner or invalid PLL registers, just start the FSM. */
if (state-config.no_tuner || fe-ops.tuner_ops.calc_regs == NULL)

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] differences in em28xx-new and current Linux zl10353.c implementation

2009-01-24 Thread Németh Márton
Hi,
Németh Márton wrote:
 Hello Markus,
 
 do you know the reason for these differences?
 
 diff -upr em28xx-new/zl10353/zl10353.c 
 /usr/src/linux-2.6.28/drivers/media/dvb/frontends/zl10353.c
 --- em28xx-new/zl10353/zl10353.c  2009-01-24 12:46:58.0 +0100
 +++ /usr/src/linux-2.6.28/drivers/media/dvb/frontends/zl10353.c   
 2008-12-25 00:26:37.0 +0100
 @@ -206,8 +206,8 @@ static int zl10353_set_parameters(struct
   zl10353_single_write(fe, 0xEA, 0x01);
   udelay(200);
   zl10353_single_write(fe, 0xEA, 0x00);
 - 
 - zl10353_single_write(fe, AGC_TARGET, 0x31);
 +
 + zl10353_single_write(fe, AGC_TARGET, 0x28);
 
   if (op-transmission_mode != TRANSMISSION_MODE_AUTO)
   acq_ctl |= (1  0);
 @@ -218,27 +218,17 @@ static int zl10353_set_parameters(struct
   switch (op-bandwidth) {
   case BANDWIDTH_6_MHZ:
   /* These are extrapolated from the 7 and 8MHz values */
 -#if 0
   zl10353_single_write(fe, MCLK_RATIO, 0x97);
   zl10353_single_write(fe, 0x64, 0x34);
 -#endif
 - 
 - zl10353_single_write(fe, MCLK_RATIO, 0x9c);
 - zl10353_single_write(fe, 0x64, 0x3c);
 - zl10353_single_write(fe, 0xcc, 0xdd);
 -
   break;
   case BANDWIDTH_7_MHZ:
   zl10353_single_write(fe, MCLK_RATIO, 0x86);
   zl10353_single_write(fe, 0x64, 0x35);
 - zl10353_single_write(fe, 0xcc, 0x73);
 -
   break;
   case BANDWIDTH_8_MHZ:
   default:
   zl10353_single_write(fe, MCLK_RATIO, 0x75);
   zl10353_single_write(fe, 0x64, 0x36);
 - zl10353_single_write(fe, 0xcc, 0x73);
   }
 
   zl10353_calc_nominal_rate(fe, op-bandwidth, nominal_rate);
 @@ -377,7 +367,7 @@ static int zl10353_set_parameters(struct
   zl10353_write(fe, pllbuf, sizeof(pllbuf));
   }
 
 - zl10353_single_write(fe, 0x5F, 0x12);
 + zl10353_single_write(fe, 0x5F, 0x13);
 
   /* If no attached tuner or invalid PLL registers, just start the FSM. */
   if (state-config.no_tuner || fe-ops.tuner_ops.calc_regs == NULL)


OK, I have done my homework: I found some related changesets:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a9dbe5dc2e9337f1c7fab16963753aaf3f5283be
 From: Markus Rechberger mrechber...@gmail.com
 Date: Fri, 24 Oct 2008 15:15:08 + (-0300)
 Subject: V4L/DVB (9362): zl10353: add new register configuration for 
 zl10353/especially 6mhz ...

 V4L/DVB (9362): zl10353: add new register configuration for 
 zl10353/especially 6mhz taiwan.

 Signed-off-by: Markus Rechberger mrechber...@sundtek.de
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
 ---

 diff --git a/drivers/media/dvb/frontends/zl10353.c 
 b/drivers/media/dvb/frontends/zl10353.c
 index 36a5a1c..5506f80 100644
 --- a/drivers/media/dvb/frontends/zl10353.c
 +++ b/drivers/media/dvb/frontends/zl10353.c
 @@ -220,15 +220,18 @@ static int zl10353_set_parameters(struct dvb_frontend 
 *fe,
   /* These are extrapolated from the 7 and 8MHz values */
   zl10353_single_write(fe, MCLK_RATIO, 0x97);
   zl10353_single_write(fe, 0x64, 0x34);
 + zl10353_single_write(fe, 0xcc, 0xdd);
   break;
   case BANDWIDTH_7_MHZ:
   zl10353_single_write(fe, MCLK_RATIO, 0x86);
   zl10353_single_write(fe, 0x64, 0x35);
 + zl10353_single_write(fe, 0xcc, 0x73);
   break;
   case BANDWIDTH_8_MHZ:
   default:
   zl10353_single_write(fe, MCLK_RATIO, 0x75);
   zl10353_single_write(fe, 0x64, 0x36);
 + zl10353_single_write(fe, 0xcc, 0x73);
   }

   zl10353_calc_nominal_rate(fe, op-bandwidth, nominal_rate);

But still, there are some other differences.

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-24 Thread Németh Márton
Devin Heitmueller wrote:
 On Sat, Jan 24, 2009 at 2:26 AM, Németh Márton nm...@freemail.hu wrote:
 Dear Devin and Mauro,

 we have some problems with Terratec Prodigy (DVBT) USB and Pinnacle 
 Hybrid Pro Stick (320e)
 since the patch shown below: when the patch is applied, we are not able to 
 tune any digital
 channels any more using the driver from mcentral.de/hg/~mrec/em28xx-new .

 Could you please explain a little bit in more detail (or give us a reference 
 where it is described)
 what the functions ops.i2c_gate_ctrl() and ops.tuner_ops.sleep() supposed to 
 do?

 Regards,

Márton Németh

 Waldemar Brodkorb wrote:
 Németh Márton wrote,
 I have investigated this problem and tried the following kernel versions:

 2.6.27  good
 2.6.28-rc2  good
 2.6.28-rc4  good
 2.6.28-rc5  bad

 So it seems that some change(s) between 2.6.28-rc4 and 2.6.28-rc5 broke 
 the digital channel tuning.
 Yes, you are right. These two lines break the channel tuning:

 diff -Nur linux-2.6.28-rc4/drivers/media/dvb/dvb-core/dvb_frontend.c 
 linux-2.6.28-rc5/drivers/media/dvb/dvb-core/dvb_frontend.c
 --- linux-2.6.28-rc4/drivers/media/dvb/dvb-core/dvb_frontend.c  2008-11-10 
 01:36:15.0 +0100
 +++ linux-2.6.28-rc5/drivers/media/dvb/dvb-core/dvb_frontend.c  2008-11-15 
 22:42:56.0 +0100
 @@ -223,6 +223,8 @@
 if (fe-ops.init)
 fe-ops.init(fe);
 if (fe-ops.tuner_ops.init) {
 +   if (fe-ops.i2c_gate_ctrl)
 +   fe-ops.i2c_gate_ctrl(fe, 1);
 fe-ops.tuner_ops.init(fe);
 if (fe-ops.i2c_gate_ctrl)
 fe-ops.i2c_gate_ctrl(fe, 0);

 If I recompile my 2.6.28 kernel without these two lines, everything works 
 fine.

 Who understands why this breaks the em28xx-new modules and probably not the
 included drivers.
 I found the patch at
 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=41286d972530b7a47acb48376d714b6b121a6c22

 Here is the description:
 From: Devin Heitmueller devin.heitmuel...@gmail.com
 Date: Sun, 16 Nov 2008 03:44:52 + (-0300)
 Subject: V4L/DVB (9634): Make sure the i2c gate is open before powering 
 down tuner

 V4L/DVB (9634): Make sure the i2c gate is open before powering down tuner

 It is not safe to assume that the i2c gate will be open before issuing the
 command to power down the tuner.  In fact, many demods only open the gate
 long enough to issue the tuning command.

 This fix allows power management to work properly for those tuners behind an
 i2c gate (in my case the problem was with the HVR-950Q)

 Signed-off-by: Devin Heitmueller devin.heitmuel...@gmail.com
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com
 ---

 diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
 b/drivers/media/dvb/dvb-core/dvb_frontend.c
 index b38cebe..7a421e9 100644
 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c
 +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
 @@ -585,6 +585,8 @@ restart:
   if (fe-ops.set_voltage)
   fe-ops.set_voltage(fe, SEC_VOLTAGE_OFF);
   if (fe-ops.tuner_ops.sleep) {
 + if (fe-ops.i2c_gate_ctrl)
 + fe-ops.i2c_gate_ctrl(fe, 1);
   fe-ops.tuner_ops.sleep(fe);
   if (fe-ops.i2c_gate_ctrl)
   fe-ops.i2c_gate_ctrl(fe, 0);


 
 Hello Márton,
 
 First, some background:  Some hardware designs prevent i2c access to
 the tuner chip unless you explicitly open what's known as an i2c gate.
  The i2c gate is usually in the demodulator, and blocks all i2c
 traffic to the tuner.  This is typically done to improve the tuner
 chip's performance, as the chip does not need to look at the i2c
 traffic.  When you want to send the tuner commands, you open the i2c
 gate, send the command, and then close the gate.
 
 The bug that I fixed was a case where the i2c gate was not being
 opened before the dvb frontend sent a command to power down the tuner
 at idle (a good practice for USB devices to save power when it is not
 in use).
 
 Now, in this case, it is possible that there was some other bug in the
 driver for the tuner chip, but it was not being seen before my fix was
 made because the tuner was not being sent the power down command
 (because the i2c gate blocked the traffic).  It is certainly possible
 that my fix exposed this other bug.
 
 Because you are using an out-of-kernel driver, you will need to take
 this up with the maintainer for the em28xx-new codebase.

Dear Devin,

thank you for your response.

I found a changeset for zl10353 which might be related to our problem:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=899a6f67b90206c330bd93c7c8f3f8bb8b80397a
 From: Dmitri Belimov d.beli...@gmail.com
 Date: Tue, 23 Dec 2008 06:50:09 + (-0300)
 Subject: V4L/DVB (10151): Fix I2C bridge error in zl10353

 V4L/DVB (10151): Fix I2C bridge

Re: [Em28xx] [PATCH] inode parameter of video_usercopy() removed

2009-01-22 Thread Németh Márton
Hi Markus,

Németh Márton wrote:
 The inode parameter of video_usercopy() is removed between 2.6.28 and
 2.6.29-rc2. Remove from em28xx-new driver also.
 
 Note that the video_usercopy() is deprecated.

Do you have any comments to this patch? I attached it again.

Regards,

Márton Németh
diff -r bd9f074ca2ab em28xx-video.c
--- a/em28xx-video.c	Thu Jan 15 19:54:26 2009 +0100
+++ b/em28xx-video.c	Sat Jan 17 14:51:06 2009 +0100
@@ -2892,7 +2892,11 @@
 		return -EIO;
 	}
 
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 	ret = video_usercopy(NULL, filp, cmd, (unsigned long)arg, em28xx_video_do_ioctl);
+#else
+	ret = video_usercopy(filp, cmd, (unsigned long)arg, em28xx_video_do_ioctl);
+#endif
 
 	return ret;
 }
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] clean up the functions which shall have the prototype of v4l2_kioctl

2009-01-22 Thread Németh Márton
The inode parameter of typedef v4l2_kioctl was removed at Linux 2.6.28.
Then the return value of typedef v4l2_kioctl was changed from int to long in 
2.6.29-rc2 (or
earlier, but not before 2.6.29-rc1).

Currently the functions em28xx_v4l2_ioctl() and em28xx_video_do_ioctl() should
have the prototype of typedef v4l2_kioctl. The reason for this is the call of 
video_usercopy()
function which takes a function pointer for its last argument. This pointer 
should have
the type v4l2_kioctl.
diff -r fef4aba53836 em28xx-video.c
--- a/em28xx-video.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/em28xx-video.c	Fri Jan 23 07:42:48 2009 +0100
@@ -1901,13 +1901,17 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg);
-#else
+#elsif LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg);
 #endif
 
@@ -2431,9 +2435,20 @@
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
- */
+ *
+ * This function have the prototype v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
+ */
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
  unsigned int cmd, void *arg)
+#elsif LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
+static int em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#else
+static long em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#endif
 {
 	struct em28xx_fh *fh = filp-private_data;
 	struct em28xx *dev = fh-dev;
@@ -2866,7 +2881,7 @@
 		return 0;
 	}
 	default:
-		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
+		return em28xx_do_ioctl(NULL, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
 	}
 	return 0;
@@ -2876,13 +2891,17 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg)
-#else
+#elsif LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg)
 #endif
 {
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Grabshow 100 with em28xx

2009-01-22 Thread Németh Márton

To Markus: Hello Markus, could you please check this dmesg trace? I wrote my 
analysis, but I
have some problems proposing a possible solution.

ogre5000 wrote:
 Hello,
 
 Am 22.01.2009 um 07:34 schrieb Németh Márton:
 I couldn't really find a simple testcase which triggers this problem, but
 I analysed the source code and found that the function prototype
 v4l2_kioctl
 changed between Linux kernel 2.6.27 and 2.6.28: the inode parameter
 was removed.

 Last time when I updated the em28xx-new I forget this fact. I just sent a
 patch titled [PATCH] remove inode parameter of typedef v4l2_kioctl as
 of 2.6.28.
 Could you please apply and test the new version of em28xx-new driver?

 Here we can see that (null) is written to the output instead of a
 readable
 input and norm parameter. This usually signals that there might be
 some return
 value check missing in the code.

 This mmap2() calls also do not look like very good: -1 is the fd
 parameter which
 shall be positive. The -1 is an error code which comes from a previous
 system call
 and it is not a valid file descriptor.
 
 What can I do against it? I installed the latest release with this patch

I don't know, yet what can you do against this -1 file descriptor.

 applied. This didn't change anything. But notice that I have Kernel
 2.6.27.7-9 anyway, not 2.6.28.x.

There are changes in the dmesg, now you get a different error message,
so at least one problem is fixed, I think.

 Here you see dmesg (interesting lines cut out) again with the new patch
 applied. First after trying ZoneMinder

 em28xx v4l2 driver version 0.0.1 loaded
 em28xx: new video device (eb1a:2800): interface 0, class 255
 em28xx: device is attached to a USB 2.0 bus
 em28xx #0: Alternate settings: 4
 em28xx #0: Alternate setting 0, max size= 0
 em28xx #0: Alternate setting 1, max size= 644
 em28xx #0: Alternate setting 2, max size= 1288
 em28xx #0: Alternate setting 3, max size= 2580
 saa7115' 1-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0)
 attach_inform: saa7113 detected.
 em28xx #0: V4L2 device registered as /dev/video1
 em28xx #0: Found Terratec Cinergy 200 USB
 usbcore: registered new interface driver em28xx

 The following is only an harmless informational message.
 Unless you get a _continuous_flood_ of these messages it means
 everything is working fine. Allocations from irqs cannot be
 perfectly reliable and the kernel is designed to handle that.
 zmc: page allocation failure. order:6, mode:0x0, alloc_flags:0x5, 
 pflags:0x402000
 Pid: 3313, comm: zmc Tainted: G  D   2.6.27.7-debug2 #2
  [c01065d4] dump_trace+0x63/0x227
  [c010702b] show_trace+0x15/0x29
  [c0348341] dump_stack+0x5b/0x65
  [c0177f2b] __alloc_pages_internal+0x38b/0x3a2
  [c01087bf] dma_alloc_pages+0x51/0x59
  [c0108889] dma_alloc_coherent+0xc2/0x24e
  [e1053375] hcd_buffer_alloc+0x65/0x6d [usbcore]
  [e104729f] usb_buffer_alloc+0x16/0x1d [usbcore]
  [e1aa47de] em28xx_init_isoc+0x9b/0x19c [em28xx]
  [e1aa1063] em28xx_v4l2_open+0x46d/0x516 [em28xx]
  [e10d919c] video_open+0xcc/0x12b [videodev]
  [c01a185b] chrdev_open+0x13b/0x152
  [c019dc57] __dentry_open+0x10f/0x1fd
  [c019ddcc] nameidata_to_filp+0x1f/0x33
  [c01a914c] do_filp_open+0x33c/0x65b
  [c019da6e] do_sys_open+0x42/0xbd
  [c019db2b] sys_open+0x1e/0x26
  [c0104bdb] sysenter_do_call+0x12/0x3f
  [e430] 0xe430
  ===
 Mem-Info:
 Node 0 DMA per-cpu:
 CPU0: hi:0, btch:   1 usd:   0
 Node 0 Normal per-cpu:
 CPU0: hi:  186, btch:  31 usd:  86
 Active:52879 inactive:50696 dirty:84 writeback:0 unstable:0
  free:1081 slab:8988 mapped:17111 pagetables:409 bounce:0
 Node 0 DMA free:2028kB min:88kB low:108kB high:132kB active:1296kB 
 inactive:2252kB present:15708kB pages_scanned:32 all_unreclaimable? no
 lowmem_reserve[]: 0 481 481 481
 Node 0 Normal free:2296kB min:2760kB low:3448kB high:4140kB active:210220kB 
 inactive:200532kB present:492704kB pages_scanned:0 all_unreclaimable? no
 lowmem_reserve[]: 0 0 0 0
 Node 0 DMA: 7*4kB 0*8kB 1*16kB 0*32kB 1*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 
 0*2048kB 0*4096kB = 2028kB
 Node 0 Normal: 150*4kB 0*8kB 0*16kB 1*32kB 0*64kB 5*128kB 0*256kB 0*512kB 
 1*1024kB 0*2048kB 0*4096kB = 2296kB
 85571 total pagecache pages
 6 pages in swap cache
 Swap cache stats: add 6, delete 0, find 0/0
 Free swap  = 1574304kB
 Total swap = 1574328kB
 131040 pages RAM
 0 pages HighMem
 6706 pages reserved
 75752 pages shared
 72758 pages non-shared
 em28xx #0: unable to allocate 165120 bytes for transfer buffer 4

The situation is as follows: from user space the open() function is called 
which ends
finally at em28xx_v4l2_open() in the em28xx-new driver. Then the driver tries 
to allocate
some memory in em28xx_init_isoc(), but this fails (out of memory) and then an 
error
message is printed em28xx #0: unable to allocate 165120 bytes for transfer 
buffer 4.
The error code is returned to user space and then ZoneMinder and webcam should 
handle
the return value correctly (i.e. not use -1 as a valid

Re: [Em28xx] Mailinglist

2009-01-22 Thread Németh Márton
Boris van Hoorn wrote:
 Please fill me out of the Mailinglist!

Please use this page: http://mcentral.de/mailman/listinfo/em28xx

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] clean up the functions which shall have the prototype of v4l2_kioctl

2009-01-22 Thread Németh Márton
Márton Németh wrote:
 The inode parameter of typedef v4l2_kioctl was removed at Linux 2.6.28.
 Then the return value of typedef v4l2_kioctl was changed from int to long in 
 2.6.29-rc2 (or
 earlier, but not before 2.6.29-rc1).
 
 Currently the functions em28xx_v4l2_ioctl() and em28xx_video_do_ioctl() should
 have the prototype of typedef v4l2_kioctl. The reason for this is the call of 
 video_usercopy()
 function which takes a function pointer for its last argument. This pointer 
 should have
 the type v4l2_kioctl.

I tested the patch with 2.6.27 and it seems that the #elsif cannot be used. 
Please find
attached the updated patch.

Regards,

Márton Németh

diff -r fef4aba53836 em28xx-video.c
--- a/em28xx-video.c	Fri Jan 23 07:23:44 2009 +0100
+++ b/em28xx-video.c	Fri Jan 23 08:31:26 2009 +0100
@@ -1901,14 +1901,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg);
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg);
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+#endif
 #endif
 
 
@@ -2431,9 +2437,22 @@
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
- */
+ *
+ * This function have the prototype v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
+ */
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp,
  unsigned int cmd, void *arg)
+#else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
+static int em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#else
+static long em28xx_video_do_ioctl(struct file *filp,
+ unsigned int cmd, void *arg)
+#endif
+#endif
 {
 	struct em28xx_fh *fh = filp-private_data;
 	struct em28xx *dev = fh-dev;
@@ -2866,7 +2885,7 @@
 		return 0;
 	}
 	default:
-		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
+		return em28xx_do_ioctl(NULL, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
 	}
 	return 0;
@@ -2876,14 +2895,20 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl as defined in
+ * linux/include/media/v4l2-ioctl.h
  */
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, void *arg)
 #else
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 static int em28xx_v4l2_ioctl(struct file *filp,
 			 unsigned int cmd, void *arg)
+#else
+static long em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
+#endif
 #endif
 {
 	int ret = 0;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Grabshow 100 with em28xx

2009-01-21 Thread Németh Márton
Hi,
ogre5000 wrote:
 Hi Németh. Thanks for sticking to my prob!
 
 It always happens... The steps are a bit complicated... I installed
 Zoneminder (latest release on zoneminder.com), which needs quite a few
 additional packages to my standard distro (openSUSE 11.1) to work. I
 then added a new Monitor with the source /dev/video1 and resolution
 640*480 (also tried different ones). Then, make it Active and click on
 it, and it should display the video source. But it just displays a black
 screen and the log files (in /tmp/) report errors. What I mailed you is
 dmesg output.

I couldn't really find a simple testcase which triggers this problem, but
I analysed the source code and found that the function prototype v4l2_kioctl
changed between Linux kernel 2.6.27 and 2.6.28: the inode parameter was removed.

Last time when I updated the em28xx-new I forget this fact. I just sent a
patch titled [PATCH] remove inode parameter of typedef v4l2_kioctl as of 
2.6.28.
Could you please apply and test the new version of em28xx-new driver?

 I actually searched the internet for xawtv and found out, that webcam
 is part of xawtv (I have xawtv installed). So I guess there is no other
 way to test the webcam with xawtv?
 *strace webcam* does give me the output I uploaded here:
 http://www.file-upload.net/download-1398622/strace_webcam.txt.html
 It doesn't say much to me ... :(

The end of the log looks quite interesting:

 write(2, video4linux webcam v1.5 - (c) 19..., 51video4linux webcam v1.5 - 
 (c) 1998-2002 Gerd Knorr
 ) = 51
 write(2, grabber config:\n  size 360x576 [..., 65grabber config:
   size 360x576 [16 bit YUV 4:2:2 (packed, YUYV)]
 ) = 65
 write(2,   input (null), norm (null), jpe..., 46  input (null), norm 
 (null), jpeg quality 100

Here we can see that (null) is written to the output instead of a readable
input and norm parameter. This usually signals that there might be some return
value check missing in the code.

 ) = 46
 write(2,   rotate=0, top=0, left=0, botto..., 49  rotate=0, top=0, left=0, 
 bottom=480, right=640
 ) = 49
 write(2, write config [local]:\n  local tr..., 81write config [local]:
   local transfer /root/uploading.jpeg = /root/webcam.jpeg
 ) = 81
 mmap2(NULL, 417792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
 0xb7d88000
 read(3, 
 \20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200...,
  414720) = 414720
 mmap2(NULL, 622592, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
 0xb7cf

This mmap2() calls also do not look like very good: -1 is the fd parameter which
shall be positive. The -1 is an error code which comes from a previous system 
call
and it is not a valid file descriptor.

 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 +++ killed by SIGSEGV +++

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Grabshow 100 with em28xx

2009-01-21 Thread Németh Márton
Németh Márton wrote:
 ogre5000 wrote:
 I actually searched the internet for xawtv and found out, that webcam
 is part of xawtv (I have xawtv installed). So I guess there is no other
 way to test the webcam with xawtv?
 *strace webcam* does give me the output I uploaded here:
 http://www.file-upload.net/download-1398622/strace_webcam.txt.html
 It doesn't say much to me ... :(
 
 The end of the log looks quite interesting:
 
 write(2, video4linux webcam v1.5 - (c) 19..., 51video4linux webcam v1.5 - 
 (c) 1998-2002 Gerd Knorr
 ) = 51
 write(2, grabber config:\n  size 360x576 [..., 65grabber config:
   size 360x576 [16 bit YUV 4:2:2 (packed, YUYV)]
 ) = 65
 write(2,   input (null), norm (null), jpe..., 46  input (null), norm 
 (null), jpeg quality 100
 
 Here we can see that (null) is written to the output instead of a readable
 input and norm parameter. This usually signals that there might be some return
 value check missing in the code.
 
 ) = 46
 write(2,   rotate=0, top=0, left=0, botto..., 49  rotate=0, top=0, left=0, 
 bottom=480, right=640
 ) = 49
 write(2, write config [local]:\n  local tr..., 81write config [local]:
   local transfer /root/uploading.jpeg = /root/webcam.jpeg
 ) = 81
 mmap2(NULL, 417792, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
 = 0xb7d88000
 read(3, 
 \20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200\20\200...,
  414720) = 414720
 mmap2(NULL, 622592, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
 = 0xb7cf
 
 This mmap2() calls also do not look like very good: -1 is the fd parameter 
 which
 shall be positive. The -1 is an error code which comes from a previous system 
 call
 and it is not a valid file descriptor.
 
 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
 +++ killed by SIGSEGV +++


 write(2, reading config file: /root/.webc..., 37reading config file: 
 /root/.webcamrc
) = 37

Could you please send your /root/.webcamrc ? (Please change the password
field in it to *** before sending, if any.)

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-20 Thread Németh Márton
Hi,

I have investigated this problem a little, and I tried the following kernel 
versions:




Németh Márton nm...@freemail.hu, wrote: 

Hi,

I can also reproduce this problem with Pinnacle Hybrid Pro Stick (320e) and 
with em28xx-new revision 291.

I can find the digital TV channels with kaffeine 0.8.7 using Linux 2.6.27, but 
no channels are found with 2.6.28.

I don't know the reason, yet.

Regards,

Márton Németh


A. Klitzing aklitz...@online.de, wrote: 

I have the same problem here. I can't tune into any channel since
2.6.28! I tried it with r291 and gxine. But I still get no additional
debug messages. If I try to tune with gxine my CPU usage will be high
but nothing happens.

I tried it with kaffeine and mplayer, too. Same results


$ modprobe -k em28xx_dvb debug=1
$ dmesg
em28xx v4l2 driver version 0.0.1 loaded
usbcore: registered new interface driver em28xx
usb 1-5: new high speed USB device using ehci_hcd and address 10
usb 1-5: configuration #1 chosen from 1 choice
em28xx: new video device (eb1a:2870): interface 0, class 255
em28xx: device is attached to a USB 2.0 bus
em28xx #0: Alternate settings: 8
em28xx #0: Alternate setting 0, max size= 0
em28xx #0: Alternate setting 1, max size= 0
em28xx #0: Alternate setting 2, max size= 1448
em28xx #0: Alternate setting 3, max size= 2048
em28xx #0: Alternate setting 4, max size= 2304
em28xx #0: Alternate setting 5, max size= 2580
em28xx #0: Alternate setting 6, max size= 2892
em28xx #0: Alternate setting 7, max size= 3072
em2880-dvb.c: DVB Init
MT2060: successfully identified (IF1 = 1220)
DVB: registering new adapter (em2880 DVB-T)
DVB: registering adapter 0 frontend 0 (Zarlink ZL10353 DVB-T)...
input: em2880/em2870 remote control as /class/input/input14
em28xx-input.c: remote control handler attached
em28xx #0: Found Pinnacle PCTV DVB-T

Regards,
André Klitzing

--
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx



___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx









Nyári nyaralások, fantasztikus előfoglalási kedvezménnyel.
Spóroljon meg akár 16%-ot vagy vegye igénybe 1. gyermek INGYEN utazik 
kedvezményünket. Horvát üdüléseknél illetve társas körutaknál 1,5% ONLINE 
KEDVEZMÉNY.
http://ad.adverticum.net/b/cl,1,6022,309206,379469/click.prm


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-20 Thread Németh Márton
Hi,

I have investigated this problem and tried the following kernel versions:

2.6.27  good
2.6.28-rc2  good
2.6.28-rc4  good
2.6.28-rc5  bad

So it seems that some change(s) between 2.6.28-rc4 and 2.6.28-rc5 broke the 
digital channel tuning.

Regards,

Márton Németh

Németh Márton nm...@freemail.hu, wrote: 

Hi,

I can also reproduce this problem with Pinnacle Hybrid Pro Stick (320e) and 
with em28xx-new revision 291.

I can find the digital TV channels with kaffeine 0.8.7 using Linux 2.6.27, but 
no channels are found with 2.6.28.

I don't know the reason, yet.

Regards,

Márton Németh


A. Klitzing aklitz...@online.de, wrote: 

I have the same problem here. I can't tune into any channel since
2.6.28! I tried it with r291 and gxine. But I still get no additional
debug messages. If I try to tune with gxine my CPU usage will be high
but nothing happens.

I tried it with kaffeine and mplayer, too. Same results


$ modprobe -k em28xx_dvb debug=1
$ dmesg
em28xx v4l2 driver version 0.0.1 loaded
usbcore: registered new interface driver em28xx
usb 1-5: new high speed USB device using ehci_hcd and address 10
usb 1-5: configuration #1 chosen from 1 choice
em28xx: new video device (eb1a:2870): interface 0, class 255
em28xx: device is attached to a USB 2.0 bus
em28xx #0: Alternate settings: 8
em28xx #0: Alternate setting 0, max size= 0
em28xx #0: Alternate setting 1, max size= 0
em28xx #0: Alternate setting 2, max size= 1448
em28xx #0: Alternate setting 3, max size= 2048
em28xx #0: Alternate setting 4, max size= 2304
em28xx #0: Alternate setting 5, max size= 2580
em28xx #0: Alternate setting 6, max size= 2892
em28xx #0: Alternate setting 7, max size= 3072
em2880-dvb.c: DVB Init
MT2060: successfully identified (IF1 = 1220)
DVB: registering new adapter (em2880 DVB-T)
DVB: registering adapter 0 frontend 0 (Zarlink ZL10353 DVB-T)...
input: em2880/em2870 remote control as /class/input/input14
em28xx-input.c: remote control handler attached
em28xx #0: Found Pinnacle PCTV DVB-T

Regards,
André Klitzing

--
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx








___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx






Nyári nyaralások, fantasztikus előfoglalási kedvezménnyel.
Spóroljon meg akár 16%-ot vagy vegye igénybe 1. gyermek INGYEN utazik 
kedvezményünket. Horvát üdüléseknél illetve társas körutaknál 1,5% ONLINE 
KEDVEZMÉNY.
http://ad.adverticum.net/b/cl,1,6022,309206,379469/click.prm


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-19 Thread Németh Márton
Hi,

I can also reproduce this problem with Pinnacle Hybrid Pro Stick (320e) and 
with em28xx-new revision 291.

I can find the digital TV channels with kaffeine 0.8.7 using Linux 2.6.27, but 
no channels are found with 2.6.28.

I don't know the reason, yet.

Regards,

Márton Németh


A. Klitzing aklitz...@online.de, wrote: 

I have the same problem here. I can't tune into any channel since
2.6.28! I tried it with r291 and gxine. But I still get no additional
debug messages. If I try to tune with gxine my CPU usage will be high
but nothing happens.

I tried it with kaffeine and mplayer, too. Same results


$ modprobe -k em28xx_dvb debug=1
$ dmesg
em28xx v4l2 driver version 0.0.1 loaded
usbcore: registered new interface driver em28xx
usb 1-5: new high speed USB device using ehci_hcd and address 10
usb 1-5: configuration #1 chosen from 1 choice
em28xx: new video device (eb1a:2870): interface 0, class 255
em28xx: device is attached to a USB 2.0 bus
em28xx #0: Alternate settings: 8
em28xx #0: Alternate setting 0, max size= 0
em28xx #0: Alternate setting 1, max size= 0
em28xx #0: Alternate setting 2, max size= 1448
em28xx #0: Alternate setting 3, max size= 2048
em28xx #0: Alternate setting 4, max size= 2304
em28xx #0: Alternate setting 5, max size= 2580
em28xx #0: Alternate setting 6, max size= 2892
em28xx #0: Alternate setting 7, max size= 3072
em2880-dvb.c: DVB Init
MT2060: successfully identified (IF1 = 1220)
DVB: registering new adapter (em2880 DVB-T)
DVB: registering adapter 0 frontend 0 (Zarlink ZL10353 DVB-T)...
input: em2880/em2870 remote control as /class/input/input14
em28xx-input.c: remote control handler attached
em28xx #0: Found Pinnacle PCTV DVB-T

Regards,
André Klitzing

--
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx






Szerelem, komoly kapcsolat, flört - az igazi társkereső ingyenes
regisztrációval, 400.000 taggal! Kattints ide: www.parom.hu



___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Grabshow 100 with em28xx

2009-01-18 Thread Németh Márton
ogre5000 wrote:
 Hi.
 
 Ok I hope I got everything right (I don't need to recompile my kernel,
 correct?).. I did this:
 
 - Changed all your mentioned parameters
 in */usr/src/linux-2.6.27.7-9-obj/i386/pae/.config* (to PARAMETER=y) and
 added the nonexistent parameters (CONFIG_DEBUG_OBJECTS_FREE=y
 and CONFIG_DEBUG_OBJECTS_TIMERS=y).

Unfortunately, you have to recompile your kernel to enable those features.
Changing that file does nothing.

 - Ripped the latest em28xx-new
 from http://mcentral.de/hg/~mrec/em28xx-new (have no hg, so I've taken
 the .tar.gz link from there).
 - Unpacked, executed *./build.sh build;**./build.sh install*
 - Unloaded all em28xx modules with rmmod, then did *insmod em28xx.ko
 card=11*
 
 Now when I execute webcam app with 640x480 configured, it says:
 
 *reading config file: /root/.webcamrc*
 *video4linux webcam v1.5 - (c) 1998-2002 Gerd Knorr*
 *grabber config:*
 *  size 360x576 [16 bit YUV 4:2:2 (packed, YUYV)]*
 *  input (null), norm (null), jpeg quality 100*
 *  rotate=0, top=0, left=0, bottom=480, right=640*
 *write config [local]:*
 *  local transfer /root/uploading.jpeg = /root/webcam.jpeg*
 *Segmentation fault*
 
 And dmesg then says:
 (Thats just the last interesting lines, for the full dmesg file, see
 this link: http://www.file-upload.net/download-1388194/dmesg.txt.html)
 
 *em28xx v4l2 driver version 0.0.1 loaded*
 *em28xx: new video device (eb1a:2800): interface 0, class 255*
 *em28xx: device is attached to a USB 2.0 bus*
 *em28xx #0: Alternate settings: 4*
 *em28xx #0: Alternate setting 0, max size= 0*
 *em28xx #0: Alternate setting 1, max size= 644*
 *em28xx #0: Alternate setting 2, max size= 1288*
 *em28xx #0: Alternate setting 3, max size= 2580*
 *saa7115' 2-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0)*
 *attach_inform: saa7113 detected.*
 *em28xx #0: V4L2 device registered as /dev/video1*
 *em28xx #0: Found Terratec Cinergy 200 USB*
 *usbcore: registered new interface driver em28xx*
 *webcam[3508]: segfault at b7d53108 ip 08051885 sp bfd8ff58 error 7 in
 webcam[8048000+e000]*

It seems that the segmentation fault is in user space (webcam and not in
the em28xx-new driver. You might try to run strace webcam or try a different
video application like xawtv.

 But when I execute webcam app with 576x360 configured (did this
 because it's part of webcam output above, the size), it says something
 longer and funny, without segfault in dmesg:
 (For the full webcam output, see this
 link: http://www.file-upload.net/download-1388232/webcam.txt.html, just
 some memory map info).
 
 *
 reading config file: /root/.webcamrc
 video4linux webcam v1.5 - (c) 1998-2002 Gerd Knorr
 grabber config:
   size 360x576 [16 bit YUV 4:2:2 (packed, YUYV)]
   input (null), norm (null), jpeg quality 100
   rotate=0, top=0, left=0, bottom=360, right=576
 write config [local]:
   local transfer /root/uploading.jpeg = /root/webcam.jpeg
 *** glibc detected *** webcam: double free or corruption (out):
 0xb7d0f008 ***
 === Backtrace: =
 /lib/libc.so.6[0xb7e27654]
 /lib/libc.so.6(cfree+0x9c)[0xb7e28f3c]
 webcam[0x804ef45]
 webcam(main+0xc12)[0x804c612]
 /lib/libc.so.6(__libc_start_main+0xe5)[0xb7dd1705]
 webcam[0x804b421]
 === Memory map: 
 *
 [...]

This is also a problem of the user space webcam.

 Back to 640x480, when using card=12, I get in dmesg after executing
 webcam app (it also shows the list of devices Here is a list of valid
 choices for the card = n insmod option even tough I gave the device
 option, it's maybe not recognized):
 
 [...]
 *
 em28xx #0: card = 76 - Pollin USB-R1
 em28xx #0: card = 77 - Equinux TubeStick Hybrid ATSC
 em28xx #0: card = 78 - Leadtek PalmTop DTV 200H
 em28xx #0: card = 79 - Compro VideoMate ForYou/Stereo
 em28xx #0: card = 80 - Terratec XS HTC
 saa7115' 2-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0)
 attach_inform: saa7113 detected.
 em28xx #0: V4L2 device registered as /dev/video1
 em28xx #0: Found Leadtek Winfast USB II
 usbcore: registered new interface driver em28xx
 *
 
 And when using card=13, dmesg says after webcam:
 
 *em28xx v4l2 driver version 0.0.1 loaded*
 *em28xx: new video device (eb1a:2800): interface 0, class 255*
 *em28xx: device is attached to a USB 2.0 bus*
 *em28xx #0: Alternate settings: 4*
 *em28xx #0: Alternate setting 0, max size= 0*
 *em28xx #0: Alternate setting 1, max size= 644*
 *em28xx #0: Alternate setting 2, max size= 1288*
 *em28xx #0: Alternate setting 3, max size= 2580*
 *saa7115' 2-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0)*
 *attach_inform: saa7113 detected.*
 *em28xx #0: V4L2 device registered as /dev/video1*
 *em28xx #0: Found KWorld USB2800*
 *usbcore: registered new interface driver em28xx*
 *webcam[4065]: segfault at b7d13108 ip 08051885 sp bf94f318 error 7 in
 webcam[8048000+e000]*
 
 Any more ideas? :-)
 Thanks!
 
 
 
 
 Am 18.01.2009 um 06:30 schrieb Németh Márton:

 In your previous mail you mentioned that you get Segmentation

[Em28xx] [PATCH] inode parameter of video_usercopy() removed

2009-01-17 Thread Németh Márton
The inode parameter of video_usercopy() is removed between 2.6.28 and
2.6.29-rc2. Remove from em28xx-new driver also.

Note that the video_usercopy() is deprecated.
diff -r bd9f074ca2ab em28xx-video.c
--- a/em28xx-video.c	Thu Jan 15 19:54:26 2009 +0100
+++ b/em28xx-video.c	Sat Jan 17 14:51:06 2009 +0100
@@ -2892,7 +2892,11 @@
 		return -EIO;
 	}
 
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 29)
 	ret = video_usercopy(NULL, filp, cmd, (unsigned long)arg, em28xx_video_do_ioctl);
+#else
+	ret = video_usercopy(filp, cmd, (unsigned long)arg, em28xx_video_do_ioctl);
+#endif
 
 	return ret;
 }
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Grabshow 100 with em28xx

2009-01-17 Thread Németh Márton
ogre5000 wrote:
 Hello.
 I've written earlier but got no further answer to my last message...:
 http://mcentral.de/pipermail/em28xx/2009-January/002359.html
 Is there anyone who could help me make *GrabShow 100* compatible with
 em28xx? I can provide logfiles, ...

In your previous mail you mentioned that you get Segmentation fault for
card=11..13.

Please enable the following kernel configuration parameters:
CONFIG_DEBUG_OBJECTS=y
CONFIG_DEBUG_OBJECTS_FREE=y
CONFIG_DEBUG_OBJECTS_TIMERS=y
CONFIG_PROVE_LOCKING=y
CONFIG_DEBUG_SPINLOCK_SLEEP=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_STACKOVERFLOW=y
CONFIG_DEBUG_RODATA=y
CONFIG_FRAME_POINTER=y

After that, recompile the latest em28xx-new which is currently revision 291.
(you can check this with hg view and you can update with hg pull + hg 
update)

Then try card=11..13 and check, please, what contains the dmesg in case of
these cases.

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-11 Thread Németh Márton
Németh Márton wrote:
 Roman v. Gemmeren wrote:
 Hi,

 Am Samstag, 10. Januar 2009 16:38:59 schrieben Sie:
 Hi,

 Roman v. Gemmeren wrote:
 Hi,

 has anyone gotten em28xx to work with kernel 2.6.28 and a Terratec
 Prodigy (DVBT) USB stick?
 With previous kernelversions i had not a single problem, but after the
 switch to 2.6.28 i am getting this if i start kaffeine on the console:

 -
 str...@sleipnir ~ Tuning to: ZDF / autocount: 0
 DvbCam::probe(): /dev/dvb/adapter0/ca0: : Datei oder Verzeichnis nicht
 gefunden
 Using DVB device 0:0 Zarlink ZL10353 DVB-T
 tuning DVB-T to 51400 Hz
 inv:2 bw:0 fecH:2 fecL:9 mod:1 tm:1 gi:3 hier:0
 ...
 Not able to lock to the signal on the given frequency
 Frontend closed
 Tuning delay: 1637 ms
 Tuning to: ProSieben / autocount: 0
 Using DVB device 0:0 Zarlink ZL10353 DVB-T
 tuning DVB-T to 73000 Hz
 inv:2 bw:0 fecH:2 fecL:1 mod:1 tm:1 gi:3 hier:0
 ...
 ---

 there is no ca0 in that directory...
 str...@sleipnir ~ ls /dev/dvb/adapter0
 demux0  dvr0  frontend0  net0

 Does anyone know why this is happening?
 Could you please specify which revision of em28xx-new driver
 are you using? You can find it out with hg view command.

 Also, could you please send the output of dmesg?

 Regards,

 Márton Németh
 there seems to be no hg view here on gentoo, but the last changeset 
 is: 288:c28b5be6442f.
 
 I recently sent a patch on top of revision 288 which might
 help on 2.6.28 kernel: [PATCH] reenable em28xx_do_ioctl() for 2.6.28.
 
 Could you please try and tell if it is working for you?

[Roman v. Gemmeren]: Didn't do the trick, i still get the same error

Could you please load the em28xx module manually before you
plug in the device and specifiy video_debug=1 as parameter,
like this:

  rmmod em28xx
  modprobe em28xx video_debug=1

Start kaffeine, try to tune and then send the dmesg, please.
Please also specify the kaffeine version you use.

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Cant tune into any channel with kernel 2.6.28

2009-01-10 Thread Németh Márton
Hi,
Roman v. Gemmeren wrote:
 Hi,
 
 has anyone gotten em28xx to work with kernel 2.6.28 and a Terratec Prodigy 
 (DVBT) USB stick?
 With previous kernelversions i had not a single problem, but after the switch 
 to 2.6.28 i am getting this if i start kaffeine on the console:
 
 -
 str...@sleipnir ~ Tuning to: ZDF / autocount: 0
 DvbCam::probe(): /dev/dvb/adapter0/ca0: : Datei oder Verzeichnis nicht 
 gefunden
 Using DVB device 0:0 Zarlink ZL10353 DVB-T
 tuning DVB-T to 51400 Hz
 inv:2 bw:0 fecH:2 fecL:9 mod:1 tm:1 gi:3 hier:0
 ...
 Not able to lock to the signal on the given frequency
 Frontend closed
 Tuning delay: 1637 ms
 Tuning to: ProSieben / autocount: 0
 Using DVB device 0:0 Zarlink ZL10353 DVB-T
 tuning DVB-T to 73000 Hz
 inv:2 bw:0 fecH:2 fecL:1 mod:1 tm:1 gi:3 hier:0
 ...
 ---
 
 there is no ca0 in that directory...
 str...@sleipnir ~ ls /dev/dvb/adapter0
 demux0  dvr0  frontend0  net0
 
 Does anyone know why this is happening?

Could you please specify which revision of em28xx-new driver
are you using? You can find it out with hg view command.

Also, could you please send the output of dmesg?

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Support for GrabShow 100 in em2880

2009-01-10 Thread Németh Márton
Hi,
ogre5000 wrote:
 Hello there,
 
 I've recently got a *GrabShow 100* USB2.0 Video Grabber adapter.
 According to the Wiki
 (http://mcentral.de/wiki/index.php5/Em2880#Devices), only Grab Show 110
 is supported by em2880. I plugged the device into my machine (openSUSE
 11.1) with viedo4linux package installed and tried to see if the device
 worked -- negative. When I execute: luvcview, I get an error message:
 
 luvcview 0.2.4
 SDL information:
   Video driver: fbcon
   Hardware surfaces are available (6144k video memory)
 Device information:
   Device path:  /dev/video0
 Stream settings:
   Frame format: YUYV (MJPG is not supported by device)
   Frame size:   640x480
 Unable to set frame rate: Invalid argument
  Init v4L2 failed !! exit fatal
 
 It might only be a slight difference between GrabShow 100 and GrabShow
 110, do you think that supporting Grabshow 100 would be possible soon? I
 can offer support with logfiles and everything you need in order to make
 it work.
 
 This is the seller site:
 GrabShow 100: http://www.further.com.tw/Grab_show100.shtml
 GrabShow 110: http://www.further.com.tw/Grab_show110.shtml
 
 Thanks!
 
 
 
 
 *(This is whats added to /var/log/messages when I plug Grabshow 100:)*
 
 Jan  9 00:38:10 linux kernel: usb 1-2: new high speed USB device using
 ehci_hcd and address 2
 Jan  9 00:38:10 linux kernel: usb 1-2: configuration #1 chosen from 1 choice
 Jan  9 00:38:10 linux kernel: usb 1-2: New USB device found,
 idVendor=eb1a, idProduct=2800
 Jan  9 00:38:10 linux kernel: usb 1-2: New USB device strings: Mfr=0,
 Product=0, SerialNumber=0
 Jan  9 00:38:10 linux kernel: Linux video capture interface: v2.00
 Jan  9 00:38:10 linux kernel: em28xx v4l2 driver version 0.1.0 loaded

According to the version number 0.1.0, you are using the em28xx driver
from the mainline kernel and not em28xx-new. The em28xx-new driver
reports version number 0.0.1.

Please fetch em28xx-new with the command
hg clone http://mcentral.de/hg/~mrec/em28xx-new;, compile it, install
and check whether this driver is working or not.

 Jan  9 00:38:10 linux kernel: em28xx new video device (eb1a:2800):
 interface 0, class 255
 Jan  9 00:38:10 linux kernel: em28xx Doesn't have usb audio class
 Jan  9 00:38:10 linux kernel: em28xx #0: Alternate settings: 4
 Jan  9 00:38:10 linux kernel: em28xx #0: Alternate setting 0, max size= 0
 Jan  9 00:38:10 linux kernel: em28xx #0: Alternate setting 1, max size= 644
 Jan  9 00:38:10 linux kernel: em28xx #0: Alternate setting 2, max size= 1288
 Jan  9 00:38:10 linux kernel: em28xx #0: Alternate setting 3, max size= 2580
 Jan  9 00:38:10 linux kernel: em28xx #0: em28xx chip ID = 7
 Jan  9 00:38:11 linux kernel: em28xx #0: found i2c device @ 0x4a [saa7113h]
 Jan  9 00:38:13 linux kernel: em28xx #0: Your board has no unique USB ID.
 Jan  9 00:38:13 linux kernel: em28xx #0: A hint were successfully done,
 based on i2c devicelist hash.
 Jan  9 00:38:13 linux kernel: em28xx #0: This method is not 100% failproof.
 Jan  9 00:38:13 linux kernel: em28xx #0: If the board were missdetected,
 please email this log to:
 Jan  9 00:38:13 linux kernel: em28xx #0:  V4L Mailing List
  video4linux-l...@redhat.com mailto:video4linux-l...@redhat.com
 Jan  9 00:38:13 linux kernel: em28xx #0: Board detected as PointNix
 Intra-Oral Camera
 Jan  9 00:38:13 linux kernel: em28xx #0: Registering snapshot button...
 Jan  9 00:38:13 linux kernel: input: em28xx snapshot button as
 /devices/pci:00/:00:10.3/usb1/1-2/input/input6
 Jan  9 00:38:14 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:14 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:14 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:14 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:14 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:15 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:15 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:15 linux kernel: em28xx #0: AC97 command still being
 executed: not handled properly!
 Jan  9 00:38:15 linux kernel: em28xx #0: V4L2 device registered as
 /dev/video0 and /dev/vbi0
 Jan  9 00:38:15 linux kernel: em28xx #0: Found PointNix Intra-Oral Camera
 Jan  9 00:38:15 linux kernel: usbcore: registered new interface driver
 em28xx
 Jan  9 00:38:15 linux kernel: em28xx-audio.c: probing for em28x1 non
 standard usbaudio
 Jan  9 00:38:15 linux kernel: em28xx-audio.c: Copyright (C) 2006 Markus
 Rechberger
 Jan  9 00:38:15 linux kernel: Em28xx: Initialized (Em28xx Audio
 Extension) extension

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] reenable em28xx_do_ioctl() for 2.6.28

2009-01-10 Thread Németh Márton
With patch Fix em28xx audio memleak (1cfd9010a552) the em28xx_do_ioctl()
was accidentally disabled for 2.6.28 or later kernels. Enable it
again.
diff -r c28b5be6442f em28xx-video.c
--- a/em28xx-video.c	Fri Jan 09 20:41:15 2009 +0100
+++ b/em28xx-video.c	Sun Jan 11 08:46:04 2009 +0100
@@ -2860,11 +2860,9 @@
 
 		return 0;
 	}
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 	default:
 		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
    em28xx_v4l2_ioctl);
-#endif
 	}
 	return 0;
 }
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] BUG unplugging device when alsamixer is running for the device

2009-01-06 Thread Németh Márton
Hi,

Peter Stuge wrote:
 After the following, em28xx can be unloaded, but when I try to load
 it again, modprobe hangs hard and dmesg output ends with:
 em28xx v4l2 driver version 0.0.1 loaded
 
 
 ..
 
 BUG: unable to handle kernel paging request at 00100100
 IP: [c042486d] snd_ctl_dev_disconnect+0x5d/0x90
 *pde =  
 Oops:  [#1] PREEMPT 
 Modules linked in: drx3973d s921 mt2060 lgdt3304 zl10353 qt1010 tuner_xc3028 
 tvp5150 em28xx i2c_core
 
 Pid: 202, comm: khubd Not tainted (2.6.26 #3)
 EIP: 0060:[c042486d] EFLAGS: 00010246 CPU: 0
 EIP is at snd_ctl_dev_disconnect+0x5d/0x90
 EAX:  EBX: 00100100 ECX: 00020004 EDX: 001d
 ESI: c5239968 EDI: c5239800 EBP: c523994c ESP: d78d1e50
  DS: 007b ES: 007b FS:  GS:  SS: 0068
 Process khubd (pid: 202, ti=d78d task=d78fc350 task.ti=d78d)
 Stack:  cba043a0 c5239800 c5239940  c0426b22 c0184321 
 cba043a0 
c0426dca  d78d c5239800  c0422f7b d7408cb8 
 c01af7cd 
d2c33000 d2c3301c d5691800 c04501fd d2cf4440 c5239800 c03d3c6c 
 d2c33000 
 Call Trace:
  [c0426b22] snd_device_disconnect+0x52/0x70
  [c0184321] find_inode+0x31/0x60
  [c0426dca] snd_device_disconnect_all+0x2a/0x50
  [c0422f7b] snd_card_disconnect+0x12b/0x1f0
  [c01af7cd] sysfs_addrm_finish+0x4d/0x200
  [c04501fd] usb_audio_disconnect+0x5d/0x150
  [c03d3c6c] usb_autopm_do_device+0x7c/0xf0
  [c03d4a95] usb_unbind_interface+0x55/0xa0
  [c033d401] __device_release_driver+0x51/0x90
  [c033d460] device_release_driver+0x20/0x40
  [c033c8c7] bus_remove_device+0x57/0x80
  [c033b4ef] device_del+0xdf/0x150
  [c03d1b19] usb_disable_device+0x79/0xf0
  [c03ccf66] usb_disconnect+0x86/0x130
  [c03ce1a4] hub_thread+0x4b4/0xd90
  [c011c926] __dequeue_entity+0x46/0xa0
  [c0134910] autoremove_wake_function+0x0/0x40
  [c03cdcf0] hub_thread+0x0/0xd90
  [c0134612] kthread+0x42/0x70
  [c01345d0] kthread+0x0/0x70
  [c0103e5f] kernel_thread_helper+0x7/0x18
  [c053df69] schedule+0x1b9/0x330
  ===
 Code: 18 b9 01 00 00 00 ba 03 00 00 00 c7 04 24 00 00 00 00 e8 c7 a0 cf ff 8d 
 43 20 b9 04 00 02 00 ba 1d 00 00 00 e8 55 82 d5 ff 8b 1b 8b 03 0f 18 00 90 
 39 f3 75 c9 89 e8 e8 72 40 d1 ff 89 fa b9 ff 
 EIP: [c042486d] snd_ctl_dev_disconnect+0x5d/0x90 SS:ESP 0068:d78d1e50
 ---[ end trace 265a42e4c9341828 ]---

Can you please recompile your kernel with CONFIG_DEBUG_OBJECTS_FREE=y and
then try to reproduce the problem? This option is located in menuconfig at:
  - Kernel hacking
- Kernel debugging (DEBUG_KERNEL [=y])
  - Debug object operations (DEBUG_OBJECTS [=y])

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH 1/5] warnings: enable more warning messages

2009-01-02 Thread Németh Márton
Enable more warning messages of gcc in order to find any inconsistencies in the 
code.
diff -r 515a14309adb Makefile
--- a/Makefile	Fri Jan 02 13:09:08 2009 +0100
+++ b/Makefile	Sat Jan 03 07:41:20 2009 +0100
@@ -55,6 +55,7 @@
 OLDMOD	:= /lib/modules/$(KVER)/kernel/drivers/media/video/em28xx/em28xx.ko # real modules dir
 
 EXTRA_CFLAGS += -I$(PWD)/include -I$(SDIR)/drivers/media/video -I$(SDIR)/drivers/media/dvb/frontends -I$(SDIR)/drivers/media/dvb/dvb-core -I$(SDIR)/drivers/media/tuners/ -Iinclude/linux -Idrivers/media/video -Idrivers/media/dvb/frontends -Idrivers/media/dvb/dvb-core -Idrivers/media/tuners/ -Iinclude/linux -Wall -DCONFIG_DVB_ZL10353 -DCONFIG_DVB_DRX3973D -DDRXD_TYPE_B -DDRXD_TYPE_A  -DCONFIG_DVB_LGDT3304 -DCONFIG_MEDIA_TUNER_QT1010 -DCONFIG_DVB_TUNER_MT2060 -DCONFIG_DVB_S921
+EXTRA_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
 #EXTRA_CFLAGS += $(GCOV_FLAGS)
 #EXTRA_CFLAGS += -fprofile-arcs -ftest-coverage
 export EXTRA_CFLAGS
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH 2/5] warnings: clean up ioctl prototypes

2009-01-02 Thread Németh Márton
Clean up the prototype of em28xx_v4l2_ioctl() and em28xx_v4l2_ioctl_fops() so 
they
can match the prototype of v4l2_kioctl and file_operations.ioctl respectively.

This eliminates the warning message:
passing argument 6 of 'em28xx_do_ioctl' from incompatible pointer type
diff -r 515a14309adb em28xx-video.c
--- a/em28xx-video.c	Fri Jan 02 13:09:08 2009 +0100
+++ b/em28xx-video.c	Sat Jan 03 07:41:20 2009 +0100
@@ -1900,6 +1900,14 @@
 }
 
 /*
+ * em28xx_v4l2_ioctl()
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ */
+static int em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg);
+
+
+/*
  * em28xx_do_ioctl()
  * This function is _not_ called directly, but indirectly from
  * em28xx_v4l2_ioctl() via em28xx_video_do_ioctl(). Userspace
@@ -2854,17 +2862,19 @@
 	}
 	default:
 		return em28xx_do_ioctl(inode, filp, dev, cmd, arg,
-   em28xx_video_do_ioctl);
-	}
-	return 0;
-}
+   em28xx_v4l2_ioctl);
+	}
+	return 0;
+}
+
+
 
 /*
  * em28xx_v4l2_ioctl()
- * handle v4l2 ioctl, the main action happens in em28xx_video_do_ioctl()
- */
-static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
-			 unsigned int cmd, unsigned long arg)
+ * Handle V4L2 ioctl. Has the prototype of v4l2_kioctl.
+ */
+static int em28xx_v4l2_ioctl(struct file *filp,
+			 unsigned int cmd, void *arg)
 {
 	int ret = 0;
 	struct em28xx_fh *fh = filp-private_data;
@@ -2882,16 +2892,31 @@
 		return -EIO;
 	}
 
-	ret = video_usercopy(inode, filp, cmd, arg, em28xx_video_do_ioctl);
+	ret = video_usercopy(NULL, filp, cmd, (unsigned long)arg, em28xx_video_do_ioctl);
 
 	return ret;
+}
+
+/*
+ * em28xx_v4l2_ioctl_fops()
+ * Handle v4l2 ioctl, the function has a prototype which match the ioctl
+ * field of struct file_operations.
+ *
+ * TODO: later this function should be replaced by video_ioctl2() and with
+ * struct v4l2_ioctl_ops. The struct v4l2_ioctl_ops was introduced with commit
+ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a399810ca69d9d4bd30ab8c1678c7439e567f90b
+ */
+static int em28xx_v4l2_ioctl_fops(struct inode *inode, struct file *filp,
+			 unsigned int cmd, unsigned long arg)
+{
+	return em28xx_v4l2_ioctl(filp, cmd, (void *)arg);
 }
 
 static struct file_operations em28xx_v4l_fops = {
 	.owner = THIS_MODULE,
 	.open = em28xx_v4l2_open,
 	.release = em28xx_v4l2_close,
-	.ioctl = em28xx_v4l2_ioctl,
+	.ioctl = em28xx_v4l2_ioctl_fops,
 	.read = em28xx_v4l2_read,
 	.poll = em28xx_v4l2_poll,
 	.mmap = em28xx_v4l2_mmap,
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH 4/5] warnings: multiple initializations in em28xx-keymaps.c

2009-01-02 Thread Németh Márton
Some fields in ir_codes_pinnacle2 and ir_codes_em_pinnacle_usb are initialized
twice. Clean them up.

This eliminates the following warning message:
initialized field overwritten
diff -r 515a14309adb em28xx-keymaps.c
--- a/em28xx-keymaps.c	Fri Jan 02 13:09:08 2009 +0100
+++ b/em28xx-keymaps.c	Sat Jan 03 07:41:20 2009 +0100
@@ -114,10 +114,9 @@
 
 	[0x00] = KEY_MUTE,
 
-	[0x06] = KEY_PLAY,
+	[0x06] = KEY_PLAYPAUSE,
 	[0x04] = KEY_REWIND,
 	[0x07] = KEY_FORWARD,
-	[0x06] = KEY_PAUSE,
 	[0x05] = KEY_STOP,
 	[0x01] = KEY_RECORD,
 	[0x02] = KEY_ZOOM, /* fullscreen */
@@ -239,7 +238,6 @@
 	[0x29] = KEY_TEXT,
 	[0x2a] = KEY_MEDIA,
 	[0x18] = KEY_EPG,
-	[0x27] = KEY_RECORD,
 };
 EXPORT_SYMBOL_GPL(ir_codes_em_pinnacle_usb);
 
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH 5/5] warnings: handle copy_to_user() return value

2009-01-02 Thread Németh Márton
The copy_to_user() call could fail. Report this condition to the upper level 
also.

This eliminates the following warning message:
ignoring return value of 'copy_to_user', declared with attribute 
warn_unused_result
diff -r 515a14309adb em28xx-aad.c
--- a/em28xx-aad.c	Fri Jan 02 13:09:08 2009 +0100
+++ b/em28xx-aad.c	Sat Jan 03 07:41:20 2009 +0100
@@ -160,13 +160,16 @@
 		left = rb-left;
 		rb-left = size - len;
 		spin_unlock_irqrestore(rb-__aad_lock, flags);
-		copy_to_user(buffer, rb-buffer[left], len);
-		copy_to_user(buffer[len], rb-buffer, size - len);
+		if (copy_to_user(buffer, rb-buffer[left], len))
+			size = -EFAULT;
+		if (copy_to_user(buffer[len], rb-buffer, size - len))
+			size = -EFAULT;
 	} else {
 		left = rb-left;
 		rb-left += size;
 		spin_unlock_irqrestore(rb-__aad_lock, flags);
-		copy_to_user(buffer, rb-buffer[left], size);
+		if (copy_to_user(buffer, rb-buffer[left], size))
+			size = -EFAULT;
 	}
 
 	/* reset our backed up ringbuffer */
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] correct __le16 wMaxPacketSize handling

2009-01-01 Thread Németh Márton
Matthew Donoughe wrote:
 Hello
 
 I was having trouble watching TV and I tracked it down to the maximum  
 packet size being set incorrectly on big endian systems. Changing
 dvb_dev-dtv_packetsize = dev-uif- 
  altsetting[1].endpoint[i].desc.wMaxPacketSize;
 to
 dvb_dev-dtv_packetsize = le16_to_cpu(dev-uif- 
  altsetting[1].endpoint[i].desc.wMaxPacketSize);
 on line 1029 of em2880-dvb.c fixes the problem for me. em28xx- 
 audioep.c already does the same endianness conversion.


In struct usb_endpoint_descriptor the wMaxPacketSize field is in LE16
encoding, see linux/include/linux/usb/ch9.h . Add the missing le16_to_cpu()
and __constant_cpu_to_le16() calls.
diff -r 63cfb1b72ab6 em2880-dvb.c
--- a/em2880-dvb.c	Wed Dec 31 12:54:27 2008 +0100
+++ b/em2880-dvb.c	Fri Jan 02 08:00:16 2009 +0100
@@ -1026,8 +1026,9 @@
 
 	for (i = 0; i  dev-uif-altsetting[1].desc.bNumEndpoints; i++) {
 		if (dev-uif-altsetting[1].endpoint[i].desc.bEndpointAddress == 0x84) {
-			dvb_dev-dtv_packetsize = dev-uif-altsetting[1].
-	endpoint[i].desc.wMaxPacketSize;
+			dvb_dev-dtv_packetsize =
+le16_to_cpu(dev-uif-altsetting[1].endpoint[i].
+desc.wMaxPacketSize);
 			break;
 		}
 	}
diff -r 63cfb1b72ab6 em28xx-video.c
--- a/em28xx-video.c	Wed Dec 31 12:54:27 2008 +0100
+++ b/em28xx-video.c	Fri Jan 02 08:00:16 2009 +0100
@@ -4042,7 +4042,8 @@
 	endpoint = interface-cur_altsetting-endpoint[0].desc;
 	if ((endpoint-bmAttributes  USB_ENDPOINT_XFERTYPE_MASK) ==
 			USB_ENDPOINT_XFER_ISOC 
-		(interface-altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) {
+		(interface-altsetting[1].endpoint[0].desc.wMaxPacketSize ==
+			__constant_cpu_to_le16(940))) {
 		printk(KERN_INFO em28xx: DTV Device detected\n);
 		is_em2875 = 1;
 	} else {
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] remove inode parameter from v4l_compat_translate_ioctl() call when compiling with 2.6.28

2008-12-30 Thread Németh Márton
Hello Markus,

Németh Márton wrote:
 The inode parameter of v4l_compat_translate_ioctl() was removed in 2.6.28.
 Remove it also from the em28xx-new driver.

Please don't forget this patch, this is also needed for compiling with 2.6.28.
The reference to the changeset is:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f473bf76c71ca734a16f9331ce6b6e9603641888

Regards,

Márton Németh
--- em28xx-new/em28xx-video.c.orig	2008-12-29 12:32:32.0 +0100
+++ em28xx-new/em28xx-video.c	2008-12-29 12:36:26.0 +0100
@@ -2403,8 +2403,12 @@ static int em28xx_do_ioctl(struct inode 
 		return 0;
 	}
 	default:
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
 		return v4l_compat_translate_ioctl(inode, filp, cmd, arg,
 		  driver_ioctl);
+#else
+		return v4l_compat_translate_ioctl(filp, cmd, arg, driver_ioctl);
+#endif
 	}
 	return 0;
 }
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] remove MINOR_VFL_TYPE_GRABBER_MIN MINOR_VFL_TYPE_VBI_MIN when compiling with 2.6.28

2008-12-29 Thread Németh Márton
Márton Németh wrote:
 The MINOR_VFL_TYPE_GRABBER_MIN  MINOR_VFL_TYPE_VBI_MIN values are no longer
 available in 2.6.28. Instead, the struct video_device contains an index field
 which can be used to print the messages to kernel output buffer.

Sorry, my previous patch was wrongly using index instead of num field. Here
is the correct one:


The MINOR_VFL_TYPE_GRABBER_MIN  MINOR_VFL_TYPE_VBI_MIN values are no longer
available in 2.6.28. Instead, the struct video_device contains a num field
which can be used to print the messages to kernel output buffer. See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=dd89601d47e2eeab7c17b25f2549444751bcffe4
for details.
diff -r f5ec3cd2c356 em28xx-video.c
--- a/em28xx-video.c	Sun Dec 28 21:12:25 2008 +0100
+++ b/em28xx-video.c	Tue Dec 30 07:27:52 2008 +0100
@@ -811,6 +811,34 @@
 	return errCode;
 }
 
+static int get_vbi_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
+	return dev-minor - MINOR_VFL_TYPE_VBI_MIN;
+#else
+	return dev-num;
+#endif
+}
+
+static int get_video_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
+	return dev-minor - MINOR_VFL_TYPE_GRABBER_MIN;
+#else
+	return dev-num;
+#endif
+}
+
+
+static int get_radio_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 28)
+	return dev-minor  0x1f;
+#else
+	return dev-num;
+#endif
+}
+
 /*
  * em28xx_realease_resources()
  * unregisters the v4l2, i2c and usb devices
@@ -824,13 +852,12 @@
 	if (dev-dev_modesEM28XX_VIDEO) {
 		em28xx_info(disconnecting %s\n, dev-vdev-name);
 		em28xx_info(V4L2 VIDEO devices /dev/video%d deregistered\n,
-dev-vdev-minor-MINOR_VFL_TYPE_GRABBER_MIN);
+get_video_index(dev-vdev));
 		video_unregister_device(dev-vdev);
 		if (dev-dev_modes  EM28XX_VBI) {
 			em28xx_info(V4L2 VBI devices /dev/vbi%d 
 deregistered\n,
-	dev-vbi_dev-minor -
-	MINOR_VFL_TYPE_VBI_MIN);
+	get_vbi_index(dev-vbi_dev));
 			video_unregister_device(dev-vbi_dev);
 		}
 	}
@@ -1534,8 +1561,7 @@
 			dev-state |= DEV_MISCONFIGURED;
 			em28xx_videodbg(device is misconfigured; close and 
 	open /dev/video%d again\n,
-	dev-vdev-minor -
-	MINOR_VFL_TYPE_GRABBER_MIN);
+	get_video_index(dev-vdev));
 		}
 		break;
 	case EM28XX_VIDEO:
@@ -1550,8 +1576,7 @@
 			dev-state |= DEV_MISCONFIGURED;
 			em28xx_videodbg(device is misconfigured; close and 
 open /dev/video%d again\n,
-	dev-vdev-minor -
-	MINOR_VFL_TYPE_GRABBER_MIN);
+	get_video_index(dev-vdev));
 			return ret;
 		}
 		break;
@@ -3133,7 +3158,7 @@
 			return -ENODEV;
 		}
 		printk(KERN_INFOradio device registered as /dev/radio%d\n,
-	dev-rdev-minor  0x1f);
+	get_radio_index(dev-rdev));
 	}
 
 	if (dev-dev_modesEM28XX_VIDEO) {
@@ -3262,11 +3287,11 @@
 return -ENODEV;
 			}
 			em28xx_info(V4L2 VBI device registered as /dev/vbi%d\n,
-	dev-vbi_dev-minor-MINOR_VFL_TYPE_VBI_MIN);
+	get_vbi_index(dev-vbi_dev));
 		}
 		video_mux(dev, 0);
 		em28xx_info(V4L2 device registered as /dev/video%d\n,
-dev-vdev-minor-MINOR_VFL_TYPE_GRABBER_MIN);
+get_video_index(dev-vdev));
 	}
 
 	/* when reattaching the device reinitialize the attached submodules */
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] gcov errors on compile

2008-12-28 Thread Németh Márton
Hi,
Cosma wrote:
 Hello,
 
 I'm trying to compile the latest v4l from sources, but always getting
 those errors:
 
 WARNING: __gcov_merge_add
 [/home/cosma/v4l/v4l-dvb-experimental/em28xx.ko] undefined!
 WARNING: __gcov_init [/home/cosma/v4l/v4l-dvb-experimental/em28xx.ko]
 undefined!
 
 I'm using the 2.7.27 kernel on an ArchLinux box... (also added the
 missing dvb headers from the vanilla kernel).

Please apply the attached patch:

Remove the accidentally added CFLAGS for code coverage measurements.

Regards,

Márton Németh
diff -r 4256de334756 Makefile
--- a/Makefile	Thu Dec 25 12:54:46 2008 +0100
+++ b/Makefile	Sun Dec 28 09:32:47 2008 +0100
@@ -56,7 +56,7 @@
 
 EXTRA_CFLAGS += -I$(PWD)/include -I$(SDIR)/drivers/media/video -I$(SDIR)/drivers/media/dvb/frontends -I$(SDIR)/drivers/media/dvb/dvb-core -I$(SDIR)/drivers/media/tuners/ -Iinclude/linux -Idrivers/media/video -Idrivers/media/dvb/frontends -Idrivers/media/dvb/dvb-core -Idrivers/media/tuners/ -Iinclude/linux -Wall -DCONFIG_DVB_ZL10353 -DCONFIG_DVB_DRX3973D -DDRXD_TYPE_B -DDRXD_TYPE_A  -DCONFIG_DVB_LGDT3304 -DCONFIG_MEDIA_TUNER_QT1010 -DCONFIG_DVB_TUNER_MT2060 -DCONFIG_DVB_S921
 #EXTRA_CFLAGS += $(GCOV_FLAGS)
-EXTRA_CFLAGS += -fprofile-arcs -ftest-coverage
+#EXTRA_CFLAGS += -fprofile-arcs -ftest-coverage
 export EXTRA_CFLAGS
 
 KDIR:= /lib/modules/$(KVER)/build
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Can't build modules with kernel 2.6.28-rc8

2008-12-24 Thread Németh Márton
Hello,
Fabio Venturi wrote:
 Hello,
 I'm trying to build the modules from a fresh hg cloned em28xx-new.
 I'm using kernel 2.6.28-rc8 and the error is:
 
 
 @ryuk:[/usr/src/modules/em28xx-new]
 [fabio]:$ ./build.sh build
 rm -rf Module.symvers; 
 make -C /lib/modules/`if [ -d /lib/modules/2.6.21.4-eeepc ]; then echo 
 2.6.21.4-eeepc; else uname -r; fi`/build SUBDIRS=`pwd` modules
 make[1]: Entering directory `/usr/src/linux-2.6.28-rc8'
   CC [M]  /usr/src/modules/em28xx-new/em28xx-video.o
 /usr/src/modules/em28xx-new/em28xx-video.c: In function 
 ‘em28xx_release_resources’:
 /usr/src/modules/em28xx-new/em28xx-video.c:826: error: 
 ‘MINOR_VFL_TYPE_GRABBER_MIN’ undeclared (first use in this function)
 /usr/src/modules/em28xx-new/em28xx-video.c:826: error: (Each undeclared 
 identifier is reported only once
 /usr/src/modules/em28xx-new/em28xx-video.c:826: error: for each function it 
 appears in.)
 /usr/src/modules/em28xx-new/em28xx-video.c:830: error: 
 ‘MINOR_VFL_TYPE_VBI_MIN’ undeclared (first use in this function)
 /usr/src/modules/em28xx-new/em28xx-video.c: In function 
 ‘em28xx_stream_interrupt’:
 /usr/src/modules/em28xx-new/em28xx-video.c:1535: error: 
 ‘MINOR_VFL_TYPE_GRABBER_MIN’ undeclared (first use in this function)
 /usr/src/modules/em28xx-new/em28xx-video.c: In function ‘em28xx_do_ioctl’:
 /usr/src/modules/em28xx-new/em28xx-video.c:2386: warning: passing argument 1 
 of ‘v4l_compat_translate_ioctl’ from incompatible pointer type
 /usr/src/modules/em28xx-new/em28xx-video.c:2386: warning: passing argument 2 
 of ‘v4l_compat_translate_ioctl’ makes integer from pointer without a cast
 /usr/src/modules/em28xx-new/em28xx-video.c:2386: warning: passing argument 3 
 of ‘v4l_compat_translate_ioctl’ makes pointer from integer without a cast
 /usr/src/modules/em28xx-new/em28xx-video.c:2386: error: too many arguments to 
 function ‘v4l_compat_translate_ioctl’
 /usr/src/modules/em28xx-new/em28xx-video.c: In function 
 ‘em28xx_video_do_ioctl’:
 /usr/src/modules/em28xx-new/em28xx-video.c:2832: warning: passing argument 6 
 of ‘em28xx_do_ioctl’ from incompatible pointer type
 /usr/src/modules/em28xx-new/em28xx-video.c: In function ‘em28xx_init_dev’:
 /usr/src/modules/em28xx-new/em28xx-video.c:3268: error: 
 ‘MINOR_VFL_TYPE_VBI_MIN’ undeclared (first use in this function)
 /usr/src/modules/em28xx-new/em28xx-video.c:3272: error: 
 ‘MINOR_VFL_TYPE_GRABBER_MIN’ undeclared (first use in this function)
 make[2]: *** [/usr/src/modules/em28xx-new/em28xx-video.o] Error 1
 make[1]: *** [_module_/usr/src/modules/em28xx-new] Error 2
 make[1]: Leaving directory `/usr/src/linux-2.6.28-rc8'
 make: *** [default] Error 2
 
 Is 2.6.28 release candidate 8 supported?
 Thank you and happy holidays.

The latest kernel is 2.6.27 which is supported by em28xx-new. See
also http://mcentral.de/pipermail/em28xx/2008-November/002155.html .

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Page allocation failure and memory leak

2008-12-21 Thread Németh Márton
Hi Carl,

Markus Rechberger wrote:
 On Sat, Dec 20, 2008 at 7:10 PM,  car...@lavabit.com wrote:
 Carl wrote:
 I own a Pinnacle PCTV Hybrid Pro (em2882) and I have a little home server
 running vdr. However, the server runs out of memory after about a week,
 which doesn't happen when the em28xx-drivers aren't loaded and the device
 isn't plugged in. Apperently no userspace process is using all the memory
 (see attached output of top -- top-with-em28xx.txt), which makes me think
 it has something to do with the driver. I am only watching DVB-T, so it
 should have nothing to do with the sound-device memory leak. I checked out
 the mercurial-repository about a week ago, when I rebooted the server and
 plugged in my PCTV, so the driver is fairly recent too. For comparison, I
 also attached the output of top after the server was running for 10 days
 without em28xx + vdr (top-without-em28xx.txt).
 Additionally I get quite frequent page allocation failure messages from
 vdr in my syslog (see page-allocation-failure.txt), which may be related
 to the above problem.
 I am using a 2.6.27 kernel now, but these problems have also persisted in
 2.6.26. Couldn't try 2.6.25 since the driver didn't work too well, neither
 2.6.24 because nfs4 would cause kernel panics after only minutes.
 Unfortunately I do not have another DVB-T card to test.
 If there is something I can do, let me know, but I don't even have an idea
 where to start.

 Two weeks now and no reply? Isn't anyone experiencing similar problems? Am
 I the only one who is using his DVB device 24/7? Or am I missing something
 very obvious and am I making a fool of myself?
 Markus, you'd know your own driver best -- aren't there any hints you
 could give me as to where to start looking? Im not experienced at all as
 far as linux kernel internals are concerned.
 
 I haven't experienced that issue yet I looked through the
 corresponding driver and
 couldn't find anything that looks suspicious.
 I'll allocate a box for testing it for a week after Christmas.

Carl, in the meantime Markus can test this, you can try the following things:

 - compile your kernel with CONFIG_DEBUG_SLAB=y and CONFIG_DEBUG_SLAB_LEAK=y
   This will create the /proc/slab_allocators which contains information about
   who is allocated memory. You can easily analyze the content with the
   following one-liner shell command:

   while true; do clear; cat /proc/slab_allocators | grep em28xx; sleep 1; 
done

 - you can restrict the available memory with the mem kernel parameter (see
   linux/Documentation/kernel-parameters.txt). You can also disable swap space 
with
   swapoff -a. This means that you will reach the out of memory condition
   much faster.

 - you can try to use Valgrind ( http://valgrind.org/ ) with the user space vdr
   application. Although you mentioned that you don't think the user space
   application leaks, this might show some unexpected results.

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] Terratec Cinergy USB T Xs on Ubuntu 8.10

2008-12-17 Thread Németh Márton
Valerio wrote:
 2008/12/17 Németh Márton nm...@freemail.hu:
 Valerio wrote:
 2008/12/16 Németh Márton nm...@freemail.hu:
 Valerio wrote:
 I am trying to use my DVB only device Terratec Cinergy USB T XS on
 Ubuntu 8.10 (2.6.27-9-generic) but, although I don't find error
 message on dmesg and the card seems to be correctly detected, I am not
 able to use it in kaffeine or other application.
 Is there a way to check if the driver is working correctly or not?
 You could try the v4l-info command. It is included in the v4l-conf
 package under Debian: http://packages.debian.org/etch/v4l-conf .
 the v4l-info output doesn't contain any info about Terratec Cinergy
 (but only about my Webcam) so I suppose it is not working...
 Try ls -la /dev/video*. Then you can try v4l-info /dev/video1
 instead of just calling v4l-info without parameter.

 this is the v4l-info /dev/video1 output
 
 
 ### v4l2 device info [/dev/video1] ###
 general info
 VIDIOC_QUERYCAP
   driver  : em28xx
   card: Terratec Cinergy T XS
   bus_info: 1-4.4.1
   version : 0.1.0
   capabilities: 0x5030041
 [VIDEO_CAPTURE,?,TUNER,AUDIO,READWRITE,STREAMING]

I had a closer look, it seems that you are not using the em28xx-new
driver. The em28xx-new has a version code of 0.0.1:

### v4l2 device info [/dev/video0] ###
general info
VIDIOC_QUERYCAP
driver  : em28xx
card: Pinnacle Hybrid Pro
bus_info: 2-3
version : 0.0.1
capabilities: 0x5030011 
[VIDEO_CAPTURE,VBI_CAPTURE,TUNER,AUDIO,READWRITE,STREAMING]

You can get em28xx-new with the command:

hg clone http://mcentral.de/hg/~mrec/em28xx-new

You might also want to check the install guide at 
http://mcentral.de/wiki/index.php5/Em2880 .

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] change the argument of VIDIOC_S_INPUT to __u32

2008-12-15 Thread Németh Márton
The argument of VIDIOC_S_INPUT is __u32 according to
http://v4l2spec.bytesex.org/spec/r11217.htm . The documentation
only says that a pointer to a number should be passed, and this
number should be as in the struct v4l2_input index field. The
index field there has __u32 type.

This change prevents the following condition to fail:

if (*index = MAX_EM28XX_INPUT)
return -EINVAL;

Imagine for example if index is signed: index=0x8000=-2147483648,
then the condition above won't return -EINVAL.
diff -r 932738881388 em28xx-video.c
--- a/em28xx-video.c	Thu Dec 11 09:33:26 2008 +0100
+++ b/em28xx-video.c	Mon Dec 15 22:33:35 2008 +0100
@@ -440,7 +440,7 @@
 
 }
 
-static void video_mux(struct em28xx *dev, int index)
+static void video_mux(struct em28xx *dev, __u32 index)
 {
 	int input = INPUT(index)-vmux;
 	struct v4l2_routing route;
@@ -2052,7 +2052,7 @@
 	}
 	case VIDIOC_S_INPUT:
 	{
-		int *index = arg;
+		__u32 *index = arg;
 
 		if (*index = MAX_EM28XX_INPUT)
 			return -EINVAL;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] parameter of VIDIOC_G_INPUT and VIDIOC_S_INPUT?

2008-12-15 Thread Németh Márton
Hi,

I have a question about the parameter of VIDIOC_G_INPUT and VIDIOC_S_INPUT
parameters in v4l2 specification.

The Video for Linux Two API Specification text says that the
parameter of VIDIOC_G_INPUT and VIDIOC_S_INPUT is ...

 [...] a pointer to an integer where the driver stores the number
 of the input, as in the struct v4l2_input index field.

 http://v4l2spec.bytesex.org/spec/r11217.htm

In the v4l2_input structure the index has the type of __u32.

In contrast, in linux/videodev2.h (as of 2.6.27) the ioctls are defined
as follows:

 #define VIDIOC_G_INPUT_IOR('V', 38, int)
 #define VIDIOC_S_INPUT_IOWR('V', 39, int)

The problem is that '__u32' is unsigned and 'int' is signed. Furthermore
one cannot be sure that sizeof(__u32) == sizeof(int) on all platforms.

I guess that the parameter of VIDIOC_G_INPUT and VIDIOC_S_INPUT should be
a pointer to __u32. What do you think?

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] cleanup the comments for ioctl() calls in em28xx-video.c

2008-12-13 Thread Németh Márton
The function names mentioned in the comments are no longer exist. Correct them.
diff -r 932738881388 em28xx-video.c
--- a/em28xx-video.c	Thu Dec 11 09:33:26 2008 +0100
+++ b/em28xx-video.c	Sat Dec 13 11:17:57 2008 +0100
@@ -1875,9 +1875,9 @@
 }
 
 /*
- * em28xx_v4l2_do_ioctl()
- * This function is _not_ called directly, but from
- * em28xx_v4l2_ioctl. Userspace
+ * em28xx_do_ioctl()
+ * This function is _not_ called directly, but indirectly from
+ * em28xx_v4l2_ioctl() via em28xx_video_do_ioctl(). Userspace
  * copying is done already, arg is a kernel pointer.
  */
 static int em28xx_do_ioctl(struct inode *inode, struct file *filp,
@@ -2389,7 +2389,7 @@
 }
 
 /*
- * em28xx_v4l2_do_ioctl()
+ * em28xx_video_do_ioctl()
  * This function is _not_ called directly, but from
  * em28xx_v4l2_ioctl. Userspace
  * copying is done already, arg is a kernel pointer.
@@ -2836,7 +2836,7 @@
 
 /*
  * em28xx_v4l2_ioctl()
- * handle v4l2 ioctl the main action happens in em28xx_v4l2_do_ioctl()
+ * handle v4l2 ioctl, the main action happens in em28xx_video_do_ioctl()
  */
 static int em28xx_v4l2_ioctl(struct inode *inode, struct file *filp,
 			 unsigned int cmd, unsigned long arg)
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] unify dprintk() messages in attach_inform()

2008-12-10 Thread Németh Márton
In attach_inform() function the dprintk() messages has the
attach_inform prefix. Make them similar to each other.
diff -r b8b5a5bb8287 em28xx-i2c.c
--- a/em28xx-i2c.c	Wed Dec 10 08:54:29 2008 +0100
+++ b/em28xx-i2c.c	Wed Dec 10 23:16:31 2008 +0100
@@ -840,10 +840,10 @@
 		dprintk1(1, attach_inform: tvp5150 detected.\n);
 		break;
 	case 0x1e:
-		dprintk1(1, zl10353 demodulator found!\n);
+		dprintk1(1, attach_inform: zl10353 demodulator found!\n);
 		break;
 	default:
-		dprintk1(1, attach inform (default): 
+		dprintk1(1, attach_inform: (default): 
 			detected I2C address %x\n, client-addr  1);
 		dev-tuner_addr = client-addr;
 		em28xx_set_tuner(-1, client);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] code coverage measurement results

2008-12-08 Thread Németh Márton
Hi all,

I created a code coverage measurement of the em28xx-new driver
with Linux kernel 2.6.25 + gcov-kernel patch. The gcov-kernel patch
is available from http://ltp.sourceforge.net/coverage/gcov.php and
I used lcov ( http://ltp.sourceforge.net/coverage/lcov.php ) to
generate html reports. I send the results so anybody how is
interested in can read it.

The code coverage measurement shows which lines were executed
and how many times. For details see http://en.wikipedia.org/wiki/Code_coverage

While I was watching to analog channels of the Pinnacle Hybrid
Pro Stick (320e) with xawtv about 40% of the em28xx-new driver lines were
executed.

Is there any test specification or test case description
exists for em28xx-new or for v4l2? I only found this email so far:
http://lists-archives.org/video4linux/21251-does-a-v4l2-test-application-exist.html

And here comes the results. I collected the mostly called
functions while I was running xawtv from userspace:

Count   FileFunction
68533   em28xx-core.c   em28xx_isoc_vbi_copy()
37998   em28xx-core.c   em28xx_isoc_video_copy()
8618em28xx-core.c   em28xx_isocIrq()
8517em28xx-video.c  em28xx_v4l2_poll()
4849em28xx-core.c   em28xx_write_regs_req()
3262em28xx-core.c   em28xx_read_reg_req()
3163em28xx-video.c  em28xx_v4l2_ioctl()
2948em28xx-core.c   em28xx_isoc_video()
2742em28xx-i2c.cem28xx_i2c_xfer()
2650em28xx-i2c.cem28xx_i2c_send_bytes()
1833em28xx-core.c   em28xx_write_regs()
1452em28xx-video.c  em28xx_video_do_ioctl(), VIDIOC_QBUF
1026em28xx-core.c   em28xx_read_reg_req_len()
(the functions which are called less than 1000 times not included in 
this list)

The summary page for different source files contains:

LTP GCOV extension - code coverage report

Current view:   directory - /usr/src/mcentral.de/em28xx-new
Test:   kernel.info
Date:   2008-12-09  Instrumented lines: 4119
Code covered:   40.2 %  Executed lines: 1654

FilenameCoverage
em2880-dvb.c22.1%   86 / 389 lines
em28xx-cards.c  5.6 %   22 / 391 lines
em28xx-core.c   63.7 %  391 / 614 lines
em28xx-i2c.c43.1 %  169 / 392 lines
em28xx-input.c  37.9 %  85 / 224 lines
em28xx-video.c  45.0 %  887 / 1970 lines
em28xx-webcam.c 0.0 %   0 / 95 lines
em28xx.h31.8 %  14 / 44 lines

Generated by: LTP GCOV extension version 1.6

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] MINOR_VFL_TYPE_GRABBER_MIN MINOR_VFL_TYPE_VBI_MIN no longer available in 2.6.28-rc5

2008-12-07 Thread Németh Márton
Németh Márton wrote:
 Hi,
 
 I tried to build em28xx-new with 2.6.28-rc5. The build failed because
 the linux/media/v4l2-dev.h no longer contains the MINOR_VFL_TYPE_GRABBER_MIN
 and MINOR_VFL_TYPE_VBI_MIN defines.
 
 http://www.linuxhq.com/kernel/v2.6/28-rc2/include/media/v4l2-dev.h
 
 
 $ make
 
 running ./build.sh build
 
 make[1]: Entering directory `/usr/src/mcentral.de/em28xx-new'
 rm -rf Module.symvers;
 make -C /lib/modules/`if [ -d /lib/modules/2.6.21.4-eeepc ]; then echo 
 2.6.21.4-eeepc; else uname -r; fi`/build SUBDIRS=`pwd` modules
 make[2]: Entering directory `/usr/src/linux-2.6.28-rc5'
   CC [M]  /usr/src/mcentral.de/em28xx-new/em2880-dvb.o
   CC [M]  /usr/src/mcentral.de/em28xx-new/em28xx-video.o
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c: In function 
 'em28xx_release_resources':
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:826: error: 
 'MINOR_VFL_TYPE_GRABBER_MIN' undeclared (first use in this function)
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:826: error: (Each undeclared 
 identifier is reported only once
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:826: error: for each function 
 it appears in.)
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:830: error: 
 'MINOR_VFL_TYPE_VBI_MIN' undeclared (first use in this function)
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c: In function 
 'em28xx_stream_interrupt':
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:1535: error: 
 'MINOR_VFL_TYPE_GRABBER_MIN' undeclared (first use in this function)
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c: In function 'em28xx_do_ioctl':
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:2386: warning: passing 
 argument 1 of 'v4l_compat_translate_ioctl' from incompatible pointer type
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:2386: warning: passing 
 argument 2 of 'v4l_compat_translate_ioctl' makes integer from pointer without 
 a cast
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:2386: warning: passing 
 argument 3 of 'v4l_compat_translate_ioctl' makes pointer from integer without 
 a cast
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:2386: error: too many 
 arguments to function 'v4l_compat_translate_ioctl'
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c: In function 
 'em28xx_video_do_ioctl':
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:2832: warning: passing 
 argument 6 of 'em28xx_do_ioctl' from incompatible pointer type
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c: In function 'em28xx_init_dev':
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:3268: error: 
 'MINOR_VFL_TYPE_VBI_MIN' undeclared (first use in this function)
 /usr/src/mcentral.de/em28xx-new/em28xx-video.c:3272: error: 
 'MINOR_VFL_TYPE_GRABBER_MIN' undeclared (first use in this function)
 make[3]: *** [/usr/src/mcentral.de/em28xx-new/em28xx-video.o] Error 1
 make[2]: *** [_module_/usr/src/mcentral.de/em28xx-new] Error 2
 make[2]: Leaving directory `/usr/src/linux-2.6.28-rc5'
 make[1]: *** [default] Error 2
 make[1]: Leaving directory `/usr/src/mcentral.de/em28xx-new'

This is still true for em28xx-new revision 267 with Linux kernel 2.6.28-rc7.

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] webcam recogniced but does not work

2008-12-07 Thread Németh Márton
 Németh Márton wrote:
  Is xawtv or tvtime working for you? I tried my Pinnacle Hybrid Pro Stick 
  (320e)
  with ekiga and I get similar error message. For me xawtv and tvtime are 
  working.

 Tvtime give me only a blue picture

 Cheese said no camera found .

 gstreamer-propeties freezes when testing the cam :

 output of

 strace -f gstreamer-properties

 


 [pid  8617] ioctl(30, VIDIOCGMBUF unfinished ...
 [pid  8703] ... nanosleep resumed {0, 1}) = 0
 [pid  8703] nanosleep({0, 5000},  unfinished ...
 [pid  8617] ... ioctl resumed , 0xbf82d770) = 0
 [pid  8617] mmap2(NULL, 1662976, PROT_READ|PROT_WRITE, MAP_SHARED, 30, 0) = 
 0xb2a2
 [pid  8617] ioctl(30, VIDIOCMCAPTURE, 0xbf82d7f8) = 0
 [pid  8617] ioctl(30, VIDIOCSYNC unfinished ...
 [pid  8703] ... nanosleep resumed {0, 1}) = 0
 [pid  8703] nanosleep({0, 5000}, {0, 1}) = 0
 [pid  8703] nanosleep({0, 5000}, {0, 1}) = 0

It seems that the VIDIOSYNC ioctl() never returns. Could you please try
the attached debug patch to em28xx-new and send the dmesg output?

Regards,

Márton Németh

diff -r 958f27d0e4dd em28xx-core.c
--- a/em28xx-core.c	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx-core.c	Fri Dec 05 06:58:04 2008 +0100
@@ -783,7 +783,10 @@
 unsigned long *lock_flags, unsigned char buf)
 {
 
+	printk(KERN_DEBUG %s:%u:%s(): buf=0x%X, counter=%i\n, __FILE__, __LINE__,
+			__func__, buf, dev-buf_counter_debug);
 	if (!(buf  0x01)) {
+		dev-buf_counter_debug = 0;
 		if ((*vbif)) {
 			if ((*vbif)-state == F_GRABBING) {
 /*previous frame is incomplete */
@@ -857,6 +860,7 @@
 			}
 		}
 	} else {
+		dev-buf_counter_debug++;
 		if ((*vbif)) {
 			if ((*vbif)-state == F_QUEUED)
 (*vbif)-top_field = 0;
diff -r 958f27d0e4dd em28xx.h
--- a/em28xx.h	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx.h	Fri Dec 05 06:58:04 2008 +0100
@@ -830,6 +830,7 @@
 
 	struct em28xx_aad_info *aad;
 
+	int buf_counter_debug;
 };
 
 struct em28xx_ops {
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] increase code readability by introducing em28xx_capture_stop()

2008-12-06 Thread Németh Márton
The em28xx_capture_start() had a second parameter called start. So
the following calls were:

ret = em28xx_caputure_start(dev, 1); /* start capture */
ret = em28xx_caputure_start(dev, 0); /* stop capture */

This patch removes the start parameter and introduces a new function
instead:

ret = em28xx_capture_start(dev);
ret = em28xx_capture_stop(dev);

This is to increase the readability of the source code.
diff -r 958f27d0e4dd em28xx-core.c
--- a/em28xx-core.c	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx-core.c	Sat Dec 06 09:36:49 2008 +0100
@@ -525,18 +525,30 @@
 	return 0;
 }
 
-int em28xx_capture_start(struct em28xx *dev, int start)
+int em28xx_capture_start(struct em28xx *dev)
 {
 	int ret;
 	/* FIXME: which is the best order? */
 	/* video registers are sampled by VREF */
-	ret = em28xx_write_reg_bits(dev,
-		R0C_USBSUSP_REG, start ? 0x10 : 0x00, 0x10);
-	if (ret  0)
-		return ret;
-	/* enable video capture */
-	return em28xx_write_regs(dev, R12_VINENABLE_REG, start ?
-			\x67 : \x27, 1);
+	ret = em28xx_write_reg_bits(dev, R0C_USBSUSP_REG, 0x10, 0x10);
+	if (0 = ret) {
+		/* enable video capture */
+		ret = em28xx_write_regs(dev, R12_VINENABLE_REG, \x67, 1);
+	}
+	return ret;
+}
+
+int em28xx_capture_stop(struct em28xx *dev)
+{
+	int ret;
+	/* FIXME: which is the best order? */
+	/* video registers are sampled by VREF */
+	ret = em28xx_write_reg_bits(dev, R0C_USBSUSP_REG, 0x00, 0x10);
+	if (0 = ret) {
+		/* disable video capture */
+		ret = em28xx_write_regs(dev, R12_VINENABLE_REG, \x27, 1);
+	}
+	return ret;
 }
 
 int em28xx_outfmt_set_yuv422(struct em28xx *dev)
@@ -1244,7 +1256,7 @@
 		dev-urb[i] = NULL;
 		dev-transfer_buffer[i] = NULL;
 	}
-	em28xx_capture_start(dev, 0);
+	em28xx_capture_stop(dev);
 }
 
 /*
diff -r 958f27d0e4dd em28xx-video.c
--- a/em28xx-video.c	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx-video.c	Sat Dec 06 09:36:49 2008 +0100
@@ -783,7 +783,7 @@
 		dev-vbi_frame_current = NULL;
 		dev-frame_current = NULL;
 
-		em28xx_capture_start(dev, 1);
+		em28xx_capture_start(dev);
 		em28xx_resolution_set(dev);
 
 		/* start the transfer */
@@ -1868,7 +1868,7 @@
 	dev-vbi_io = IO_NONE;
 	em28xx_uninit_isoc(dev);
 	em28xx_set_alternate(dev);
-	em28xx_capture_start(dev, 1);
+	em28xx_capture_start(dev);
 	em28xx_resolution_set(dev);
 	em28xx_init_isoc(dev);
 	return 0;
diff -r 958f27d0e4dd em28xx.h
--- a/em28xx.h	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx.h	Sat Dec 06 09:36:49 2008 +0100
@@ -868,7 +868,8 @@
 int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val);
 int em28xx_audio_analog_set(struct em28xx *dev);
 int em28xx_colorlevels_set_default(struct em28xx *dev);
-int em28xx_capture_start(struct em28xx *dev, int start);
+int em28xx_capture_start(struct em28xx *dev);
+int em28xx_capture_stop(struct em28xx *dev);
 int em28xx_outfmt_set_yuv422(struct em28xx *dev);
 int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, u8 ymin,
 			   u8 ymax);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] remove redundant transfer_buffer field from struct em28xx

2008-12-06 Thread Németh Márton
In struct em28xx the dev-transfer_buffer[i] and dev-urb[i]-transfer_buffer
always have the same value. This is redundant, so dev-transfer_buffer[i] can be
removed.
diff -r 958f27d0e4dd em28xx-core.c
--- a/em28xx-core.c	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx-core.c	Sat Dec 06 10:19:28 2008 +0100
@@ -1233,16 +1233,16 @@
 	for (i = 0; i  EM28XX_NUM_BUFS; i++) {
 		if (dev-urb[i]) {
 			usb_kill_urb(dev-urb[i]);
-			if (dev-transfer_buffer[i]) {
+			if (dev-urb[i]-transfer_buffer) {
 usb_buffer_free(dev-udev,
 	dev-urb[i]-transfer_buffer_length,
-	dev-transfer_buffer[i],
+	dev-urb[i]-transfer_buffer,
 	dev-urb[i]-transfer_dma);
+dev-urb[i]-transfer_buffer = NULL;
 			}
 			usb_free_urb(dev-urb[i]);
 		}
 		dev-urb[i] = NULL;
-		dev-transfer_buffer[i] = NULL;
 	}
 	em28xx_capture_start(dev, 0);
 }
@@ -1275,21 +1275,20 @@
 			em28xx_uninit_isoc(dev);
 			return -ENOMEM;
 		}
-		dev-transfer_buffer[i] = usb_buffer_alloc(dev-udev,
+		urb-transfer_buffer = usb_buffer_alloc(dev-udev,
 sb_size, GFP_KERNEL, urb-transfer_dma);
-		if (!dev-transfer_buffer[i]) {
+		if (!urb-transfer_buffer) {
 			em28xx_errdev(unable to allocate %i bytes for 
   transfer buffer %i\n, sb_size, i);
 			em28xx_uninit_isoc(dev);
 			return -ENOMEM;
 		}
-		memset(dev-transfer_buffer[i], 0, sb_size);
+		memset(urb-transfer_buffer, 0, sb_size);
 		urb-dev = dev-udev;
 		urb-context = dev;
 		urb-pipe = usb_rcvisocpipe(dev-udev, 0x82);
 		urb-transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
 		urb-interval = 1;
-		urb-transfer_buffer = dev-transfer_buffer[i];
 		urb-complete = em28xx_isocIrq;
 		urb-number_of_packets = EM28XX_NUM_PACKETS;
 		urb-transfer_buffer_length = sb_size;
diff -r 958f27d0e4dd em28xx.h
--- a/em28xx.h	Fri Dec 05 00:05:07 2008 +0100
+++ b/em28xx.h	Sat Dec 06 10:19:28 2008 +0100
@@ -803,7 +803,6 @@
 	u8 num_alt;		/* Number of alternative settings */
 	unsigned int *alt_max_pkt_size;	/* array of wMaxPacketSize */
 	struct urb *urb[EM28XX_NUM_BUFS];	/* urb for isoc transfers */
-	char *transfer_buffer[EM28XX_NUM_BUFS];	/* transfer buffers for isoc transfer */
 
 	/* helper funcs that call usb_control_msg */
 
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] tvtime + analog channels with Pinnacle Hybrid Pro Stick (320e)

2008-12-04 Thread Németh Márton
Németh Márton wrote:
 Hi,
 
 I fetched tvtime from mcentral.de ( http://mcentral.de/wiki/index.php5/Tvtime 
 )
 compiled it and tried to tune to analog channels.
 
 I found that when I almost find a channel with the fine tune menu item
 tvtime freezes into the VIDIOC_DQBUF ioctl() call. I checked this with 
 strace.
 
 I added some debug printk()s to the em28xx-new driver. This showed that the
 driver waits in em28xx-video.c on the line
 
   ret = wait_event_interruptible
   (dev-wait_frame,
   (!list_empty(dev-outqueue)) ||
   (dev-state  DEV_DISCONNECTED));
 
 Then I also recognized that in this situation when the VIDIOC_DQBUF freezes
 the buf parameter of em28xx_isoc_video() in em28xx-core.c is always 1. This 
 means
 that the dev-outqueue will never be filled.
 
 I also recognized similar behaviour in former times when I tried to tune
 in the signal of a Video Casette Recorder (VCR). This VCR produced a simple
 blue background. When this signal was on the screen, the application was 
 frozen.
 When I unplugged the signal, the video application continued.
 
 What does the buf parameter of the em28xx_isoc_video() mean?

Additionally, I attached my debug patch and the dmesg output. I hope this will 
show
the behaviour more exactly:

[ 1231.567221] usb 2-3: new high speed USB device using ehci_hcd and address 2
[ 1231.698113] usb 2-3: configuration #1 chosen from 1 choice
[ 1231.920549] Linux video capture interface: v2.00
[ 1232.050241] em28xx v4l2 driver version 0.0.1 loaded
[ 1232.056078] em28xx: new video device (eb1a:2881): interface 0, class 255
[ 1232.056090] em28xx: device is attached to a USB 2.0 bus
[ 1232.056135] em28xx #0: Alternate settings: 8
[ 1232.056144] em28xx #0: Alternate setting 0, max size= 0
[ 1232.056150] em28xx #0: Alternate setting 1, max size= 0
[ 1232.056156] em28xx #0: Alternate setting 2, max size= 1448
[ 1232.056162] em28xx #0: Alternate setting 3, max size= 2048
[ 1232.056168] em28xx #0: Alternate setting 4, max size= 2304
[ 1232.056173] em28xx #0: Alternate setting 5, max size= 2580
[ 1232.056179] em28xx #0: Alternate setting 6, max size= 2892
[ 1232.056185] em28xx #0: Alternate setting 7, max size= 3072
[ 1232.521531] attach_inform: tvp5150 detected.
[ 1232.566546] tvp5150 1-005c: tvp5150am1 detected.
[ 1234.200565] successfully attached tuner
[ 1234.207498] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[ 1234.221297] em28xx #0: V4L2 device registered as /dev/video0
[ 1234.233746] input: em2880/em2870 remote control as /class/input/input9
[ 1234.241497] em28xx-input.c: remote control handler attached
[ 1234.241504] em28xx #0: Found Pinnacle Hybrid Pro
[ 1234.256426] usbcore: registered new interface driver snd-usb-audio
[ 1234.268307] usbcore: registered new interface driver em28xx
[ 1234.512487] em2880-dvb.c: DVB Init
[ 1234.933976] DVB: registering new adapter (em2880 DVB-T)
[ 1234.934298] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[ 1234.945549] Em28xx: Initialized (Em2880 DVB Extension) extension
[ 1259.202480] tvp5150 1-005c: tvp5150am1 detected.
[ 1260.932260] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.300198] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.316367] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.332412] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.348436] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.364466] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.388196] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.404207] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.420227] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.436251] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.452186] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.468189] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.484197] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.500195] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.516188] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.532219] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x0, 
counter=1
[ 1261.548193] 
/usr/src/mcentral.de/em28xx-new/em28xx-core.c:786:em28xx_isoc_video(): buf=0x1, 
counter=0
[ 1261.564191

[Em28xx] [PATCH] cleanup em28xx_isocdbg()

2008-12-03 Thread Németh Márton
Move space after the ':' like this:

-em28xx #0 em28xx_isocIrq :packet 63 is empty
+em28xx #0 em28xx_isocIrq: packet 63 is empty

Added some missing newlines when using em28xx_isocdbg().
diff -r e5dcc8677645 em28xx-core.c
--- a/em28xx-core.c	Wed Dec 03 00:39:43 2008 +0100
+++ b/em28xx-core.c	Wed Dec 03 21:43:49 2008 +0100
@@ -58,7 +58,7 @@
 
 #define em28xx_isocdbg(fmt, arg...) do {\
 	if (isoc_debug) \
-		printk(KERN_INFO %s %s :fmt, \
+		printk(KERN_INFO %s %s: fmt, \
 			 dev-name, __func__ , ##arg); } while (0)
 
 static int alt = EM28XX_PINOUT;
@@ -1113,7 +1113,7 @@
 			(*f)-state = F_QUEUED;
 		(*f) = NULL;
 
-		em28xx_isocdbg(stream interrupted);
+		em28xx_isocdbg(stream interrupted\n);
 		wake_up_interruptible(dev-video_wait_stream);
 	}
 
@@ -1155,7 +1155,7 @@
 
 			if (urb-iso_frame_desc[i].status) {
 em28xx_isocdbg(data error: [%d] len=%d, 
-		status=%d, i,
+		status=%d\n, i,
 	urb-iso_frame_desc[i].actual_length,
 	urb-iso_frame_desc[i].status);
 
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] move space after colon in em28xx_videodbg()

2008-11-21 Thread Németh Márton
Change the debug messages like this:

-em28xx #0 em28xx_do_ioctl :VIDIOC_STREAMON: starting stream
+em28xx #0 em28xx_do_ioctl: VIDIOC_STREAMON: starting stream

(Sorry for my previous incomplete mail which I might send accidentally.)
diff -r 4ce58a8265cb em28xx-video.c
--- a/em28xx-video.c	Fri Nov 21 07:12:31 2008 +0100
+++ b/em28xx-video.c	Fri Nov 21 08:48:14 2008 +0100
@@ -69,7 +69,7 @@
 
 #define em28xx_videodbg(fmt, arg...) do {\
 	if (video_debug) \
-		printk(KERN_INFO %s %s :fmt, \
+		printk(KERN_INFO %s %s: fmt, \
 			 dev-name, __func__ , ##arg); } while (0)
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] strange problems with Terratec Hybrid XS FM

2008-11-21 Thread Németh Márton
Waldemar Brodkorb wrote:
 Hi,
 Németh Márton wrote,
 
 Hello Waldemar,

 Waldemar Brodkorb wrote:
 Hi,

 I have a Terratec Hybrid XS FM (0ccd:0072). I am using Gentoo Linux
 with a self compiled Linux Kernel 2.6.27.6 and the latest em28xx-new
 drivers. 
 From the attached logfiles it seems that you are not using the latest
 version of em28xx-new. Currently the latest version in hg is the
 revision 260. You can check your revision with the hg view command.

 Could you please try revision 260 and send some more logs?
 
 I know it is not the very latest stuff, because I tested even older
 revisions without any success. I tried back to revision 235 without
 success. I tried different Linux systems. It is not working on
 Debian/GNU Lenny on a AMD64 Desktop PC. My last test was to use the
 same revision, I used as it was working, so I can compare the
 different dmesg from /var/log/messages to see any difference.
  
 In the first three days everything worked fine. Then suddenly the
 card did not work anymore. After several hours of debugging, I think 
 either the use of kaffeine or klear made the hardware unusable.

 Attached is a dmesg output before and after playing with kaffeine
 and klear. TV worked fine with both programs, after rebooting my
 laptop TV stopped working.

 Does anyone have an idea how to get the card in a working state
 again?
 You can always try to exit all video player application (like kaffeine),
 unplug the device, rmmod all the modules which begins with em28
 (you can check this with the command lsmod |grep em28).

 Then plug the device again. This will load the kernel modules again.
 
 I know. But there is a bug in the IR code, my keyboard stops working
 after removing the stick. 

You could try disabling the IR. I am not sure that the disable_ir
parameter of em28xx does what you need.

 The question is still valid, why does the usb stick does not work
 under Linux anymore? 
 
 The difference between the working and nonworking dmesg is many more
 register disabled messages.
 
 Attached is a fresh dmesg from revision 261.
 Why the i2c communication to the dvb-t demodulator fails?

According to linux/include/asm-generic/errno-base.h the retval -19 means
-ENODEV: No such device.

[I get similar problems with my Pinnacle Hybrid Pro Stick (320e). With
with this device I have hardware contact problems and my device gets
sometimes disconnected. Maybe you have different problem.]

Regards,

Márton Németh


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] problem with sound of analog channels on Pinnacle Hybrid Pro Stick (320e)

2008-11-20 Thread Németh Márton
Markus Rechberger írta:
 On Thu, Nov 20, 2008 at 12:40 AM, Németh Márton [EMAIL PROTECTED] wrote:
 Markus Rechberger írta:
 Hi,

 2008/11/19 Németh Márton [EMAIL PROTECTED]:
 Hi,

 I have the some problems when I want to watch analog broadcast channels
 on Pinnacle Hybrid Pro Stick (320e) USB ID=eb1a:2881.

 Steps to reproduce:
 1. Boot computer
 2. Plug in Pinnacle Hybrid Pro Stick (320e)
 3. Start rawrec -c 1 -f s16_le -s 44100 -d /dev/dsp2 |rawplay -c 1 -f 
 s16_le -s 44100 -d /dev/dsp as root
 4. Start xawtv = there is no sound
 run rawrec after xawtv is started?
 The result is the same: no sound.
 Change Video source from Television to Composite1 = no sound, black 
 video.
 Change Video source from Composite1 to Television again = video OK 
 and sound is available (but noisy).

 If I exit xawtv now and start it again I do not need to change
 the Video source and I can hear the sound.
 
 I will check this tomorrow!

Additional info: when the device is first plugged in, there is no sound with
xawtv. Then I open the Video source and select again Television, then
the sound starts.

Then I stop xawtv, start it again: there is sound.

Then I stop xawtv again, unplug the device, replug it: there is no sound
in xawtv until I set the Video source again explicitly.

Regards,

Márton Németh

 5. Right click on xawtv to show the menu window
 6. Modify Video source from Television to Composite1
 7. Modify Video source back from Composite1 to Television

 now I can hear the sound (altrough it is a robot-like sound, which can be
 understanded but it is not clear). I am using Linux kernel 2.6.27.5.

 Any idea how to fix the sound?

 Regards,

Márton Németh
 
 


___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] problem with sound of analog channels on Pinnacle Hybrid Pro Stick (320e)

2008-11-20 Thread Németh Márton
Németh Márton írta:
 Markus Rechberger írta:
 On Thu, Nov 20, 2008 at 12:40 AM, Németh Márton [EMAIL PROTECTED] wrote:
 Markus Rechberger írta:
 Hi,

 2008/11/19 Németh Márton [EMAIL PROTECTED]:
 Hi,

 I have the some problems when I want to watch analog broadcast channels
 on Pinnacle Hybrid Pro Stick (320e) USB ID=eb1a:2881.

 Steps to reproduce:
 1. Boot computer
 2. Plug in Pinnacle Hybrid Pro Stick (320e)
 3. Start rawrec -c 1 -f s16_le -s 44100 -d /dev/dsp2 |rawplay -c 1 -f 
 s16_le -s 44100 -d /dev/dsp as root
 4. Start xawtv = there is no sound
 run rawrec after xawtv is started?
 The result is the same: no sound.
 Change Video source from Television to Composite1 = no sound, black 
 video.
 Change Video source from Composite1 to Television again = video OK 
 and sound is available (but noisy).

 If I exit xawtv now and start it again I do not need to change
 the Video source and I can hear the sound.
 I will check this tomorrow!
 
 Additional info: when the device is first plugged in, there is no sound with
 xawtv. Then I open the Video source and select again Television, then
 the sound starts.
 
 Then I stop xawtv, start it again: there is sound.
 
 Then I stop xawtv again, unplug the device, replug it: there is no sound
 in xawtv until I set the Video source again explicitly.

I did another test:
1. Boot computer
2. Load kernel module: modprobe -k em28xx video_debug=1
3. Plug Pinnacle Hybrid Pro Stick (320e)
4. Start xawtv
5. rawrec -c 1 -f s16_le -s 44100 -d /dev/dsp2 |rawplay -c 1 -f s16_le -s 44100 
-d /dev/dsp

Now there is no sound. The dmesg so far is:

[ 2906.699745] Linux video capture interface: v2.00
[ 2906.732868] em28xx v4l2 driver version 0.0.1 loaded
[ 2906.734659] usbcore: registered new interface driver em28xx
[ 2924.021109] usb 4-3: new high speed USB device using ehci_hcd and address 4
[ 2924.151114] usb 4-3: configuration #1 chosen from 1 choice
[ 2924.155353] em28xx: new video device (eb1a:2881): interface 0, class 255
[ 2924.156869] em28xx: device is attached to a USB 2.0 bus
[ 2924.157489] em28xx #0: Alternate settings: 8
[ 2924.157831] em28xx #0: Alternate setting 0, max size= 0
[ 2924.158209] em28xx #0: Alternate setting 1, max size= 0
[ 2924.158541] em28xx #0: Alternate setting 2, max size= 1448
[ 2924.158920] em28xx #0: Alternate setting 3, max size= 2048
[ 2924.159293] em28xx #0: Alternate setting 4, max size= 2304
[ 2924.159788] em28xx #0: Alternate setting 5, max size= 2580
[ 2924.160191] em28xx #0: Alternate setting 6, max size= 2892
[ 2924.160660] em28xx #0: Alternate setting 7, max size= 3072
[ 2924.632841] attach_inform: tvp5150 detected.
[ 2924.679559] tvp5150 1-005c: tvp5150am1 detected.
[ 2926.325129] successfully attached tuner
[ 2926.325446] em28xx #0 em28xx_init_dev :tvnorm = PAL-BG
[ 2926.338656] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[ 2926.363367] em28xx #0 video_mux :Setting input index = 0, vmux = 0, amux = 0
[ 2926.363861] em28xx #0: V4L2 device registered as /dev/video0
[ 2926.366615] input: em2880/em2870 remote control as /class/input/input12
[ 2926.375460] em28xx-input.c: remote control handler attached
[ 2926.375773] em28xx #0: Found Pinnacle Hybrid Pro
[ 2926.376603] audio device (eb1a:2881): interface 1, class 1
[ 2926.377063] audio device (eb1a:2881): interface 2, class 1
[ 2927.368716] em2880-dvb.c: DVB Init
[ 2927.424144] usbcore: registered new interface driver snd-usb-audio
[ 2927.918355] DVB: registering new adapter (em2880 DVB-T)
[ 2927.919085] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[ 2927.929104] Em28xx: Initialized (Em2880 DVB Extension) extension
[ 2988.924543] tvp5150 1-005c: tvp5150am1 detected.
[ 2989.044578] em28xx #0 em28xx_v4l2_open :open minor = 0 type = NULL users = 0
[ 2989.103519] em28xx #0 em28xx_v4l2_close :users = 1
[ 2989.149812] em28xx #0 em28xx_v4l2_close :setting alternate 0
[ 2989.150754] em28xx #0 em28xx_v4l2_open :open minor = 0 type = NULL users = 0
[ 2989.157776] em28xx #0 em28xx_v4l2_close :users = 1
[ 2989.207799] em28xx #0 em28xx_v4l2_close :setting alternate 0
[ 2989.207955] em28xx #0 em28xx_v4l2_open :open minor = 0 type = NULL users = 0
[ 2989.631165] em28xx #0 em28xx_do_ioctl :VIDIO_G_TUNER: signal = 0, afc = 0
[ 2989.953105] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: type = 
V4L2_BUF_TYPE_VIDEO_CAPTURE
[ 2989.953126] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: requested 384x288
[ 2989.953136] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: returned 384x288 (3584, 
4096)
[ 2990.032286] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: type = 
V4L2_BUF_TYPE_VIDEO_CAPTURE
[ 2990.032308] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: requested 384x288
[ 2990.032318] em28xx #0 em28xx_set_fmt :VIDIOC_S_FMT: returned 384x288 (3584, 
4096)
[ 2990.087707] em28xx #0 em28xx_video_do_ioctl :VIDIOC_REQBUFS: setting io 
method to mmap: num bufs 2
[ 2990.088619] em28xx #0 em28xx_do_ioctl :VIDIOC_STREAMON: starting stream
[ 2990.089315] em28xx #0 em28xx_do_ioctl :VIDIOC_STREAMOFF: interrupting stream
[ 2990.415597] em28xx

[Em28xx] [PATCH] handle possible NULL pointer at em28xx_aad_unregister()

2008-11-19 Thread Németh Márton
Hi,

I can trigger a NULL pointer reference with the em28xx-aad module.

Steps to reproduce:
1. Boot computer
2. modprobe -k em28xx-aad
3. Plug Pinnacle Hybrid Pro Stick (320e)
4. rmmod em28xx-aad

Current result: segmentation fault of rmmod and some error message in dmesg. I
attached a patch which adds BUG_ON to the critical point at em28xx-aad.c

[  563.253374] Linux video capture interface: v2.00
[  563.279996] em28xx v4l2 driver version 0.0.1 loaded
[  563.286122] usbcore: registered new interface driver em28xx
[  563.302980] initializing Empia Audio Driver
[  563.303560] Copyright (C) 2008 Empia Technology Inc
[  563.303938] Copyright (C) 2008 Sundtek Ltd.
[  565.810070] usb 1-3: new high speed USB device using ehci_hcd and address 3
[  565.939187] usb 1-3: configuration #1 chosen from 1 choice
[  565.946422] em28xx: new video device (eb1a:2881): interface 0, class 255
[  565.946952] em28xx: device is attached to a USB 2.0 bus
[  565.947432] em28xx #0: Alternate settings: 8
[  565.947796] em28xx #0: Alternate setting 0, max size= 0
[  565.948198] em28xx #0: Alternate setting 1, max size= 0
[  565.948566] em28xx #0: Alternate setting 2, max size= 1448
[  565.948985] em28xx #0: Alternate setting 3, max size= 2048
[  565.949393] em28xx #0: Alternate setting 4, max size= 2304
[  565.949757] em28xx #0: Alternate setting 5, max size= 2580
[  565.950158] em28xx #0: Alternate setting 6, max size= 2892
[  565.950526] em28xx #0: Alternate setting 7, max size= 3072
[  566.173552] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0x6, gpio_value=0x0
[  566.413989] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0xF, gpio_value=0x0
[  566.480763] attach_inform: tvp5150 detected.
[  566.527532] tvp5150 1-005c: tvp5150am1 detected.
[  568.113767] successfully attached tuner
[  568.126851] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[  568.151751] em28xx #0: V4L2 device registered as /dev/video0
[  568.154976] input: em2880/em2870 remote control as /class/input/input12
[  568.164485] em28xx-input.c: remote control handler attached
[  568.164808] em28xx #0: Found Pinnacle Hybrid Pro
[  568.165674] audio device (eb1a:2881): interface 1, class 1
[  568.166150] audio device (eb1a:2881): interface 2, class 1
[  568.348777] em2880-dvb.c: DVB Init
[  568.383000] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0x6, gpio_value=0x0
[  568.457339] usbcore: registered new interface driver snd-usb-audio
[  568.923199] DVB: registering new adapter (em2880 DVB-T)
[  568.923937] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[  568.934770] Em28xx: Initialized (Em2880 DVB Extension) extension
[  579.291192] releasing Empia Audio Driver
[  579.291803] [ cut here ]
[  579.291815] kernel BUG at /usr/src/mcentral.de/em28xx-new/em28xx-aad.c:373!
[  579.291824] invalid opcode:  [#1] PREEMPT
[  579.291834] Modules linked in: snd_usb_audio em28xx_dvb snd_usb_lib 
snd_hwdep drx3973d s921 mt2060 lgdt3304 zl10353 lgdt330x dvb_core qt1010 
tuner_xc3028
tvp5150 em28xx_aad(-) em28xx videodev v4l1_compat ppdev lp cpufreq_ondemand 
cpufreq_conservative ipv6 xt_tcpudp iptable_filter ip_tables x_tables
leds_clevo_mail led_class via via_agp drm agpgart eeprom snd_pcm_oss 
snd_mixer_oss cpufreq_userspace cpufreq_powersave powernow_k8 fan usbhid 
snd_via82xx
snd_mpu401_uart pcmcia snd_via82xx_modem snd_seq_midi firmware_class 
snd_ac97_codec snd_seq_midi_event ac97_bus mousedev snd_rawmidi snd_pcm snd_seq 
snd_timer
snd_seq_device snd 8139too mii i2c_viapro k8temp soundcore yenta_socket video 
snd_page_alloc hwmon uhci_hcd bitrev crc32 rsrc_nonstatic i2c_core psmouse
8250_pnp ehci_hcd backlight pcspkr ide_cd_mod 8250 output serio_raw cdrom 
usbcore pcmcia_core parport_pc serial_core parport battery ac thermal button 
processor
evdev
[  579.292021]
[  579.292021] Pid: 7845, comm: rmmod Not tainted (2.6.27.5 #2)
[  579.292021] EIP: 0060:[f8c410a0] EFLAGS: 00210246 CPU: 0
[  579.292021] EIP is at em28xx_aad_fini+0x80/0x90 [em28xx_aad]
[  579.292021] EAX: f69d6000 EBX:  ECX:  EDX: f8ec5d40
[  579.292021] ESI: f69d6000 EDI:  EBP: f44a3f28 ESP: f44a3f20
[  579.292021]  DS: 007b ES: 007b FS:  GS: 0033 SS: 0068
[  579.292021] Process rmmod (pid: 7845, ti=f44a2000 task=f6984020 
task.ti=f44a2000)
[  579.292021] Stack: f69d6030 f8c421e0 f44a3f40 f8eab2aa f44a3f40 c0329a16 
 f8c42280
[  579.292021]f44a3f4c f8c41800 f8c4182c f44a3fb0 c014ca68 f8c4228c 
38326d65 615f7878
[  579.292021]f4006461 f44a3f9c c0175651  b7f2d000 b7f2d000 
00200246 0001
[  579.292021] Call Trace:
[  579.292021]  [f8eab2aa] ? em28xx_unregister_extension+0x3a/0x90 [em28xx]
[  579.292021]  [c0329a16] ? printk+0x18/0x1a
[  579.292021]  [f8c41800] ? em28xx_aad_exit+0x1c/0x21 [em28xx_aad]
[  579.292021]  [c014ca68] ? sys_delete_module+0x158/0x220
[  579.292021]  [c0175651] ? do_munmap+0x1e1/0x240
[  579.292021]  [c0233838] ? 

Re: [Em28xx] problem with sound of analog channels on Pinnacle Hybrid Pro Stick (320e)

2008-11-19 Thread Németh Márton
Markus Rechberger írta:
 Hi,
 
 2008/11/19 Németh Márton [EMAIL PROTECTED]:
 Hi,

 I have the some problems when I want to watch analog broadcast channels
 on Pinnacle Hybrid Pro Stick (320e) USB ID=eb1a:2881.

 Steps to reproduce:
 1. Boot computer
 2. Plug in Pinnacle Hybrid Pro Stick (320e)
 3. Start rawrec -c 1 -f s16_le -s 44100 -d /dev/dsp2 |rawplay -c 1 -f 
 s16_le -s 44100 -d /dev/dsp as root
 4. Start xawtv = there is no sound
 
 run rawrec after xawtv is started?

The result is the same: no sound.
Change Video source from Television to Composite1 = no sound, black 
video.
Change Video source from Composite1 to Television again = video OK and 
sound is available (but noisy).

If I exit xawtv now and start it again I do not need to change
the Video source and I can hear the sound.

 Markus
 
 5. Right click on xawtv to show the menu window
 6. Modify Video source from Television to Composite1
 7. Modify Video source back from Composite1 to Television

 now I can hear the sound (altrough it is a robot-like sound, which can be
 understanded but it is not clear). I am using Linux kernel 2.6.27.5.

 Any idea how to fix the sound?

 Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] handle possible NULL pointer at em28xx_aad_unregister()

2008-11-19 Thread Németh Márton
Markus Rechberger wrote:
 2008/11/20 Németh Márton [EMAIL PROTECTED]:
 Hi,

 I can trigger a NULL pointer reference with the em28xx-aad module.

 Steps to reproduce:
 1. Boot computer
 2. modprobe -k em28xx-aad
 3. Plug Pinnacle Hybrid Pro Stick (320e)
 4. rmmod em28xx-aad

 Current result: segmentation fault of rmmod and some error message in dmesg. 
 I
 attached a patch which adds BUG_ON to the critical point at em28xx-aad.c

 
 I know about that one, I had to write that driver quickly and modify
 tvtime to support it since there was a request for it.
 The correct way would be to do it like in the em28xx-audio driver, to
 initialize a waitqueue, and wait till the last user closes
 the aad node.
 Do you want to write a patch for it? (em28xx-audio, em28xx-video
 basically use the same system).

I am afraid the problem is something else here. I checked the value of
aad_users (see the attached modified debug patch). I found that when the
em28xx_aad_unregister() is called, the aad_users is already 0.
What the following log also shows is that the em28xx_aad_register() was
not called at all:

[  483.484524] Linux video capture interface: v2.00
[  483.712568] em28xx v4l2 driver version 0.0.1 loaded
[  483.714391] usbcore: registered new interface driver em28xx
[  483.809697] initializing Empia Audio Driver
[  483.813074] Copyright (C) 2008 Empia Technology Inc
[  483.813568] Copyright (C) 2008 Sundtek Ltd.
[  483.813952] /usr/src/mcentral.de/em28xx-new/em28xx-aad.c:415: 
em28xx_aad_init()
[  488.158068] usb 3-3: new high speed USB device using ehci_hcd and address 3
[  488.287246] usb 3-3: configuration #1 chosen from 1 choice
[  488.289373] em28xx: new video device (eb1a:2881): interface 0, class 255
[  488.289873] em28xx: device is attached to a USB 2.0 bus
[  488.290587] em28xx #0: Alternate settings: 8
[  488.290968] em28xx #0: Alternate setting 0, max size= 0
[  488.291390] em28xx #0: Alternate setting 1, max size= 0
[  488.291762] em28xx #0: Alternate setting 2, max size= 1448
[  488.292174] em28xx #0: Alternate setting 3, max size= 2048
[  488.292549] em28xx #0: Alternate setting 4, max size= 2304
[  488.292920] em28xx #0: Alternate setting 5, max size= 2580
[  488.293352] em28xx #0: Alternate setting 6, max size= 2892
[  488.293726] em28xx #0: Alternate setting 7, max size= 3072
[  488.538531] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0x6, gpio_value=0x0
[  488.774584] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0xF, gpio_value=0x0
[  489.519939] attach_inform: tvp5150 detected.
[  489.566465] tvp5150 1-005c: tvp5150am1 detected.
[  491.673027] successfully attached tuner
[  491.690555] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[  491.711258] em28xx #0: V4L2 device registered as /dev/video0
[  491.715275] input: em2880/em2870 remote control as /class/input/input12
[  491.727701] em28xx-input.c: remote control handler attached
[  491.728333] em28xx #0: Found Pinnacle Hybrid Pro
[  491.729935] audio device (eb1a:2881): interface 1, class 1
[  491.730730] audio device (eb1a:2881): interface 2, class 1
[  492.351815] usbcore: registered new interface driver snd-usb-audio
[  492.573043] em2880-dvb.c: DVB Init
[  492.575202] em28xx #0 at em28xx_gpio_control: 3register disabled: 
command=0x6, gpio_value=0x0
[  492.940138] DVB: registering new adapter (em2880 DVB-T)
[  492.940844] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[  492.951119] Em28xx: Initialized (Em2880 DVB Extension) extension
[  504.831317] releasing Empia Audio Driver
[  504.831897] /usr/src/mcentral.de/em28xx-new/em28xx-aad.c:423: 
em28xx_aad_exit()
[  504.832398] /usr/src/mcentral.de/em28xx-new/em28xx-aad.c:378: aad_users=0
[  504.832827] [ cut here ]
[  504.832837] kernel BUG at /usr/src/mcentral.de/em28xx-new/em28xx-aad.c:379!
[  504.832845] invalid opcode:  [#1] PREEMPT
[  504.832855] Modules linked in: em28xx_dvb drx3973d s921 snd_usb_audio mt2060 
lgdt3304 zl10353 lgdt330x snd_usb_lib dvb_core snd_hwdep qt1010 tuner_xc3028
tvp5150 em28xx_aad(-) em28xx videodev v4l1_compat ppdev lp cpufreq_ondemand 
cpufreq_conservative ipv6 xt_tcpudp iptable_filter ip_tables x_tables
leds_clevo_mail led_class via via_agp drm agpgart eeprom snd_pcm_oss 
snd_mixer_oss cpufreq_userspace cpufreq_powersave powernow_k8 fan usbhid 
snd_via82xx
snd_mpu401_uart pcmcia firmware_class snd_via82xx_modem snd_seq_midi 
snd_ac97_codec k8temp snd_seq_midi_event ac97_bus 8139too snd_rawmidi snd_pcm 
yenta_socket
mii mousedev snd_seq 8250_pnp snd_timer rsrc_nonstatic hwmon snd_seq_device 
ide_cd_mod 8250 i2c_viapro bitrev crc32 video cdrom snd ehci_hcd pcmcia_core 
psmouse
backlight uhci_hcd serio_raw serial_core pcspkr soundcore snd_page_alloc 
i2c_core usbcore parport_pc output battery parport ac thermal button processor 
evdev
[  504.833020]
[  504.833020] Pid: 4608, comm: rmmod Not tainted (2.6.27.5 #2)
[  504.833020] EIP: 0060:[f8cdd0cb] EFLAGS: 00210246 CPU: 0
[  504.833020] EIP

[Em28xx] [PATCH] modify coding style of em28xx-cards.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx-cards.c:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use C99 // comments
 - ERROR: space prohibited before open square bracket '['
 - ERROR: space required after that close brace '}'
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:WxV)
 - ERROR: trailing whitespace
 - WARNING: space prohibited between function name and open parenthesis '('

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r e7dff9bfb5fd em28xx-cards.c
--- a/em28xx-cards.c	Sat Nov 15 12:23:48 2008 +0100
+++ b/em28xx-cards.c	Sun Nov 16 10:32:16 2008 +0100
@@ -119,7 +119,7 @@
 	}, {\
 		.name = SECAM L, /* AV tested ok */			\
 		.id = V4L2_STD_SECAM_L, \
-.tv_mode = XC3028_tv_mode_l_secam_nicam_am_only,   \
+		.tv_mode = XC3028_tv_mode_l_secam_nicam_am_only,	\
 		.channelmap = XC3028_channel_map_france_analog_air, 	\
 		.vbi_sample_rate = 2700, \
 		.vbi_samples_per_line = 1440, \
@@ -861,7 +861,7 @@
 			.vmux = SAA7115_SVIDEO3,
 			.amux = 1,
 			.amix = EM28XX_MIX_LINE_IN,
-		}},
+		} },
 		.tvnorms	= {
 			{
 .name = PAL-BG,
@@ -1549,7 +1549,7 @@
 		.tuner_type   = TUNER_XCEIVE_XC3028,
 		.decoder  = EM28XX_TVP5150,
 		.ir_keytab= ir_codes_em_terratec2,
-		.ir_getkey= em2880_get_key_terratec, 
+		.ir_getkey= em2880_get_key_terratec,
 		.dev_modes= EM28XX_VIDEO | EM28XX_VBI | EM28XX_DVBT | EM28XX_AUDIO,
 		.input  = {{
 			.type = EM28XX_VMUX_TELEVISION,
@@ -2298,9 +2298,9 @@
 			{
 .name = PAL-BG,
 .id = V4L2_STD_PAL_BG,
-			},{
-.name =NTSC,
-.id = V4L2_STD_NTSC_M 
+			}, {
+.name = NTSC,
+.id = V4L2_STD_NTSC_M
 		} },
 	},
 	[EM2860_BOARD_NETGMBH_CAM] = {
@@ -2588,15 +2588,15 @@
 			.type = EM28XX_VMUX_COMPOSITE1,
 			.vmux = SAA7115_COMPOSITE0,
 			.amux = 1,
-		}},
+		} },
 		.tvnorms	= {
 			{
 .name = PAL-BG,
 .id = V4L2_STD_PAL_BG,
-			},{
+			}, {
 .name = NTSC,
 .id = V4L2_STD_NTSC,
-		}},
+		} },
 	},
 	[EM2882_BOARD_LEADTEK_PALMTOP_DTV_200H] = {
 		/* TODO: FM radio support for this Leadtek device */
@@ -2644,8 +2644,10 @@
 		} },
 	},
 };
+EXPORT_SYMBOL(em28xx_boards);
 
 const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
+EXPORT_SYMBOL(em28xx_bcount);
 
 /*
  * seems like it's possible to flash the eeprom, somehow one of my HVR 900 devices suddenly
@@ -2655,7 +2657,7 @@
  */
 
 /* table of devices that work with this driver */
-struct usb_device_id em28xx_id_table [] = {
+struct usb_device_id em28xx_id_table[] = {
 	{ USB_DEVICE(0xeb1a, 0x2800), .driver_info = EM2800_BOARD_GENERIC },
 	{ USB_DEVICE(0xeb1a, 0x2820), .driver_info = EM2820_BOARD_GENERIC },
 	{ USB_DEVICE(0xeb1a, 0x2821), .driver_info = EM2821_BOARD_GENERIC },
@@ -2721,7 +2723,7 @@
 	{ USB_DEVICE(0x0413, 0x6f02), .driver_info = EM2882_BOARD_LEADTEK_PALMTOP_DTV_200H },
 	{ USB_DEVICE(0x185b, 0x2041), .driver_info = EM2820_BOARD_COMPRO_VIDEO_MATE },
 	{ USB_DEVICE(0xeb1a, 0xe359), .driver_info = EM2870_BOARD_KWORLD_355U },
-	
+
 	{ },
 };
 EXPORT_SYMBOL(em28xx_id_table);
@@ -3277,7 +3279,9 @@
 	}
 	case EM2875_BOARD_SAMPLE_ISDBT:
 	{
-		//em28xx_write_regs(dev, R06_I2C_CLK_REG, \x40, 1); // EEPROM access
+#if 0
+		em28xx_write_regs(dev, R06_I2C_CLK_REG, \x40, 1); /* EEPROM access */
+#endif
 		em28xx_write_regs(dev, R06_I2C_CLK_REG, \x44, 1);
 		em28xx_write_regs(dev, 0x0f, \x02, 1);
 		em28xx_write_regs(dev, 0x50, \x0e, 1);
@@ -3304,7 +3308,4 @@
 		em2880_ir_detach(dev);
 }
 
-EXPORT_SYMBOL(em28xx_boards);
-EXPORT_SYMBOL(em28xx_bcount);
-
-MODULE_DEVICE_TABLE (usb, em28xx_id_table);
+MODULE_DEVICE_TABLE(usb, em28xx_id_table);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] modify coding style of em28xx-audio.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx-audio.c:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use assignment in if condition
 - ERROR: space prohibited before that close parenthesis ')'
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: space required after that ';' (ctx:VxV)
 - ERROR: space required before the open brace '{'
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces prohibited around that '-' (ctx:WxV)
 - ERROR: spaces required around that '' (ctx:VxV)
 - ERROR: spaces required around that '==' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: spaces required around that '!=' (ctx:VxV)
 - ERROR: spaces required around that '+=' (ctx:WxV)
 - ERROR: switch and case should be at the same indent
 - ERROR: trailing whitespace
 - WARNING: braces {} are not necessary for single statement blocks
 - WARNING: printk() should include KERN_ facility level

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r e7dff9bfb5fd em28xx-audio.c
--- a/em28xx-audio.c	Sat Nov 15 12:23:48 2008 +0100
+++ b/em28xx-audio.c	Sun Nov 16 11:51:55 2008 +0100
@@ -47,41 +47,41 @@
 #include xc5000/xc5000_control.h
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
-static int em28xx_cmd(struct em28xx *dev, int cmd,int arg);
+static int em28xx_cmd(struct em28xx *dev, int cmd, int arg);
 
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
 #else
 static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
 #endif
 {
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 	snd_pcm_runtime_t *runtime = subs-runtime;
 #else
 	struct snd_pcm_runtime *runtime = subs-runtime;
 #endif
-	if(runtime-dma_area){
-		if(runtime-dma_bytes  size)
+	if (runtime-dma_area) {
+		if (runtime-dma_bytes  size)
 			return 0;
 		vfree(runtime-dma_area);
 	}
 	runtime-dma_area = vmalloc(size);
-	if(!runtime -dma_area)
+	if (!runtime-dma_area)
 		return -ENOMEM;
 	runtime-dma_bytes = size;
 	return 0;
 }
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static snd_pcm_hardware_t snd_em28xx_hw_capture = {
 #else
 static struct snd_pcm_hardware snd_em28xx_hw_capture = {
 #endif
-	.info = SNDRV_PCM_INFO_BLOCK_TRANSFER | 
-		SNDRV_PCM_INFO_MMAP | 
+	.info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		SNDRV_PCM_INFO_MMAP |
 		SNDRV_PCM_INFO_BATCH |
-		SNDRV_PCM_INFO_INTERLEAVED  | 
+		SNDRV_PCM_INFO_INTERLEAVED  |
 		SNDRV_PCM_INFO_MMAP_VALID,
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	.rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
@@ -89,14 +89,14 @@
 	.rate_max = 48000,
 	.channels_min = 2,
 	.channels_max = 2,
-	.buffer_bytes_max = 1024*1024, 
-	.period_bytes_min = 64, 
+	.buffer_bytes_max = 1024*1024,
+	.period_bytes_min = 64,
 	.period_bytes_max = 512*1024,
 	.periods_min = 2,
 	.periods_max = 1024,
 };
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static int snd_em28xx_capture_open(snd_pcm_substream_t *substream)
 #else
 static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
@@ -106,30 +106,30 @@
 	int mode;
 	int arg;
 	struct em28xx *dev = snd_pcm_substream_chip(substream);
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 	snd_pcm_runtime_t *runtime = substream-runtime;
 #else
 	struct snd_pcm_runtime *runtime = substream-runtime;
 #endif
-	printk(opening radio device and trying to acquire exclusive lock\n);
-switch(dev-mode){
+	printk(KERN_INFO opening radio device and trying to acquire exclusive lock\n);
+	switch (dev-mode) {
 	case V4L2_TUNER_DIGITAL_TV:
 		/* digital has no support for analog audio */
-		ret = dev-em28xx_acquire(dev, EM28XX_RADIO, 1); 
-		if (ret != 0 ) {
-			printk(device is already in use by DVB-T\n);
+		ret = dev-em28xx_acquire(dev, EM28XX_RADIO, 1);
+		if (ret != 0) {
+			printk(KERN_ERR device is already in use by DVB-T\n);
 			return -EINVAL;
 		} else {
 			struct v4l2_tuner tuner;
 			struct v4l2_routing arouting;
-			printk(switching device to FM mode\n);
+			printk(KERN_INFO switching device to FM mode\n);
 
 			mode = V4L2_TUNER_RADIO;
 			memset(tuner, 0x0, sizeof(struct v4l2_tuner));
 			tuner.type = V4L2_TUNER_RADIO;
 
 			dev-mode = mode;
-		
+
 			arg = EM28XX_REG_ON;
 			dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON, arg);
 			dev-em28xx_gpio_control(dev, EM28XX_LED1_ON, arg);
@@ -139,7 +139,7 @@
 			mdelay(100);
 
 			/* upload firmware */
-			switch(dev-tuner_type) {
+			switch (dev-tuner_type) {
 			case TUNER_XCEIVE_XC3028:
 {
 	struct xc3028_init_cmd cmd;
@@ -150,14 +150,14 @@
 	if (dev-tuner)
 		

[Em28xx] [PATCH] modify coding style of em2880-dvb.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em2880-dvb.c:
 - ERROR: do not use C99 // comments
 - ERROR: Macros with complex values should be enclosed in parenthesis
 - ERROR: space required after that ',' (ctx:ExV)
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: space required after that ';' (ctx:VxV)
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces required around that '' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: switch and case should be at the same indent
 - ERROR: trailing statements should be on next line
 - ERROR: trailing whitespace
 - WARNING: braces {} are not necessary for any arm of this statement
 - WARNING: printk() should include KERN_ facility level

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.

diff -r e7dff9bfb5fd em2880-dvb.c
--- a/em2880-dvb.c	Sat Nov 15 12:23:48 2008 +0100
+++ b/em2880-dvb.c	Sun Nov 16 11:05:26 2008 +0100
@@ -159,7 +159,7 @@
  * \brief Default I2C address and device identifier.
  */
 I2CDeviceAddr_t DRX3973DDefaultAddr_g = {
-#define DRX3973D_DEF_I2C_ADDR (0xe0)1
+#define DRX3973D_DEF_I2C_ADDR ((0xe0)1)
 	DRX3973D_DEF_I2C_ADDR, /* i2c address */
 #define DRX3973D_DEF_DEMOD_DEV_ID   (1)
 	DRX3973D_DEF_DEMOD_DEV_ID,  /* device id */
@@ -211,7 +211,8 @@
 MODULE_PARM_DESC(debug, em2880-dvb debug level (default off));
 
 #define dprintk(lvl, fmt, args...) if (debug = lvl) do {\
-	printk(fmt, ##args); } while (0)
+		printk(fmt, ##args); \
+	} while (0)
 
 
 static int em2880_set_alternate(struct em2880_dvb *dvb_dev);
@@ -240,9 +241,9 @@
 	}
 
 	switch (urb-status) {
-		case -ESHUTDOWN:
-			return;
-			break;
+	case -ESHUTDOWN:
+		return;
+		break;
 	}
 
 	if (urb-status == -ENOENT)
@@ -284,7 +285,7 @@
 		dvb_dev-urb[i] = NULL;
 		dvb_dev-transfer_buffer[i] = NULL;
 	}
-	arg=EM28XX_REG_OFF;
+	arg = EM28XX_REG_OFF;
 	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
 
 }
@@ -296,7 +297,7 @@
 	const int sb_size = EM2880_DVB_NUM_PACKETS * dvb_dev-dtv_packetsize;
 
 	dprintk(1, em2880-dvb.c: got start stream request %s\n, __func__);
-	arg=EM28XX_REG_ON;
+	arg = EM28XX_REG_ON;
 	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
 
 	em2880_set_alternate(dvb_dev);
@@ -430,36 +431,36 @@
 static int mt352_pinnacle_init(struct dvb_frontend *fe)
 {
 	int i;
-	struct bcode zlconf[]={
-			{0x1e,\x8a\x2c,2,0},
-			{0x1e,\x89\x38,2,0},
-			{0x1e,\x50\x80,2,0},
-			{0x1e,\x8e\x40,2,0},
-			{0x1e,\x69\x00,2,0},
-			{0x1e,\x6a\xff,2,0},
-			{0x1e,\x6b\xff,2,0},
-			{0x1e,\x6c\x00,2,0},
-			{0x1e,\x6d\xff,2,0},
-			{0x1e,\x6e\x00,2,0},
-			{0x1e,\x6f\x40,2,0},
-			{0x1e,\x70\x40,2,0},
-			{0x1e,\x68\xa0,2,0},
+	struct bcode zlconf[] = {
+			{0x1e, \x8a\x2c, 2, 0},
+			{0x1e, \x89\x38, 2, 0},
+			{0x1e, \x50\x80, 2, 0},
+			{0x1e, \x8e\x40, 2, 0},
+			{0x1e, \x69\x00, 2, 0},
+			{0x1e, \x6a\xff, 2, 0},
+			{0x1e, \x6b\xff, 2, 0},
+			{0x1e, \x6c\x00, 2, 0},
+			{0x1e, \x6d\xff, 2, 0},
+			{0x1e, \x6e\x00, 2, 0},
+			{0x1e, \x6f\x40, 2, 0},
+			{0x1e, \x70\x40, 2, 0},
+			{0x1e, \x68\xa0, 2, 0},
 
-			{0x1e,\x56\x31,2,0}, // set input frequency
-			{0x1e,\x57\xb8,2,0},
-			{0x1e,\x75\x33,2,0},
+			{0x1e, \x56\x31, 2, 0},  /* set input frequency */
+			{0x1e, \x57\xb8, 2, 0},
+			{0x1e, \x75\x33, 2, 0},
 
-			{0x1e,\x7c\x00,2,0},
-			{0x1e,\x7d\x4d,2,0},
-			{0x1e,\xb5\x7a,2,0},
-			{0x1e,\x51\x40,2,0},
-			{0x1e,\x52\x80,2,0},
-			{0x1e,\x53\x50,2,0},
-			{0x1e,\x5d\x01,2,0},
+			{0x1e, \x7c\x00, 2, 0},
+			{0x1e, \x7d\x4d, 2, 0},
+			{0x1e, \xb5\x7a, 2, 0},
+			{0x1e, \x51\x40, 2, 0},
+			{0x1e, \x52\x80, 2, 0},
+			{0x1e, \x53\x50, 2, 0},
+			{0x1e, \x5d\x01, 2, 0},
 			{}
 	};
-	for(i=0;zlconf[i].txt;i++)
-		fe-ops.write(fe, zlconf[i].txt,zlconf[i].len);
+	for (i = 0; zlconf[i].txt; i++)
+		fe-ops.write(fe, zlconf[i].txt, zlconf[i].len);
 	return 0;
 }
 
@@ -467,7 +468,9 @@
 static struct mt352_config em2880_mt352_dev = {
 	.demod_address = (0x1e  1),
 	.no_tuner = 1,
-	//.parallel_ts = 1,
+#if 0
+	.parallel_ts = 1,
+#endif
 	.if2 = 45600,
 	.demod_init = mt352_pinnacle_init,
 };
@@ -693,7 +696,7 @@
 			cmd.new_tv_mode_ptr = dev-atscnorm-tv_mode;
 			cmd.new_channel_map_ptr = dev-atscnorm-channelmap;
 		}
-			
+
 		if (dev-tuner  dev-tuner-tuner_cmd)
 			dev-tuner-tuner_cmd(dev-tuner, XC3028_INIT_TUNER, cmd);
 		break;
@@ -701,11 +704,10 @@
 	case TUNER_XCEIVE_XC5000:
 	{
 		struct xc_std_conf cmd;
-		if (dev-dev_modes  EM28XX_DVBT) {
+		if (dev-dev_modes  EM28XX_DVBT)
 			cmd.index = dev-dvbnorm-index;
-		} else if (dev-dev_modes  EM28XX_ATSC) {
+		else if (dev-dev_modes  EM28XX_ATSC)
 			cmd.index = dev-atscnorm-index;
-		}
 
 		printk(KERN_INFOinitializing: %d\n, dev-dvbnorm-index);
 		dev-tuner-tuner_cmd(dev-tuner, XC5000_INIT_TUNER, NULL);
@@ -742,7 +744,9 @@
 
 	int gpio_arg;
 
-//	if (dev-mode != V4L2_TUNER_DIGITAL_TV) {
+#if 0
+	if (dev-mode != 

[Em28xx] [PATCH] modify coding style of em28xx-aad.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx-aad.c:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use C99 // comments
 - ERROR: need consistent spacing around '-' (ctx:WxV)
 - ERROR: open brace '{' following function declarations go on the next line
 - ERROR: return is not a function, parentheses are not required
 - ERROR: space prohibited after that '~' (ctx:WxW)
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: space required after that ';' (ctx:VxV)
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces required around that '' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: trailing whitespace
 - WARNING: externs should be avoided in .c files
 - WARNING: Use #include linux/uaccess.h instead of asm/uaccess.h

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r e7dff9bfb5fd em28xx-aad.c
--- a/em28xx-aad.c	Sat Nov 15 12:23:48 2008 +0100
+++ b/em28xx-aad.c	Sun Nov 16 12:32:59 2008 +0100
@@ -1,4 +1,4 @@
-/* 
+/*
  * Em28xx-aad Empia Alternative Audio Driver
  *
  * This is a vendor specific driver which provides a vendor specific
@@ -27,7 +27,7 @@
 #include linux/errno.h
 #include linux/sched.h
 #include linux/fcntl.h
-#include asm/uaccess.h
+#include linux/uaccess.h
 
 #include em28xx-aad.h
 #include em28xx.h
@@ -35,7 +35,7 @@
 static unsigned long em28xx_aad_devices; /* map */
 static int em28xx_aad_register(struct em28xx *dev);
 
-void em28xx_aad_unregister(struct em28xx_aad_info **int_aad);
+static void em28xx_aad_unregister(struct em28xx_aad_info **int_aad);
 
 static int em28xx_maxdevs;
 
@@ -46,63 +46,68 @@
 #define AAD_BUFFER_SIZE 2
 
 static struct aad_rb_info *aad_rb_init(void);
-static struct aad_rb_info *aad_rb_init(void) {
+static struct aad_rb_info *aad_rb_init(void)
+{
 	struct aad_rb_info *rb = kzalloc(sizeof(struct aad_rb_info), GFP_KERNEL);
-rb-left = rb-right = rb-pos = 0;
+	rb-left = rb-right = rb-pos = 0;
 	rb-bufsize = AAD_BUFFER_SIZE;
-rb-buffer = kzalloc(AAD_BUFFER_SIZE*sizeof(u8), GFP_KERNEL);
-if (rb-buffer == NULL)
-return 0;
+	rb-buffer = kzalloc(AAD_BUFFER_SIZE*sizeof(u8), GFP_KERNEL);
+	if (rb-buffer == NULL)
+		return 0;
 	spin_lock_init(rb-__aad_lock);
 	return rb;
 };
 
-void aad_rb_free(struct aad_rb_info **rb) {
+void aad_rb_free(struct aad_rb_info **rb)
+{
 	kfree((*rb)-buffer);
 	kfree((*rb));
 }
 
-static inline u32 aad_rb_get_buffer_size(struct aad_rb_info *rb) {
+static inline u32 aad_rb_get_buffer_size(struct aad_rb_info *rb)
+{
 	if (rb-left  rb-right)
-		return (rb-bufsize - rb-left + rb-right);
-	else if(rb-left  rb-right)
-		return (rb-right - rb-left);
-	else if(rb-left == rb-right)
+		return rb-bufsize - rb-left + rb-right;
+	else if (rb-left  rb-right)
+		return rb-right - rb-left;
+	else if (rb-left == rb-right)
 		return 0;
 	return 0;
 }
 
-static void aad_rb_reset_buffer(struct aad_rb_info *rb) {
-unsigned long flags;
-spin_lock_irqsave(rb-__aad_lock, flags);
-rb-left = rb-right = rb-pos = 0;
-spin_unlock_irqrestore(rb-__aad_lock, flags);
+static void aad_rb_reset_buffer(struct aad_rb_info *rb)
+{
+	unsigned long flags;
+	spin_lock_irqsave(rb-__aad_lock, flags);
+	rb-left = rb-right = rb-pos = 0;
+	spin_unlock_irqrestore(rb-__aad_lock, flags);
 }
 
-static inline u32 aad_rb_free_buffer_size(struct aad_rb_info *rb) {
+static inline u32 aad_rb_free_buffer_size(struct aad_rb_info *rb)
+{
 	u32 cur_buffsize = aad_rb_get_buffer_size(rb);
 	if (rb-bufsize - cur_buffsize  0)
 		return rb-bufsize - cur_buffsize - 1;
 	return rb-bufsize - 1;
 }
 
-static int aad_rb_write_data(struct aad_rb_info *rb, u8 *data, ssize_t size) {
+static int aad_rb_write_data(struct aad_rb_info *rb, u8 *data, ssize_t size)
+{
 	int len = size;
-	//int len2;
 	int free;
 	unsigned long flags;
 	/* lock */
-spin_lock_irqsave(rb-__aad_lock, flags);
+	spin_lock_irqsave(rb-__aad_lock, flags);
 	free = aad_rb_free_buffer_size(rb);
 
 	if (size  free)
 		size = free - free % sizeof(u32); /* alignment */
 
 	if (free == 0) {
-if(printk_ratelimit()) 
-printk(dropping data!\n);
+		if (printk_ratelimit())
+			printk(KERN_ERR dropping data!\n);
 		/* unlock */
-spin_unlock_irqrestore(rb-__aad_lock, flags);
+		spin_unlock_irqrestore(rb-__aad_lock, flags);
 		return 0;
 	}
 	if (rb-right + size = rb-bufsize - 1) {
@@ -115,7 +120,7 @@
 		rb-right += size;
 	}
 	/* unlock */
-spin_unlock_irqrestore(rb-__aad_lock, flags);
+	spin_unlock_irqrestore(rb-__aad_lock, flags);
 	return 0;
 }
 
@@ -123,19 +128,19 @@
  * spinlocked block, it might work fine with most systems although the target
  * systems just blew up */
 
-static int aad_rb_read_data(struct em28xx_aad_info *aad, u8 *buffer, ssize_t size) {
+static int aad_rb_read_data(struct em28xx_aad_info *aad, u8 *buffer, ssize_t size)
+{

[Em28xx] [PATCH] modify coding style of em28xx-audioep.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx-audioep.c:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use assignment in if condition
 - ERROR: do not use C99 // comments
 - ERROR: space prohibited before that close parenthesis ')'
 - ERROR: space required after that ',' (ctx:OxV)
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: space required after that ';' (ctx:VxV)
 - ERROR: space required before the open brace '{'
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces prohibited around that '-' (ctx:WxV)
 - ERROR: spaces required around that '' (ctx:VxV)
 - ERROR: spaces required around that '==' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: spaces required around that '+=' (ctx:VxV)
 - ERROR: spaces required around that '+=' (ctx:WxV)
 - ERROR: switch and case should be at the same indent
 - ERROR: trailing whitespace
 - WARNING: braces {} are not necessary for single statement blocks
 - WARNING: printk() should include KERN_ facility level

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.

diff -r e7dff9bfb5fd em28xx-audioep.c
--- a/em28xx-audioep.c	Sat Nov 15 12:23:48 2008 +0100
+++ b/em28xx-audioep.c	Sun Nov 16 13:04:37 2008 +0100
@@ -26,31 +26,31 @@
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
 
 MODULE_AUTHOR(Markus Rechberger [EMAIL PROTECTED]);
-MODULE_LICENSE(GPL); // my appropriate code is dual licensed also BSD
+MODULE_LICENSE(GPL); /* my appropriate code is dual licensed also BSD */
 
 static struct usb_driver em28xx_audio_drv;
-static int em28xx_cmd(struct em28xx_audio *adev, int cmd,int arg);
+static int em28xx_cmd(struct em28xx_audio *adev, int cmd, int arg);
 
-static struct usb_device_id em28xx_audio_id_table[]={
-{ USB_DEVICE(0x0ccd, 0x0042) }, /* just for testing it will not attach to the real device */
+static struct usb_device_id em28xx_audio_id_table[] = {
+	{ USB_DEVICE(0x0ccd, 0x0042) }, /* just for testing it will not attach to the real device */
 	{ USB_DEVICE(0xeb1a, 0xe300) },
 	{ USB_DEVICE(0xeb1a, 0xe301) },
 	{ USB_DEVICE(0xeb1a, 0xe305) },
 	{ USB_DEVICE(0xeb1a, 0xe310) },
 	{ USB_DEVICE(0xeb1a, 0xe320) },
 	{ USB_DEVICE(0xeb1a, 0x2861) },
-{ },
+	{ },
 };
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static snd_pcm_hardware_t snd_em28xx_hw_capture = {
 #else
 static struct snd_pcm_hardware snd_em28xx_hw_capture = {
 #endif
-	.info = SNDRV_PCM_INFO_BLOCK_TRANSFER | 
-		SNDRV_PCM_INFO_MMAP | 
+	.info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
+		SNDRV_PCM_INFO_MMAP |
 		SNDRV_PCM_INFO_BATCH |
-		SNDRV_PCM_INFO_INTERLEAVED  | 
+		SNDRV_PCM_INFO_INTERLEAVED |
 		SNDRV_PCM_INFO_MMAP_VALID,
 	.formats = SNDRV_PCM_FMTBIT_S16_LE,
 	.rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
@@ -58,341 +58,343 @@
 	.rate_max = 48000,
 	.channels_min = 2,
 	.channels_max = 2,
-	.buffer_bytes_max = 1024*1024, 
-	.period_bytes_min = 64, 
+	.buffer_bytes_max = 1024*1024,
+	.period_bytes_min = 64,
 	.period_bytes_max = 512*1024,
 	.periods_min = 2,
 	.periods_max = 1024,
 };
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
 #else
 static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
 #endif
 {
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
-snd_pcm_runtime_t *runtime = subs-runtime;
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
+	snd_pcm_runtime_t *runtime = subs-runtime;
 #else
-struct snd_pcm_runtime *runtime = subs-runtime;
+	struct snd_pcm_runtime *runtime = subs-runtime;
 #endif
-if(runtime-dma_area){
-if(runtime-dma_bytes  size)
-return 0;
-vfree(runtime-dma_area);
-}
-runtime-dma_area = vmalloc(size);
-if(!runtime -dma_area)
-return -ENOMEM;
-runtime-dma_bytes = size;
-return 0;
+	if (runtime-dma_area) {
+		if (runtime-dma_bytes  size)
+			return 0;
+		vfree(runtime-dma_area);
+	}
+	runtime-dma_area = vmalloc(size);
+	if (!runtime-dma_area)
+		return -ENOMEM;
+	runtime-dma_bytes = size;
+	return 0;
 }
 
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,16)
+#if LINUX_VERSION_CODE = KERNEL_VERSION(2, 6, 16)
 static int snd_em28xx_hw_capture_params(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *hw_params)
 #else
 static int snd_em28xx_hw_capture_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params)
 #endif
 {
-unsigned int channels, rate, format;
-struct em28xx_audio *adev = snd_pcm_substream_chip(substream);
-int ret;
-ret = snd_pcm_alloc_vmalloc_buffer(substream, params_buffer_bytes(hw_params));
-adev-hwptr_done_capture = 0;
+	unsigned int channels, rate, 

[Em28xx] [PATCH] modify coding style of em28xx-keymaps.{c, h} to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx-keymaps.{c,h}:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use C99 // comments
 - ERROR: space prohibited after that open square bracket '['
 - ERROR: space prohibited before that close square bracket ']'
 - ERROR: trailing whitespace
 - WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r 36126ed0bf84 em28xx-keymaps.c
--- a/em28xx-keymaps.c	Sun Nov 16 16:30:51 2008 +0100
+++ b/em28xx-keymaps.c	Sun Nov 16 21:37:08 2008 +0100
@@ -1,350 +1,346 @@
 #include em28xx-keymaps.h
 
 IR_KEYTAB_TYPE ir_codes_em_terratec_u[IR_KEYTAB_SIZE] = {
-[ 0x01 ] = KEY_CHANNEL,
-[ 0x02 ] = KEY_SELECT,
-[ 0x03 ] = KEY_MUTE,
-[ 0x04 ] = KEY_POWER,
-[ 0x05 ] = KEY_1,
-[ 0x06 ] = KEY_2,
-[ 0x07 ] = KEY_3,
-[ 0x08 ] = KEY_CHANNELUP,
-[ 0x09 ] = KEY_4,
-[ 0x0a ] = KEY_5,
-[ 0x0b ] = KEY_6,
-[ 0x0c ] = KEY_CHANNELDOWN,
-[ 0x0d ] = KEY_7,
-[ 0x0e ] = KEY_8,
-[ 0x0f ] = KEY_9,
-[ 0x10 ] = KEY_VOLUMEUP,
-[ 0x11 ] = KEY_0,
-[ 0x12 ] = KEY_MENU,
-[ 0x13 ] = KEY_PRINT,
-[ 0x14 ] = KEY_VOLUMEDOWN,
-[ 0x16 ] = KEY_PAUSE,
-[ 0x18 ] = KEY_RECORD,
-[ 0x19 ] = KEY_REWIND,
-[ 0x1a ] = KEY_PLAY,
-[ 0x1b ] = KEY_FORWARD,
-[ 0x1c ] = KEY_BACKSPACE,
-[ 0x1e ] = KEY_STOP,
-[ 0x40 ] = KEY_ZOOM,
+	[0x01] = KEY_CHANNEL,
+	[0x02] = KEY_SELECT,
+	[0x03] = KEY_MUTE,
+	[0x04] = KEY_POWER,
+	[0x05] = KEY_1,
+	[0x06] = KEY_2,
+	[0x07] = KEY_3,
+	[0x08] = KEY_CHANNELUP,
+	[0x09] = KEY_4,
+	[0x0a] = KEY_5,
+	[0x0b] = KEY_6,
+	[0x0c] = KEY_CHANNELDOWN,
+	[0x0d] = KEY_7,
+	[0x0e] = KEY_8,
+	[0x0f] = KEY_9,
+	[0x10] = KEY_VOLUMEUP,
+	[0x11] = KEY_0,
+	[0x12] = KEY_MENU,
+	[0x13] = KEY_PRINT,
+	[0x14] = KEY_VOLUMEDOWN,
+	[0x16] = KEY_PAUSE,
+	[0x18] = KEY_RECORD,
+	[0x19] = KEY_REWIND,
+	[0x1a] = KEY_PLAY,
+	[0x1b] = KEY_FORWARD,
+	[0x1c] = KEY_BACKSPACE,
+	[0x1e] = KEY_STOP,
+	[0x40] = KEY_ZOOM,
 };
-
 EXPORT_SYMBOL_GPL(ir_codes_em_terratec_u);
 
 IR_KEYTAB_TYPE ir_codes_hauppauge_new_u[IR_KEYTAB_SIZE] = {
-/* Keys 0 to 9 */
-[ 0x00 ] = KEY_0,
-[ 0x01 ] = KEY_1,
-[ 0x02 ] = KEY_2,
-[ 0x03 ] = KEY_3,
-[ 0x04 ] = KEY_4,
-[ 0x05 ] = KEY_5,
-[ 0x06 ] = KEY_6,
-[ 0x07 ] = KEY_7,
-[ 0x08 ] = KEY_8,
-[ 0x09 ] = KEY_9,
+	/* Keys 0 to 9 */
+	[0x00] = KEY_0,
+	[0x01] = KEY_1,
+	[0x02] = KEY_2,
+	[0x03] = KEY_3,
+	[0x04] = KEY_4,
+	[0x05] = KEY_5,
+	[0x06] = KEY_6,
+	[0x07] = KEY_7,
+	[0x08] = KEY_8,
+	[0x09] = KEY_9,
 
-[ 0x0a ] = KEY_TEXT,/* keypad asterisk as well */
-[ 0x0b ] = KEY_RED, /* red button */
-[ 0x0c ] = KEY_RADIO,
-[ 0x0d ] = KEY_MENU,
-[ 0x0e ] = KEY_SUBTITLE,/* also the # key */
-[ 0x0f ] = KEY_MUTE,
-[ 0x10 ] = KEY_VOLUMEUP,
-[ 0x11 ] = KEY_VOLUMEDOWN,
-[ 0x12 ] = KEY_PREVIOUS,/* previous channel */
-[ 0x14 ] = KEY_UP,
-[ 0x15 ] = KEY_DOWN,
-[ 0x16 ] = KEY_LEFT,
-[ 0x17 ] = KEY_RIGHT,
-[ 0x18 ] = KEY_VIDEO,   /* Videos */
-[ 0x19 ] = KEY_AUDIO,   /* Music */
-/* 0x1a: Pictures - presume this means
-   Multimedia Home Platform -
-   no PICTURES key in input.h
- */
-[ 0x1a ] = KEY_MHP,
+	[0x0a] = KEY_TEXT,/* keypad asterisk as well */
+	[0x0b] = KEY_RED, /* red button */
+	[0x0c] = KEY_RADIO,
+	[0x0d] = KEY_MENU,
+	[0x0e] = KEY_SUBTITLE,/* also the # key */
+	[0x0f] = KEY_MUTE,
+	[0x10] = KEY_VOLUMEUP,
+	[0x11] = KEY_VOLUMEDOWN,
+	[0x12] = KEY_PREVIOUS,/* previous channel */
+	[0x14] = KEY_UP,
+	[0x15] = KEY_DOWN,
+	[0x16] = KEY_LEFT,
+	[0x17] = KEY_RIGHT,
+	[0x18] = KEY_VIDEO,   /* Videos */
+	[0x19] = KEY_AUDIO,   /* Music */
+	/* 0x1a: Pictures - presume this means
+	   Multimedia Home Platform -
+	   no PICTURES key in input.h
+	 */
+	[0x1a] = KEY_MHP,
 
-[ 0x1b ] = KEY_EPG, /* Guide */
-[ 0x1c ] = KEY_TV,
-[ 0x1e ] = KEY_NEXTSONG,/* skip | */
-[ 0x1f ] = KEY_EXIT,/* back/exit */
-[ 0x20 ] = KEY_CHANNELUP,   /* channel / program + */
-[ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */
-[ 0x22 ] = KEY_CHANNEL, /* source (old black remote) */
-[ 0x24 ] = KEY_PREVIOUSSONG,/* replay | */
-[ 0x25 ] = KEY_ENTER,   /* OK */
-[ 0x26 ] = KEY_SLEEP,   /* minimize (old black remote) */
-[ 0x29 ] = KEY_BLUE,/* blue key */
-[ 0x2e ] = KEY_GREEN,   /* green 

[Em28xx] [PATCH] modify coding style of em28xx.h to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for em28xx.h:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use assignment in if condition
 - ERROR: Don't use linux/videodev.h: see 
Documentation/feature-removal-schedule.txt
 - ERROR: foo* bar should be foo *bar
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: spaces required around that ':' (ctx:VxV)
 - ERROR: spaces required around that '?' (ctx:VxV)
 - ERROR: switch and case should be at the same indent
 - ERROR: trailing statements should be on next line
 - ERROR: trailing whitespace

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r 36126ed0bf84 em28xx.h
--- a/em28xx.h	Sun Nov 16 16:30:51 2008 +0100
+++ b/em28xx.h	Sun Nov 16 22:11:02 2008 +0100
@@ -26,7 +26,6 @@
 #define _EM28XX_H
 
 #include linux/version.h
-#include linux/videodev.h
 #include linux/i2c.h
 #include linux/dvb/frontend.h
 #include dmxdev.h
@@ -283,15 +282,15 @@
 /* To be discussed */
 
 #ifndef V4L2_PIX_FMT_YUV211
-#define V4L2_PIX_FMT_YUV211	v4l2_fourcc('Y','2','1','1')
+#define V4L2_PIX_FMT_YUV211	v4l2_fourcc('Y', '2', '1', '1')
 #endif
 
 #ifndef V4L2_PIX_FMT_YUY1
-#define V4L2_PIX_FMT_YUY1	v4l2_fourcc('Y','U','Y','1')
+#define V4L2_PIX_FMT_YUY1	v4l2_fourcc('Y', 'U', 'Y', '1')
 #endif
 
 #ifndef V4L2_PIX_FMT_Y21P
-#define V4L2_PIX_FMT_Y21P	v4l2_fourcc('Y','2','1','P')
+#define V4L2_PIX_FMT_Y21P	v4l2_fourcc('Y', '2', '1', 'P')
 #endif
 
 struct em28xx_output_fmt {
@@ -425,7 +424,8 @@
 #define EM28XX_GPIO7   0x7
 
 /* helpers */
-#define _BIT_VAL(reg, val, reset) (reg  | 0x80 | (reset?16:0) | (val5))
+#define _BIT_VAL(reg, val, reset) \
+	((reg)  | 0x80 | ((reset) ? 16 : 0) | ((val)5))
 
 /* internal gpio controls */
 #define EM28XX_TS1_ON 1
@@ -448,7 +448,7 @@
 #define EM28XX_I2C_BUS18
 
 /* internal gpio control arguments */
-#define EM28XX_REG_ON   1 
+#define EM28XX_REG_ON   1
 #define EM28XX_REG_OFF  2
 
 struct em28xx_gpio {
@@ -570,7 +570,7 @@
 	int (*demod_init)(struct dvb_frontend *fe);
 	int bw_index; /* bandwidth index */
 	int (*init_override)(struct dvb_frontend *fe);
-	u16 dtv_packetsize; 
+	u16 dtv_packetsize;
 };
 
 struct em28xx_audio {
@@ -610,7 +610,7 @@
 	u8  old;
 	u8  sequence[4];
 	IR_KEYTAB_TYPE		*keymap;
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,20)
+#if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 20)
 	struct work_struct work;
 #else
 	struct delayed_work work;
@@ -822,9 +822,9 @@
 	int (*em28xx_qctrl)(struct v4l2_queryctrl *qctrl);
 
 	int (*em28xx_gpio_control)(void *priv, unsigned int command, void *ptr);
-int (*em28xx_aad_control)(void *priv, unsigned int command, void *ptr);
+	int (*em28xx_aad_control)(void *priv, unsigned int command, void *ptr);
 
-struct em28xx_aad_info *aad;
+	struct em28xx_aad_info *aad;
 
 };
 
@@ -890,7 +890,7 @@
 
 
 /* Provided by em28xx-cards.c */
-extern int em2800_variant_detect(struct usb_device* udev, int model);
+extern int em2800_variant_detect(struct usb_device *udev, int model);
 extern int em28xx_card_setup(struct em28xx *dev);
 extern void em28xx_card_disconnect(struct em28xx *dev);
 extern struct em28xx_board em28xx_boards[];
@@ -996,18 +996,20 @@
 /* printk macros */
 
 #define em28xx_err(fmt, arg...) do {\
-	printk(KERN_ERR fmt , ##arg); } while (0)
+		printk(KERN_ERR fmt, ##arg); \
+	} while (0)
 
 #define em28xx_errdev(fmt, arg...) do {\
-	printk(KERN_ERR %s: fmt,\
-			dev-name , ##arg); } while (0)
+		printk(KERN_ERR %s: fmt, dev-name, ##arg); \
+	} while (0)
 
 #define em28xx_info(fmt, arg...) do {\
-	printk(KERN_INFO %s: fmt,\
-			dev-name , ##arg); } while (0)
+		printk(KERN_INFO %s: fmt, dev-name, ##arg); \
+	} while (0)
+
 #define em28xx_warn(fmt, arg...) do {\
-	printk(KERN_WARNING %s: fmt,\
-			dev-name , ##arg); } while (0)
+		printk(KERN_WARNING %s: fmt, dev-name, ##arg); \
+	} while (0)
 
 void em28xx_config_i2c(struct em28xx *dev);
 int em28xx_config(struct em28xx *dev);
@@ -1052,12 +1054,15 @@
 
 	if (chan == EM28XX_MIX_NOTOUCH)
 		return ret;
-	if ((ret = em28xx_write_ac97(dev, R10_LINE_IN_AC97,
-	chan == EM28XX_MIX_LINE_IN ?
-	\x08\x08 : \x08\x88)))
+
+	ret = em28xx_write_ac97(dev, R10_LINE_IN_AC97,
+chan == EM28XX_MIX_LINE_IN ?
+\x08\x08 : \x08\x88);
+	if (ret)
 		return ret;
-	if ((ret = em28xx_write_ac97(dev, R14_VIDEO_AC97, chan == EM28XX_MIX_VIDEO ?
-	\x08\x08:\x08\x88)))
+	ret = em28xx_write_ac97(dev, R14_VIDEO_AC97, chan == EM28XX_MIX_VIDEO ?
+	\x08\x08 : \x08\x88);
+	if (ret)
 		return ret;
 	return ret;
 }
@@ -1139,14 +1144,16 @@
 static inline unsigned int norm_maxw(struct em28xx *dev)
 {
 	switch (dev-model) {
-		default: return 720;
+	default:
+		return 720;
 	}
 }
 
 static inline unsigned int norm_maxh(struct em28xx *dev)
 {
 	switch (dev-model) {
-		default: return (dev-tvnorm-id  V4L2_STD_625_50) ? 576 : 480;
+	default:
+		return (dev-tvnorm-id  V4L2_STD_625_50) ? 576 : 480;
 	}

[Em28xx] [PATCH] modify coding style of xc3028/xc3028_module.{c, h} to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for xc3028/xc3028_module.{c,h}:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use C99 // comments
 - ERROR: DOS line endings
 - ERROR: foo* bar should be foo *bar
 - ERROR: trailing whitespace
 - WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.

diff -r 36126ed0bf84 xc3028/xc3028_module.c
--- a/xc3028/xc3028_module.c	Sun Nov 16 16:30:51 2008 +0100
+++ b/xc3028/xc3028_module.c	Sun Nov 16 22:52:48 2008 +0100
@@ -1,50 +1,49 @@
-#include linux/kernel.h
-#include linux/module.h
-#include linux/i2c.h
-#include xc3028_control.h
-#include xc3028_module.h
-
-static struct tuner_module xc3028_tuner_module = {
-	.shutdown = xc3028_shutdown,
-	.set_frequency = xc3028_set_frequency,
-	.tuner_cmd = xc3028_tuner_cmd,
-	.get_lock_status = xc3028_get_lock_status,
-	.get_version = xc3028_get_version,
-	.full_scan = xc3028_full_scan,
-	.release = xc3028_tuner_release
-	
-};
-	
-struct tuner_module *xc3028_tuner_attach(struct xc3028_config *config)
-{
-	struct tuner_module *module;
-	struct xc3028_priv *priv;
-
-	module = kzalloc(sizeof(struct tuner_module), GFP_KERNEL);
-
-	priv = kzalloc(sizeof(struct xc3028_priv), GFP_KERNEL);
-
-	priv-callback = config-callback;
-	priv-dev = config-dev;
-	priv-i2c_address = config-i2c_address;
-	priv-adap = config-adap;
-
-	memcpy(module, xc3028_tuner_module, sizeof(struct tuner_module));
-	module-priv = priv;
-
-xc3028_initialize(module, config-new_tv_mode_ptr, config-new_channel_map_ptr);
-
-return module;
-}
-
-void xc3028_tuner_release(struct tuner_module *tuner)
-{
-	kfree(tuner-priv);
-	kfree(tuner);
-}
-
-EXPORT_SYMBOL_GPL(xc3028_tuner_attach);
-
-MODULE_AUTHOR(Markus Rechberger [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(Xceive 3028 Driver);
-MODULE_LICENSE(GPL);
+#include linux/kernel.h
+#include linux/module.h
+#include linux/i2c.h
+#include xc3028_control.h
+#include xc3028_module.h
+
+static struct tuner_module xc3028_tuner_module = {
+	.shutdown = xc3028_shutdown,
+	.set_frequency = xc3028_set_frequency,
+	.tuner_cmd = xc3028_tuner_cmd,
+	.get_lock_status = xc3028_get_lock_status,
+	.get_version = xc3028_get_version,
+	.full_scan = xc3028_full_scan,
+	.release = xc3028_tuner_release
+};
+
+struct tuner_module *xc3028_tuner_attach(struct xc3028_config *config)
+{
+	struct tuner_module *module;
+	struct xc3028_priv *priv;
+
+	module = kzalloc(sizeof(struct tuner_module), GFP_KERNEL);
+
+	priv = kzalloc(sizeof(struct xc3028_priv), GFP_KERNEL);
+
+	priv-callback = config-callback;
+	priv-dev = config-dev;
+	priv-i2c_address = config-i2c_address;
+	priv-adap = config-adap;
+
+	memcpy(module, xc3028_tuner_module, sizeof(struct tuner_module));
+	module-priv = priv;
+
+	xc3028_initialize(module,
+		config-new_tv_mode_ptr, config-new_channel_map_ptr);
+
+	return module;
+}
+EXPORT_SYMBOL_GPL(xc3028_tuner_attach);
+
+void xc3028_tuner_release(struct tuner_module *tuner)
+{
+	kfree(tuner-priv);
+	kfree(tuner);
+}
+
+MODULE_AUTHOR(Markus Rechberger [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(Xceive 3028 Driver);
+MODULE_LICENSE(GPL);
diff -r 36126ed0bf84 xc3028/xc3028_module.h
--- a/xc3028/xc3028_module.h	Sun Nov 16 16:30:51 2008 +0100
+++ b/xc3028/xc3028_module.h	Sun Nov 16 22:52:48 2008 +0100
@@ -5,8 +5,8 @@
 
 struct xc3028_config {
 	struct i2c_adapter *adap;
-	XC3028_TV_MODE* new_tv_mode_ptr;
-	XC3028_CHANNEL_MAP* new_channel_map_ptr;
+	XC3028_TV_MODE *new_tv_mode_ptr;
+	XC3028_CHANNEL_MAP *new_channel_map_ptr;
 	int (*callback)(void *dev, unsigned int cmd, void *data);
 	void *dev;
 	int i2c_address;
@@ -14,16 +14,15 @@
 
 void xc3028_tuner_release(struct tuner_module *tuner);
 
-#if 1 
-//defined(CONFIG_DVB_TUNER_XC3028) || (defined(CONFIG_DVB_TUNER_XC3028_MODULE)  defined(MODULE))
+#if 1
+/*defined(CONFIG_DVB_TUNER_XC3028) || (defined(CONFIG_DVB_TUNER_XC3028_MODULE)  defined(MODULE)) */
 struct tuner_module *xc3028_tuner_attach(struct xc3028_config *config);
 #else
 static inline struct tuner_module *xc3028_tuner_attach(struct xc3028_config)
 {
-printk(KERN_WARNING %s: driver disabled by Kconfig\n, __func__);
-return NULL;
+	printk(KERN_WARNING %s: driver disabled by Kconfig\n, __func__);
+	return NULL;
 }
 #endif
 
-#endif // _XC3028_TUNER_H
-
+#endif /* _XC3028_TUNER_H */
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] modify coding style of cx25843/em28xx-cx25843.c to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for cx25843/em28xx-cx25843.c:
 - ERROR: Don't use linux/videodev.h: see 
Documentation/feature-removal-schedule.txt
 - ERROR: Don't use linux/video_decoder.h: see 
Documentation/feature-removal-schedule.txt

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.

diff -r 9e7ee1583686 cx25843/em28xx-cx25843.c
--- a/cx25843/em28xx-cx25843.c	Mon Nov 17 04:45:43 2008 +0100
+++ b/cx25843/em28xx-cx25843.c	Mon Nov 17 08:21:07 2008 +0100
@@ -6,9 +6,7 @@
 
 #include linux/i2c.h
 #include linux/version.h
-#include linux/videodev.h
 #include linux/delay.h
-#include linux/video_decoder.h
 #include media/v4l2-common.h
 #include em28xx-cx25843.h
 #include em28xx-cx25843-fw.h
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] modify coding style of lgdt3304/lgdt3304.{c, h} to match checkpatch.pl requirements

2008-11-16 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendations for lgdt3304/lgdt3304.{c,h}:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not initialise statics to 0 or NULL
 - ERROR: do not use assignment in if condition
 - ERROR: do not use C99 // comments
 - ERROR: foo* bar should be foo *bar
 - ERROR: open brace '{' following function declarations go on the next line
 - ERROR: open brace '{' following struct go on the same line
 - ERROR: space required after that ',' (ctx:VxV)
 - ERROR: space required before the open brace '{'
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces required around that '' (ctx:VxV)
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: spaces required around that '+=' (ctx:VxV)
 - ERROR: switch and case should be at the same indent
 - ERROR: trailing statements should be on next line
 - ERROR: trailing whitespace
 - WARNING: braces {} are not necessary for any arm of this statement
 - WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
 - WARNING: __func__ should be used instead of gcc specific __FUNCTION__
 - WARNING: printk() should include KERN_ facility level
 - WARNING: space prohibited between function name and open parenthesis '('

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r 9e7ee1583686 lgdt3304/lgdt3304.c
--- a/lgdt3304/lgdt3304.c	Mon Nov 17 04:45:43 2008 +0100
+++ b/lgdt3304/lgdt3304.c	Mon Nov 17 08:49:04 2008 +0100
@@ -4,30 +4,30 @@
  * Copyright (C) 2008 Markus Rechberger [EMAIL PROTECTED]
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *   Redistributions of source code must retain the above copyright notice, 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *   Redistributions of source code must retain the above copyright notice,
  *   this list of conditions and the following disclaimer.
  *
  *   Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation 
+ *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
- * 
- *   Neither the name of Empiatech nor the names of its contributors 
- *   may be used to endorse or promote products derived from this software 
+ *
+ *   Neither the name of Empiatech nor the names of its contributors
+ *   may be used to endorse or promote products derived from this software
  *   without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS 
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
@@ -37,24 +37,24 @@
 #include dvb_frontend.h
 #include lgdt3304.h
 
-static  unsigned int debug = 0;
+static  unsigned int debug;
 module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug,lgdt3304 debugging (default off));
+MODULE_PARM_DESC(debug, lgdt3304 debugging (default off));
 
 #define dprintk(fmt, args...) if (debug) do {\
-			printk(lgdt3304 debug:  fmt, ##args); } while (0)
+		printk(KERN_DEBUG lgdt3304 debug:  fmt, ##args); \
+	} while (0)
 
-struct lgdt3304_state
-{
-struct dvb_frontend frontend;
-fe_modulation_t current_modulation;
-__u32 snr; 
-__u32 current_frequency;
+struct lgdt3304_state {
+	struct dvb_frontend frontend;
+	fe_modulation_t 

[Em28xx] [PATCH] modify coding style of em28xx-video.c to match checkpatch.pl requirements

2008-11-15 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendation for em28xx-video.c:
 - ERROR: code indent should use tabs where possible
 - ERROR: do not use assignment in if condition
 - ERROR: do not use C99 // comments
 - ERROR: Don't use linux/video_decoder.h: see 
Documentation/feature-removal-schedule.txt
 - ERROR: foo * bar should be foo *bar
 - ERROR: (foo*) should be (foo *)
 - ERROR: open brace '{' following function declarations go on the next line
 - ERROR: space prohibited before that close parenthesis ')'
 - ERROR: space prohibited before that ':' (ctx:WxE)
 - ERROR: space required before the open parenthesis '('
 - ERROR: spaces required around that '=' (ctx:VxV)
 - ERROR: spaces required around that '?' (ctx:VxV)
 - ERROR: spaces required around that ':' (ctx:WxV)
 - ERROR: that open brace { should be on the previous line
 - ERROR: trailing whitespace
 - WARNING: EXPORT_SYMBOL(foo); should immediately follow its function/variable
 - WARNING: __func__ should be used instead of gcc specific __FUNCTION__
 - WARNING: printk() should include KERN_ facility level

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.
diff -r 15bf04856ef2 em28xx-video.c
--- a/em28xx-video.c	Fri Nov 14 19:01:42 2008 +0100
+++ b/em28xx-video.c	Sat Nov 15 11:27:31 2008 +0100
@@ -34,7 +34,6 @@
 #include linux/usb.h
 #include linux/i2c.h
 #include linux/version.h
-#include linux/video_decoder.h
 #include dvb_frontend.h
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 15)
 #include linux/mutex.h
@@ -71,7 +70,7 @@
 #define em28xx_videodbg(fmt, arg...) do {\
 	if (video_debug) \
 		printk(KERN_INFO %s %s :fmt, \
-			 dev-name, __FUNCTION__ , ##arg); } while (0)
+			 dev-name, __func__ , ##arg); } while (0)
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
@@ -231,7 +230,7 @@
 #endif
 };
 
-struct em28xx_output_fmt em28xx_out_fmt[]={
+struct em28xx_output_fmt em28xx_out_fmt[] = {
 	{
 		.fmt = {
 			.index = 0,
@@ -337,7 +336,8 @@
 	dev-em28xx_acquire(dev, EM28XX_LOCK, 0);
 }
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 5, 0)
-static void request_modules(struct em28xx *dev) {
+static void request_modules(struct em28xx *dev)
+{
 	dev-em28xx_acquire(dev, EM28XX_LOCK, 0);
 }
 #else
@@ -366,7 +366,8 @@
 }
 #endif
 #else
-static void request_modules(struct em28xx *dev) {
+static void request_modules(struct em28xx *dev)
+{
 	dev-em28xx_acquire(dev, EM28XX_LOCK, 0);
 }
 #endif
@@ -470,15 +471,15 @@
 		{
 			u8 val;
 			switch (dev-ctl_ainput) {
-case 0:
-	val = 0xfd;
-	break;
-case 1:
-	val = 0xfc;
-	break;
-default :
-	val = 0xfe;
-	break;
+			case 0:
+val = 0xfd;
+break;
+			case 1:
+val = 0xfc;
+break;
+			default:
+val = 0xfe;
+break;
 			}
 			if (dev-mute)
 val = 0xfe;
@@ -486,7 +487,7 @@
 			em28xx_write_regs(dev, 0x08, val, 1);
 			break;
 		}
-		default :
+		default:
 			switch (dev-ctl_ainput) {
 			case 0:
 ainput = EM28XX_AUDIO_SRC_TUNER;
@@ -840,7 +841,7 @@
 	usb_put_dev(dev-udev);
 	mutex_unlock(em28xx_sysfs_lock);
 
-		
+
 	/* Mark device as unused */
 	em28xx_devused = ~(1dev-devno);
 
@@ -1140,7 +1141,7 @@
  * em28xx_v4l2_poll()
  * will allocate buffers when called for the first time
  */
-static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table * wait)
+static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table *wait)
 {
 	unsigned int mask = 0;
 	struct em28xx_fh *fh = filp-private_data;
@@ -1624,7 +1625,7 @@
 		format-fmt.pix.width = dev-width;
 		format-fmt.pix.height = dev-height;
 		format-fmt.pix.pixelformat = dev-outfmt-fmt.pixelformat;
-	//	V4L2_PIX_FMT_YUYV;
+/*		V4L2_PIX_FMT_YUYV; */
 		format-fmt.pix.bytesperline = dev-bytesperline;
 		format-fmt.pix.sizeimage = dev-frame_size;
 		format-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
@@ -1671,7 +1672,7 @@
 		format-fmt.vbi.count[1] = dev-tvnorm-vbi_count_1;
 		if (dev-vbi_interlaced)
 			format-fmt.vbi.flags = V4L2_VBI_INTERLACED;
-		else 
+		else
 			format-fmt.vbi.flags = 0;
 		return 0;
 	}
@@ -1731,7 +1732,7 @@
 
 		if (dev-vbi_interlaced)
 			format-fmt.vbi.flags = V4L2_VBI_INTERLACED;
-		else 
+		else
 			format-fmt.vbi.flags = 0;
 
 		format-fmt.vbi.start[0] = dev-tvnorm-vbi_start_0;
@@ -1807,7 +1808,7 @@
 			break;
 		}
 	}
-		
+
 	format-fmt.pix.pixelformat = dev-outfmt-fmt.pixelformat;
 	format-fmt.pix.bytesperline = width * 2;
 	format-fmt.pix.sizeimage = width * 2 * height;
@@ -1821,12 +1822,11 @@
 
 	em28xx_videodbg(%s: returned %dx%d (%d, %d)\n,
 		cmd == VIDIOC_TRY_FMT ?
-		VIDIOC_TRY_FMT :VIDIOC_S_FMT,
+		VIDIOC_TRY_FMT : VIDIOC_S_FMT,
 		format-fmt.pix.width, format-fmt.pix.height, hscale, vscale);
 
-	if (cmd == VIDIOC_TRY_FMT) {
-		return 0;
-	}
+	if (cmd == VIDIOC_TRY_FMT)
+		return 0;
 
 	for (i = 0; i  dev-num_frames; i++)
 		if (dev-frame[i].vma_use_count) {
@@ -2488,7 +2488,7 @@
 }
 #endif
 			}
-			printk(em28xx-video.c: device is currently busy!\n);
+			

[Em28xx] Slab corruption when unplugging Pinnacle Hybrid Pro Stick (320e)

2008-11-13 Thread Németh Márton
Hi,

I am using linux 2.6.27.5 with em28xx-new and I get some slab corruption. I
applied some debug patch to em28xx-new and to the linux tree also (attached).
I enabled the some debug options in the kernel, like:
 - CONFIG_DEBUG_OBJECTS_FREE=y,
 - CONFIG_DEBUG_OBJECTS_TIMERS=y,
 - CONFIG_DEBUG_SLAB=y,
 - CONFIG_DEBUG_SLAB_LEAK=y,
 - CONFIG_DEBUG_BUGVERBOSE=y

Steps to reproduce:
1. Plug Pinnacle Hybrid Pro Stick (320e)
2. Start kaffeine and start watching a digital channel
3. While kaffeine is running unplug the device
4. Now close kaffeine

Current result:

[  704.299771] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4213: checkpoint
[  704.299781] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4215: checkpoint
[  704.299789] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:48: 
checkpoint
[  704.299796] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:50: 
checkpoint
[  704.299803] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:52: 
checkpoint
[  704.299812] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4217: checkpoint
[  704.299825] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4221: checkpoint
[  704.299831] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4223: checkpoint
[  721.424069] usb 3-3: new high speed USB device using ehci_hcd and address 3
[  721.553121] usb 3-3: configuration #1 chosen from 1 choice
[  721.559380] em28xx: new video device (eb1a:2881): interface 0, class 255
[  721.559920] em28xx: device is attached to a USB 2.0 bus
[  721.560398] em28xx #0: Alternate settings: 8
[  721.560769] em28xx #0: Alternate setting 0, max size= 0
[  721.561185] em28xx #0: Alternate setting 1, max size= 0
[  721.561561] em28xx #0: Alternate setting 2, max size= 1448
[  721.561933] em28xx #0: Alternate setting 3, max size= 2048
[  721.562344] em28xx #0: Alternate setting 4, max size= 2304
[  721.562880] em28xx #0: Alternate setting 5, max size= 2580
[  721.563316] em28xx #0: Alternate setting 6, max size= 2892
[  721.563822] em28xx #0: Alternate setting 7, max size= 3072
[  721.793560] register disabled
[  721.994707] register disabled
[  722.018889] attach_inform: tvp5150 detected.
[  722.064552] tvp5150 1-005c: tvp5150am1 detected.
[  722.192701] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:3082: checkpoint
[  722.193379] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:23: 
checkpoint
[  722.193809] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:26: 
checkpoint
[  722.194203] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:29: 
checkpoint
[  722.194557] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:35: 
checkpoint
[  722.194906] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:39: 
checkpoint
[  723.673395] /usr/src/mcentral.de/em28xx-new/xc3028/xc3028_module.c:41: 
checkpoint
[  723.673705] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:3084: checkpoint
[  723.673890] successfully attached tuner
[  723.686130] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[  723.714378] em28xx #0: V4L2 device registered as /dev/video0
[  723.714716] em2880-dvb.c: DVB Init
[  723.715875] register disabled
[  724.034002] DVB: registering new adapter (em2880 DVB-T)
[  724.034361] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[  724.041633] input: em2880/em2870 remote control as /class/input/input11
[  724.061275] em28xx-input.c: remote control handler attached
[  724.061594] em28xx #0: Found Pinnacle Hybrid Pro
[  745.492855] register disabled
[  745.899090] em28xx_dvb_init
[  747.414564] drivers/media/dvb/dvb-core/dvb_frontend.c:1098: checkpoint
[  747.414574] drivers/media/dvb/dvb-core/dvb_frontend.c:1101: checkpoint
[  747.414578] drivers/media/dvb/dvb-core/dvb_frontend.c:1105: checkpoint
[  747.414581] drivers/media/dvb/dvb-core/dvb_frontend.c:1108: checkpoint
[  747.414584] drivers/media/dvb/dvb-core/dvb_frontend.c:1110: checkpoint
[  747.414587] drivers/media/dvb/dvb-core/dvb_frontend.c:1120: checkpoint
[  747.414591] drivers/media/dvb/dvb-core/dvb_frontend.c:1122: checkpoint
[  747.414595] drivers/media/dvb/dvb-core/dvb_frontend.c:1125: checkpoint
[  747.414598] drivers/media/dvb/dvb-core/dvb_frontend.c:1128: checkpoint
[  747.585823] drivers/media/dvb/dvb-core/dvb_frontend.c:1098: checkpoint
[  747.588825] drivers/media/dvb/dvb-core/dvb_frontend.c:1101: checkpoint
[  747.589157] drivers/media/dvb/dvb-core/dvb_frontend.c:1105: checkpoint
[  747.589348] drivers/media/dvb/dvb-core/dvb_frontend.c:1108: checkpoint
[  747.589529] drivers/media/dvb/dvb-core/dvb_frontend.c:1110: checkpoint
[  747.589708] drivers/media/dvb/dvb-core/dvb_frontend.c:1120: checkpoint
[  747.589888] drivers/media/dvb/dvb-core/dvb_frontend.c:1122: checkpoint
[  747.590190] drivers/media/dvb/dvb-core/dvb_frontend.c:1125: checkpoint
[  747.590447] drivers/media/dvb/dvb-core/dvb_frontend.c:1128: checkpoint
[  907.856327] usb 3-3: USB disconnect, address 3
[  907.894975] /usr/src/mcentral.de/em28xx-new/em28xx-video.c:4156: checkpoint
[  907.895351] 

[Em28xx] [PATCH] make register disabled message more verbose

2008-11-13 Thread Németh Márton
When a register is disabled in em28xx_gpio_control() function
show also the contents of command and gpio_value.

diff -r bc52a2f39c15 em28xx-i2c.c
--- a/em28xx-i2c.c	Wed Nov 12 08:57:03 2008 +0100
+++ b/em28xx-i2c.c	Fri Nov 14 01:02:39 2008 +0100
@@ -329,7 +329,8 @@
 			dprintk1(2, (3) writing to %02x - %02x\n, gpio_reg, gpio);
 		}
 	} else {
-		printk(register disabled\n);
+		printk(KERN_ERR register disabled: command=0x%X, gpio_value=0x%X\n,
+			command, gpio_value);
 	}
 
 	return 0;

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] make register disabled message more verbose

2008-11-13 Thread Németh Márton
Markus Rechberger wrote:
 Hi Németh,
 
 2008/11/14 Németh Márton [EMAIL PROTECTED]:
 When a register is disabled in em28xx_gpio_control() function
 show also the contents of command and gpio_value.

 
 when already on it could you make it selectable using a parameter? :-)
 Letting the user decide if he wants to see the debug output or not.
 The whole comment enabled by default isn't worth too much and it's a standard
 situation to have disabled registers by default. I don't need it
 anymore actually and it
 has been a leftover from my side back then.

How do you like this attached one?

Note that with my Pinnacle Hybrid Pro Stick (320e) this line prints out this:

[ 1305.788104] register disabled: command=0x6, gpio_value=0x0

Command 6 is EM28XX_DECODER_SLEEP according to em28xx.h. Does this mean
any problem in my case?

Regards,

Márton Németh

diff -r bc52a2f39c15 em28xx-i2c.c
--- a/em28xx-i2c.c	Wed Nov 12 08:57:03 2008 +0100
+++ b/em28xx-i2c.c	Fri Nov 14 07:39:14 2008 +0100
@@ -329,7 +329,8 @@
 			dprintk1(2, (3) writing to %02x - %02x\n, gpio_reg, gpio);
 		}
 	} else {
-		printk(register disabled\n);
+		dprintk1(KERN_ERR register disabled: command=0x%X, gpio_value=0x%X\n,
+			command, gpio_value);
 	}
 
 	return 0;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] make register disabled message more verbose

2008-11-13 Thread Németh Márton
Németh Márton írta:
 Markus Rechberger wrote:
 Hi Németh,

 2008/11/14 Németh Márton [EMAIL PROTECTED]:
 When a register is disabled in em28xx_gpio_control() function
 show also the contents of command and gpio_value.

 when already on it could you make it selectable using a parameter? :-)
 Letting the user decide if he wants to see the debug output or not.
 The whole comment enabled by default isn't worth too much and it's a standard
 situation to have disabled registers by default. I don't need it
 anymore actually and it
 has been a leftover from my side back then.
 
 How do you like this attached one?

Sorry, I was too fast sending the patch, this is what I really ment.

 
 Note that with my Pinnacle Hybrid Pro Stick (320e) this line prints out this:
 
 [ 1305.788104] register disabled: command=0x6, gpio_value=0x0
 
 Command 6 is EM28XX_DECODER_SLEEP according to em28xx.h. Does this mean
 any problem in my case?
 
 Regards,
 
   Márton Németh

diff -r bc52a2f39c15 em28xx-i2c.c
--- a/em28xx-i2c.c	Wed Nov 12 08:57:03 2008 +0100
+++ b/em28xx-i2c.c	Fri Nov 14 07:54:35 2008 +0100
@@ -329,7 +329,8 @@
 			dprintk1(2, (3) writing to %02x - %02x\n, gpio_reg, gpio);
 		}
 	} else {
-		printk(register disabled\n);
+		dprintk2(1, KERN_ERR register disabled: command=0x%X, gpio_value=0x%X\n,
+			command, gpio_value);
 	}
 
 	return 0;
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] modify coding style to match checkpatch.pl requirements

2008-11-13 Thread Németh Márton
The linux-2.6.27.5/scripts/checkpatch.pl reports the following style
recommendation for em28xx-i2c.c:
 - ERROR: Don't use linux/video_decoder.h: see 
Documentation/feature-removal-schedule.txt
 - ERROR: trailing statements should be on next line
 - WARNING: printk() should include KERN_ facility level
 - ERROR: spaces required around that '==' (ctx:VxV)

The goal modifying the style is that the driver can be accepted more easily
into the mainline kernel.

diff -r bc52a2f39c15 em28xx-i2c.c
--- a/em28xx-i2c.c	Wed Nov 12 08:57:03 2008 +0100
+++ b/em28xx-i2c.c	Fri Nov 14 08:28:43 2008 +0100
@@ -27,7 +27,6 @@
 #include linux/usb.h
 #include linux/i2c.h
 #include linux/version.h
-#include linux/video_decoder.h
 #if LINUX_VERSION_CODE  KERNEL_VERSION(2, 6, 27)
 #include media/audiochip.h
 #else
@@ -57,10 +56,12 @@
 MODULE_PARM_DESC(i2c_debug, enable debug messages [i2c]);
 
 #define dprintk1(lvl, fmt, args...) if (i2c_debug = lvl) do {\
-			printk(fmt, ##args); } while (0)
+			printk(KERN_ERR fmt, ##args); \
+		} while (0)
 #define dprintk2(lvl, fmt, args...) if (i2c_debug = lvl) do { \
 			printk(KERN_DEBUG %s at %s:  fmt, \
-			dev-name, __func__, ##args); } while (0)
+			dev-name, __func__, ##args); \
+		} while (0)
 
 /*
  * em2800_i2c_send_max4()
@@ -183,14 +184,14 @@
 		cmd = EM28XX_TUNER1_RESET;
 		break;
 	default:
-		printk(unknown gpio translate command\n);
+		dprintk1(1, unknown gpio translate command 0x%X\n, command);
 		break;
 	}
 
 	return em28xx_gpio_control(priv, cmd, ptr);
 }
 
-static int em28xx_fetch_gpio(struct em28xx *dev, u8 offset, u16* value)
+static int em28xx_fetch_gpio(struct em28xx *dev, u8 offset, u16 *value)
 {
 	int ret;
 	int ret2 = 0;
@@ -260,9 +261,9 @@
 			ret = em28xx_fetch_gpio(dev, 23, gpio_value);
 			break;
 		case EM28XX_LED1_ON:
-			printk(reading led\n);
+			dprintk1(1, reading led\n);
 			ret = em28xx_fetch_gpio(dev, 22, gpio_value);
-			printk(led returned: ret=%i, gpio_value=%02x\n, ret, gpio_value);
+			dprintk1(1, led returned: ret=%i, gpio_value=%02x\n, ret, gpio_value);
 			break;
 		default:
 			ret = -EINVAL;
@@ -275,7 +276,7 @@
 	if (gpio_value  0x80) {
 		if (((gpio_value  6)1) == 0) {
 			if (arg == NULL) {
-printk(KERN_INFOno argument given %02x\n,
+dprintk1(1, no argument given %02x\n,
 		gpio_value);
 return -EINVAL;
 			}
@@ -449,7 +450,7 @@
 write failed:\n, addr);
 		printk(KERN_ERR===\n);
 		for (i = 0; i  len; i++)
-			printk(%02x , (unsigned char)buf[i]);
+			printk(KERN_CONT %02x , (unsigned char)buf[i]);
 
 		printk(\n);
 		printk(KERN_ERR\n);
@@ -543,7 +544,7 @@
 			/* write bytes */
 			if (i2c_debug = 2) {
 for (byte = 0; byte  msgs[i].len; byte++)
-	printk( %02x, msgs[i].buf[byte]);
+	printk(KERN_CONT  %02x, msgs[i].buf[byte]);
 			}
 			if (dev-em_type == EM2800)
 rc = em2800_i2c_send_bytes(dev, addr,
@@ -558,7 +559,7 @@
 		if (rc  0)
 			goto err;
 		if (i2c_debug = 2)
-			printk(\n);
+			printk(KERN_CONT \n);
 	}
 
 	return num;
@@ -610,10 +611,10 @@
 		if (0 == (i % 16))
 			printk(KERN_INFO %s: i2c eeprom %02x:,
 	dev-name, i);
-		printk( %02x, eedata[i]);
+		printk(KERN_CONT  %02x, eedata[i]);
 
 		if (15 == (i % 16))
-			printk(\n);
+			printk(KERN_CONT \n);
 	}
 
 	printk(KERN_INFO EEPROM ID= 0x%08x\n, em_eeprom-id);
@@ -721,7 +722,7 @@
 	struct em28xx *dev = client-adapter-algo_data;
 	int ret;
 
-	if (client-driver-id == I2C_DRIVERID_TUNER  dev-has_inttuner==1) {
+	if (client-driver-id == I2C_DRIVERID_TUNER  dev-has_inttuner == 1) {
 		printk(KERN_INFOem28xx-i2c: using internal tuner, denying 
 			request to i2c tuner module.\n);
 		em28xx_set_tuner(-1, client);
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] question about GPIO registers

2008-11-12 Thread Németh Márton
Hi Markus,

I have a question about the GPIO registers. In em28xx-i2c.c there is the
em28xx_gpio_control() function. Here the sometimes the lower 3 and sometimes
the lower 4 bits of the 16bit gpio_value is used in the left bit shift
operation. The shift is applied to an 8 bit value, which means. In case when
only the lower 3 bits are used the result will be:

gpio_value  7  | (u8)(1  (gpio_value  7))
+-
0   | 1
1   | 2
2   | 4
3   | 8
4   | 16
5   | 32
6   | 64
7   | 128

However, when the lower 4 bits are used for shifting an 8bit value, then the
result maybe sometimes something different what expected:

gpio_value  0xf | (u8)(1  (gpio_value  0xf))
-+---
0| 1
1| 2
2| 4
3| 8
4| 16
5| 32
6| 64
7| 128
8| 0
9| 0
10   | 0
11   | 0
12   | 0
13   | 0
14   | 0
15   | 0

Is this how it should work?


 int em28xx_gpio_control(void *priv, unsigned int command, void *ptr)
 {
   struct em28xx *dev = (struct em28xx *)priv;
   unsigned int len;
   u16 gpio_value;
   u8 gpio;
   int *arg = ptr;
   u16 gpio_reg;
   int ret = 0;

 [... fetch gpio_value ...]

   /* check if gpio register enabled */
   if (gpio_value  0x80) {
   if (((gpio_value  6)1) == 0) {
   if (arg == NULL) {
   printk(KERN_INFOno argument given %02x\n,
   gpio_value);
   return -EINVAL;
   }
   /* on/off command */
   switch (dev-em_type) {
   case EM2888:
   case EM2889:
   case EM2875:
   gpio_reg = 0x80;
   break;
   case EM2883:
   default:
   gpio_reg = gpio_value0x10 ? 0x04 : 0x08;
   break;
   }
   gpio = dev-em28xx_read_reg(dev, gpio_reg);
   gpio = ~((u8)(1  (gpio_value0x7)));

Lower 3 bits is used here for shifting.


   if (*arg == EM28XX_REG_ON)
   gpio |= ((gpio_value  5)1) 
   (gpio_value7);

Lower 3 bits again.

   else
   gpio |= (((gpio_value  5)1)^1) 
   (gpio_value7);

Lower 3 bits of gpio_value for shifting.


   dev-em28xx_write_regs(dev, gpio_reg, gpio, 1);
   dprintk1(2, (1) writing to %02x - %02x\n, gpio_reg, 
 gpio);
   } else {
   switch (dev-em_type) {
   case EM2889:
   case EM2888:
   case EM2875:
   gpio_reg = 0x80;
   break;
   case EM2883:
   default:
   gpio_reg = gpio_value0x10 ? 0x04 : 0x08;
   break;
   }
   gpio = dev-em28xx_read_reg(dev, gpio_reg);
   gpio = ~((u8)(1  (gpio_value0xf)));

Here the lower 4 bits are used for shifting.


   gpio |= ((gpio_value  5)1)  (gpio_value7);

Lower 3 bits.

   dev-em28xx_write_regs(dev, gpio_reg, gpio, 1);
   dprintk1(2, (2) writing to %02x - %02x\n, gpio_reg, 
 gpio);
   gpio = ~((u8)(1  (gpio_value0xf)));

Lower 4 bits.

   gpio |= (((gpio_value  5)1)^1)  (gpio_value7);

Lower 3 bits.

   mdelay(100);
   dev-em28xx_write_regs(dev, gpio_reg, gpio, 1);
   mdelay(100);
   dprintk1(2, (3) writing to %02x - %02x\n, gpio_reg, 
 gpio);
   }
   } else {
   printk(register disabled\n);
   }

   return 0;
 }

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] add error handling to em28xx_gpio_control()

2008-11-09 Thread Németh Márton
Hi Markus,

Markus Rechberger wrote:
 2008/11/9 Németh Márton [EMAIL PROTECTED]:
 As the device an be unplugged any time handling of this situation
 is to be handled in case of em28xx_gpio_control() function.
 
 this is going to add alot overhead there, how about a macro using #define?

I have the idea adding the unlikely() into the ifs like this:

ret = em28xx_gpio_control(...);
if (unlikely(ret  0)) {
printk(...); /* error message */
return ret;
}

In the normal execution path only the (ret  0) is evaluated. I have
to go through my patch because sometimes I think I also check the
debug variable, which is incorrect.

Could you please give me some hints which are the time critical functions?

Regards,

Márton Németh

___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] add error handling to em28xx_gpio_control()

2008-11-09 Thread Németh Márton
As the device an be unplugged any time handling of this situation
is to be handled in case of em28xx_gpio_control() function.
diff -r 79725dfae741 em2880-dvb.c
--- a/em2880-dvb.c	Sun Nov 09 02:52:18 2008 +0100
+++ b/em2880-dvb.c	Sun Nov 09 11:24:01 2008 +0100
@@ -269,6 +269,8 @@
 {
 	int i;
 	int arg;
+	int ret;
+
 	for (i = 0; i  EM2880_DVB_NUM_BUFS; i++) {
 		if (dvb_dev-urb[i]) {
 			usb_kill_urb(dvb_dev-urb[i]);
@@ -285,7 +287,11 @@
 		dvb_dev-transfer_buffer[i] = NULL;
 	}
 	arg=EM28XX_REG_OFF;
-	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	ret = dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	if (ret  0) {
+		printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+__LINE__, __func__, ret);
+	}
 
 }
 
@@ -294,10 +300,17 @@
 	int i, errCode;
 	int arg;
 	const int sb_size = EM2880_DVB_NUM_PACKETS * dvb_dev-dtv_packetsize;
+	int ret;
 
 	dprintk(1, em2880-dvb.c: got start stream request %s\n, __func__);
 	arg=EM28XX_REG_ON;
-	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	ret = dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	if (ret  0) {
+		printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+__LINE__, __func__, ret);
+		return ret;
+	}
+
 
 	em2880_set_alternate(dvb_dev);
 
@@ -666,18 +679,39 @@
 {
 	struct em28xx *dev = fe-dvb-priv;
 	int gpio_arg;
+	int ret;
 
 	printk(KERN_INFOem28xx_dvb_init\n);
 
 	if (dev-mode != V4L2_TUNER_DIGITAL_TV) {
 		printk(KERN_INFOswitching over from %d\n, dev-mode);
 		gpio_arg = EM28XX_REG_OFF;
-		dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
 
 		gpio_arg = EM28XX_REG_ON;
-		dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
 		mdelay(100);
 	}
 	dev-mode = V4L2_TUNER_DIGITAL_TV;
@@ -741,18 +775,44 @@
 	struct em2880_dvb *dvbdev = dev-dvb_dev;
 
 	int gpio_arg;
+	int ret;
 
 //	if (dev-mode != V4L2_TUNER_DIGITAL_TV) {
 		dev-em28xx_write_regs_req(dev, 0x00, 0x48, \x00, 1);
 		dev-em28xx_write_regs_req(dev, 0x00, 0x12, \x77, 1);
 
 		gpio_arg = EM28XX_REG_OFF;
-		dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
 		gpio_arg = EM28XX_REG_ON;
-		dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DECODER_SLEEP, gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+		if (debug  ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
+		if (ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DECODER_SLEEP, gpio_arg);
+		if (ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		if (ret  0) {
+			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+	__LINE__, __func__, ret);
+			return ret;
+		}
 		mdelay(100);
 //	}
 	dev-mode = V4L2_TUNER_DIGITAL_TV;
@@ -783,9 +843,15 @@
 static int em28xx_zl10353_sleep(struct dvb_frontend *fe)
 {
 	struct em28xx *dev = fe-dvb-priv;
+//	int ret;
 //	int gpio_arg = EM28XX_REG_OFF;
 	if (dev-mode == V4L2_TUNER_DIGITAL_TV  dev-powersaving) {
-//		dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+//		ret = dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+//		if (ret  0) {
+//			printk(KERN_ERR%s:%u:%s(): ret = %i\n, __FILE__,
+//	__LINE__, __func__, ret);
+//			return ret;
+//		}
 		printk(KERN_INFOpowered down zl10353\n);
 	}
 	return 0;
@@ -796,13 +862,19 @@
 {
 	struct em28xx 

Re: [Em28xx] [PATCH] add error handling to em28xx_gpio_control()

2008-11-09 Thread Németh Márton
Markus Rechberger wrote:
 Hi Németh,
 
 On Sun, Nov 9, 2008 at 1:16 PM, Németh Márton [EMAIL PROTECTED] wrote:
 Hi Markus,

 Markus Rechberger wrote:
 2008/11/9 Németh Márton [EMAIL PROTECTED]:
 As the device an be unplugged any time handling of this situation
 is to be handled in case of em28xx_gpio_control() function.
 this is going to add alot overhead there, how about a macro using #define?
 I have the idea adding the unlikely() into the ifs like this:

ret = em28xx_gpio_control(...);
if (unlikely(ret  0)) {
printk(...); /* error message */
return ret;
}

 In the normal execution path only the (ret  0) is evaluated. I have
 to go through my patch because sometimes I think I also check the
 debug variable, which is incorrect.

 Could you please give me some hints which are the time critical functions?
 
 I would say there are more or less no time critical functions,
 although it can be added
 as an optimization of course.
 The devicedriver heavily depends on how fast the device itself can
 execute the commands
 which are submitted.
 
 The error checking makes sense, but please have a look at #define
 macros to avoid those
 heavy code duplications for error checking. When looking through the actual 
 code
 those overloaded checks might be confusing, macros could have the same
 effect but also
 shorten the implementation.

I think now I understand your point. See the attached patch and let me know
your comments.

Regards,

Márton Németh

diff -r 79725dfae741 em2880-dvb.c
--- a/em2880-dvb.c	Sun Nov 09 02:52:18 2008 +0100
+++ b/em2880-dvb.c	Sun Nov 09 15:32:28 2008 +0100
@@ -269,6 +269,8 @@
 {
 	int i;
 	int arg;
+	int ret;
+
 	for (i = 0; i  EM2880_DVB_NUM_BUFS; i++) {
 		if (dvb_dev-urb[i]) {
 			usb_kill_urb(dvb_dev-urb[i]);
@@ -285,7 +287,10 @@
 		dvb_dev-transfer_buffer[i] = NULL;
 	}
 	arg=EM28XX_REG_OFF;
-	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	ret = dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	if (unlikely(ret  0)) {
+		em28xx_err(%s:%u:%s(): em28xx_read_reg_req() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+	}
 
 }
 
@@ -294,10 +299,12 @@
 	int i, errCode;
 	int arg;
 	const int sb_size = EM2880_DVB_NUM_PACKETS * dvb_dev-dtv_packetsize;
+	int ret;
 
 	dprintk(1, em2880-dvb.c: got start stream request %s\n, __func__);
 	arg=EM28XX_REG_ON;
-	dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	ret = dvb_dev-em28xx_dev-em28xx_gpio_control(dvb_dev-em28xx_dev, EM28XX_LED1_ON, arg);
+	return_if_error(ret);
 
 	em2880_set_alternate(dvb_dev);
 
@@ -666,18 +673,23 @@
 {
 	struct em28xx *dev = fe-dvb-priv;
 	int gpio_arg;
+	int ret;
 
 	printk(KERN_INFOem28xx_dvb_init\n);
 
 	if (dev-mode != V4L2_TUNER_DIGITAL_TV) {
 		printk(KERN_INFOswitching over from %d\n, dev-mode);
 		gpio_arg = EM28XX_REG_OFF;
-		dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		return_if_error(ret);
 
 		gpio_arg = EM28XX_REG_ON;
-		dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+		return_if_error(ret);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
+		return_if_error(ret);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		return_if_error(ret);
 		mdelay(100);
 	}
 	dev-mode = V4L2_TUNER_DIGITAL_TV;
@@ -741,18 +753,25 @@
 	struct em2880_dvb *dvbdev = dev-dvb_dev;
 
 	int gpio_arg;
+	int ret;
 
 //	if (dev-mode != V4L2_TUNER_DIGITAL_TV) {
 		dev-em28xx_write_regs_req(dev, 0x00, 0x48, \x00, 1);
 		dev-em28xx_write_regs_req(dev, 0x00, 0x12, \x77, 1);
 
 		gpio_arg = EM28XX_REG_OFF;
-		dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_ANALOG_ON,gpio_arg);
+		return_if_error(ret);
 		gpio_arg = EM28XX_REG_ON;
-		dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DECODER_SLEEP, gpio_arg);
-		dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TS1_ON,   gpio_arg);
+		return_if_error(ret);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_TUNER1_ON,gpio_arg);
+		return_if_error(ret);
+		return_if_error(ret);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DECODER_SLEEP, gpio_arg);
+		return_if_error(ret);
+		ret = dev-em28xx_gpio_control(dev, EM28XX_DEMOD1_RESET, NULL);
+		return_if_error(ret);
 		mdelay(100);
 //	}
 	dev-mode = V4L2_TUNER_DIGITAL_TV;
@@ -783,9 +802,11 @@
 static int em28xx_zl10353_sleep(struct dvb_frontend *fe)
 {
 	struct em28xx *dev = fe-dvb-priv;
+//	int ret;
 //	int gpio_arg

[Em28xx] [PATCH] extract em28xx_fetch_gpio() from em28xx_gpio_control()

2008-11-09 Thread Németh Márton
With a little reorganising a new em28xx_fetch_gpio() function can be
created. This new function takes care about the error handling and
simplifies the structure of em28xx_gpio_control() function.
diff -r 79725dfae741 em28xx-i2c.c
--- a/em28xx-i2c.c	Sun Nov 09 02:52:18 2008 +0100
+++ b/em28xx-i2c.c	Sun Nov 09 23:49:32 2008 +0100
@@ -190,102 +190,85 @@
 	return em28xx_gpio_control(priv, cmd, ptr);
 }
 
+static int em28xx_fetch_gpio(struct em28xx *dev, u8 offset, u16* value)
+{
+	int ret;
+	int ret2 = 0;
+	u8 buf[2];
+
+	switch (dev-em_type) {
+	case EM2888:
+	case EM2889:
+	case EM2875:
+		ret = dev-em28xx_write_regs(dev, 0x06, \x40, 1);
+		if (0 = ret) {
+			buf[0] = 0;
+			buf[1] = 0xa0 + offset; /* EEPROM address */
+			ret = em28xx_write_regs_req(dev, 0x03, 0xa0, buf, 2);
+			if (0 = ret)
+ret = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret2 = dev-em28xx_write_regs(dev, 0x06, \x45, 1);
+		}
+		break;
+	case EM2883:
+	default:
+		buf[0] = 0x3c + offset; /* EEPROM address */
+		ret = em28xx_write_regs_req(dev, 0x03, 0xa0, buf, 1);
+		if (0 = ret)
+			ret = em28xx_read_reg_req(dev, 0x2, 0xa0);
+	}
+
+	if (ret2  0)
+		ret = ret2;
+
+	if (0 = ret)
+		*value = ret;
+
+	return ret;
+}
+
 int em28xx_gpio_control(void *priv, unsigned int command, void *ptr)
 {
 	struct em28xx *dev = (struct em28xx *)priv;
 	unsigned int len;
 	u16 gpio_value;
-	u8 buf[2];
-	u8 *index;
 	u8 gpio;
 	int *arg = ptr;
 	u16 gpio_reg;
-	u8 eeprom_offset;
+	int ret = 0;
 
 	if (em28xx_boards[dev-model].manual_gpio)
 		em28xx_gpio_cmd(dev, command, gpio_value, len);
 	else {
-		switch (dev-em_type) {
-		case EM2888:
-		case EM2889:
-		case EM2875:
-			eeprom_offset = 0xa0;
-			buf[0] = 0;
-			index = buf[1];
-			len = 2;
-			dev-em28xx_write_regs(dev, 0x06, \x40, 1);
-			break;
-		case EM2883:
-		default:
-			eeprom_offset = 0x3c;
-			index = buf[0];
-			len = 1;
-			break;
-		}
-
 		switch (command) {
 		case EM28XX_ANALOG_ON:
-			*index = eeprom_offset + 24;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 24, gpio_value);
 			break;
 		case EM28XX_TS1_ON:
-			*index = eeprom_offset + 25;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 25, gpio_value);
 			break;
 		case EM28XX_DECODER_SLEEP:
-			*index = eeprom_offset + 20;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 20, gpio_value);
 			break;
 		case EM28XX_DEMOD1_RESET:
-			*index = eeprom_offset + 16;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 16, gpio_value);
 			break;
 		case EM28XX_TUNER1_RESET:
-			*index = eeprom_offset + 17;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 17, gpio_value);
 			break;
 		case EM28XX_TUNER1_ON:
-			*index = eeprom_offset + 23;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+			ret = em28xx_fetch_gpio(dev, 23, gpio_value);
 			break;
 		case EM28XX_LED1_ON:
 			printk(reading led\n);
-			*index = eeprom_offset + 22;
-			em28xx_write_regs_req(dev, 0x03, 0xa0, buf, len);
-			gpio_value = em28xx_read_reg_req(dev, 0x2, 0xa0);
-			printk(led returned: %02x\n, gpio_value);
+			ret = em28xx_fetch_gpio(dev, 22, gpio_value);
+			printk(led returned: ret=%i, gpio_value=%02x\n, ret, gpio_value);
 			break;
 		default:
-			switch (dev-em_type) {
-			case EM2888:
-			case EM2889:
-			case EM2875:
-dev-em28xx_write_regs(dev, 0x06, \x45, 1);
-break;
-			default:
-break;
-			}
-			return -EINVAL;
+			ret = -EINVAL;
 		}
-		switch (dev-em_type) {
-		case EM2888:
-		case EM2875:
-		case EM2889:
-			dev-em28xx_write_regs(dev, 0x06, \x45, 1);
-			break;
-		case EM2883:
-		default:
-			eeprom_offset = 0x3b;
-			index = buf[0];
-			len = 1;
-			break;
-		}
+		if (ret  0)
+			return ret;
 	}
 
 	/* check if gpio register enabled */
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] correct small typo in comment

2008-11-08 Thread Németh Márton
Jeffrey P. írta:
 On Nov 8, 2008, at 2:46 AM, Németh Márton wrote:
 
 Correct small typo in em28xx_usb_disconnect() comment.
 Might want to double-check that: disconnected is still misspelled ;)

Let's try again...

Márton Németh
diff -r d59c8a104ac7 em28xx-video.c
--- a/em28xx-video.c	Sat Nov 08 06:38:58 2008 +0100
+++ b/em28xx-video.c	Sat Nov 08 08:46:22 2008 +0100
@@ -4082,7 +4082,7 @@
 
 /*
  * em28xx_usb_disconnect()
- * called when the device gets diconencted
+ * called when the device gets disconnencted
  * video device will be unregistered on v4l2_close in case it is still open
  */
 static void em28xx_usb_disconnect(struct usb_interface *interface)
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] correct small typo in comment

2008-11-08 Thread Németh Márton
Jeffrey P. wrote:
 On Nov 8, 2008, at 3:23 AM, Németh Márton wrote:
 
 Jeffrey P. írta:
 On Nov 8, 2008, at 2:46 AM, Németh Márton wrote:

 Correct small typo in em28xx_usb_disconnect() comment.
 Might want to double-check that: disconnected is still  
 misspelled ;)
 Let's try again...
 Still got an extra n in there...
No comment... Patch attached.
diff -r d59c8a104ac7 em28xx-video.c
--- a/em28xx-video.c	Sat Nov 08 06:38:58 2008 +0100
+++ b/em28xx-video.c	Sat Nov 08 08:46:22 2008 +0100
@@ -4082,7 +4082,7 @@
 
 /*
  * em28xx_usb_disconnect()
- * called when the device gets diconencted
+ * called when the device gets disconnected
  * video device will be unregistered on v4l2_close in case it is still open
  */
 static void em28xx_usb_disconnect(struct usb_interface *interface)
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] add error handling for EM2881_BOARD_GENERIC

2008-11-08 Thread Németh Márton
Error conditions should be always checked:
 - out of memory
 - device was disconnected
diff -r b8daa9106af7 em28xx-video.c
--- a/em28xx-video.c	Sat Nov 08 13:57:08 2008 +0100
+++ b/em28xx-video.c	Sat Nov 08 23:45:32 2008 +0100
@@ -2971,11 +2971,24 @@
 	dev-qamnorm = em28xx_boards[model].qamnorms[0];
 	dev-atscnorm = em28xx_boards[model].atscnorms[0];
 
-	em28xx_write_regs_req(dev, 0x02, 0xa0, \x23, 1);
+	ret = em28xx_write_regs_req(dev, 0x02, 0xa0, \x23, 1);
+	if (ret  0) {
+		em28xx_err(%s:%u:%s(): em28xx_write_regs_req() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+		return ret;
+	}
 	ret = dev-em28xx_read_reg(dev, 0x05);
+	if (ret  0) {
+		em28xx_err(%s:%u:%s(): em28xx_read_reg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+		return ret;
+	}
 
 	if (ret == 0) {
-		value = em28xx_read_reg_req(dev, 0x2, 0xa0);
+		ret = em28xx_read_reg_req(dev, 0x2, 0xa0);
+		if (ret  0) {
+			em28xx_err(%s:%u:%s(): em28xx_read_reg_req() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+			return ret;
+		}
+		value = ret;
 		/* keep it overridable */
 		if (dev-manual_gpio == 0)
 			dev-manual_gpio = (em28xx_read_reg_req(dev, 0x2, 0xa0)3)1;
@@ -3854,20 +3867,37 @@
 			for (i = 0, rv = 0; i  ARRAY_SIZE(pinnacle_hybrid_pro); i++)
 			{
 sendbuf = kmalloc(pinnacle_hybrid_pro[i].blen, GFP_KERNEL);
+if (!sendbuf) {
+	em28xx_err(%s:%u:%s(): out of memory\n, __FILE__, __LINE__, __FUNCTION__);
+	return -ENOMEM;
+}
 memcpy(sendbuf, pinnacle_hybrid_pro[i].buffer, pinnacle_hybrid_pro[i].blen);
 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), pinnacle_hybrid_pro[i].brequest,
 		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		0x, pinnacle_hybrid_pro[i].index, sendbuf, pinnacle_hybrid_pro[i].blen, HZ);
 kfree(sendbuf);
+if (ret  0) {
+	em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+	return ret;
+}
 if (pinnacle_hybrid_pro[i].msecs)
 	msleep(pinnacle_hybrid_pro[i].msecs);
 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00,
 		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		0x, 0x05, buffer, 1, HZ);
-if (pinnacle_hybrid_pro[i].index == 0xa0)
+if (ret  0) {
+	em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+	return ret;
+}
+if (pinnacle_hybrid_pro[i].index == 0xa0) {
 	ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x02,
 			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			0x, pinnacle_hybrid_pro[i].index, buffer, 1, HZ);
+	if (ret  0) {
+		em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+		return ret;
+	}
+}
 
 if (buffer != pinnacle_hybrid_pro[i].retval) {
 	printk(FAILED: 0x%02x 0x%02x\n, pinnacle_hybrid_pro[i].index, buffer);
@@ -3882,20 +3912,37 @@
 			for (i = 0, rv = 0; i  ARRAY_SIZE(dnt_hybrid); i++)
 			{
 sendbuf = kmalloc(dnt_hybrid[i].blen, GFP_KERNEL);
+if (!sendbuf) {
+	em28xx_err(%s:%u:%s(): out of memory\n, __FILE__, __LINE__, __FUNCTION__);
+	return -ENOMEM;
+}
 memcpy(sendbuf, dnt_hybrid[i].buffer, dnt_hybrid[i].blen);
 ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), dnt_hybrid[i].brequest,
 		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		0x, dnt_hybrid[i].index, sendbuf, dnt_hybrid[i].blen, HZ);
 kfree(sendbuf);
+if (ret  0) {
+	em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+	return ret;
+}
 if (dnt_hybrid[i].msecs)
 	msleep(dnt_hybrid[i].msecs);
 ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00,
 		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 		0x, 0x05, buffer, 1, HZ);
-if (dnt_hybrid[i].index == 0xa0)
+if (ret  0) {
+	em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+	return ret;
+}
+if (dnt_hybrid[i].index == 0xa0) {
 	ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x02,
 			USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			0x, pinnacle_hybrid_pro[i].index, buffer, 1, HZ);
+	if (ret  0) {
+		em28xx_err(%s:%u:%s(): usb_control_msg() failed, ret = %i\n, __FILE__, __LINE__, __FUNCTION__, ret);
+		return ret;
+	}
+}
 if (buffer != dnt_hybrid[i].retval) {
 	rv = 1;
 	break;
@@ -3905,8 +3952,8 @@
 (*model) = EM2881_BOARD_DNT_DA2_HYBRID;
 return 0;
 			}
-			}
-			break;
+		}
+		break;
 		default:
 			return 0;
 	}
@@ -4049,6 +4096,7 @@
 			GFP_KERNEL);
 	if (dev-alt_max_pkt_size == NULL) {
 		em28xx_errdev(out of memory!\n);
+		kfree(dev);
 		em28xx_devused = ~(1nr);
 		return -ENOMEM;
 	}
@@ -4066,12 +4114,20 @@
 	if ((card[nr] = 0)  (card[nr]  em28xx_bcount))
 		model = card[nr];
 
-	em28xx_generic_probe(model, udev, dev);
+	retval = 

[Em28xx] [PATCH] stop build.sh if there was any error

2008-11-07 Thread Németh Márton
Hi,

if there was any error when executing build.sh build then the build script
should stop. I attached a patch which implements this.

Regards,

Márton Németh
diff -r 64e449f371c6 build.sh
--- a/build.sh	Tue Nov 04 01:01:14 2008 +0100
+++ b/build.sh	Fri Nov 07 22:07:23 2008 +0100
@@ -20,6 +20,11 @@
 
 if [ $1 = build ]; then
 make default
+
+if [ $? != 0 ]; then
+	# Stop if there was any error
+	exit $?
+fi
 
 if [ -d /lib/modules/2.6.21.4-eeepc ]; then
 for i in sharp/s921.ko drx3973d/drx3973d.ko tvp5150/tvp5150.ko lgdt3304/lgdt3304.ko  mt352/mt352.ko zl10353/zl10353.ko  cx25843/em28xx-cx25843.ko  xc3028/tuner-xc3028.ko xc5000/tuner-xc5000.ko em28xx.ko em28xx-audio.ko em28xx-aad.ko em28xx-audioep.ko em28xx-dvb.ko precompiled/dvb-core.ko qt1010/qt1010.ko mt2060/mt2060.ko; do 
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] kernel BUG message when unplugging Pinnacle Hybrid Pro Stick (320e)

2008-11-07 Thread Németh Márton
Hi,

I am using Linux kernel 2.6.27. I took the em28xx driver with the
command hg clone http://mcentral.de/hg/~mrec/em28xx-new; today. When I plug
and unplug the Pinnacle Hybrid Pro Stick (320e) I get the following error
message:

[  119.090835] Linux video capture interface: v2.00
[  119.210357] em28xx v4l2 driver version 0.0.1 loaded
[  119.211321] usbcore: registered new interface driver em28xx
[  160.410176] usb 1-3: new high speed USB device using ehci_hcd and address 2
[  160.546266] usb 1-3: configuration #1 chosen from 1 choice
[  160.547714] em28xx: new video device (eb1a:2881): interface 0, class 255
[  160.548289] em28xx: device is attached to a USB 2.0 bus
[  160.548712] em28xx #0: Alternate settings: 8
[  160.549113] em28xx #0: Alternate setting 0, max size= 0
[  160.549482] em28xx #0: Alternate setting 1, max size= 0
[  160.549848] em28xx #0: Alternate setting 2, max size= 1448
[  160.550251] em28xx #0: Alternate setting 3, max size= 2048
[  160.550621] em28xx #0: Alternate setting 4, max size= 2304
[  160.550988] em28xx #0: Alternate setting 5, max size= 2580
[  160.551390] em28xx #0: Alternate setting 6, max size= 2892
[  160.551758] em28xx #0: Alternate setting 7, max size= 3072
[  160.775500] register disabled
[  160.977362] register disabled
[  161.032285] attach_inform: tvp5150 detected.
[  161.078491] tvp5150 1-005c: tvp5150am1 detected.
[  162.657441] successfully attached tuner
[  162.657883] em28xx #0 em28xx_init_dev :tvnorm = PAL-BG
[  162.670506] em28xx #0: V4L2 VBI device registered as /dev/vbi0
[  162.687933] em28xx #0 video_mux :Setting input index = 0, vmux = 0, amux = 0
[  162.688553] em28xx #0: V4L2 device registered as /dev/video0
[  162.691848] input: em2880/em2870 remote control as /class/input/input9
[  162.701510] em28xx-input.c: remote control handler attached
[  162.701846] em28xx #0: Found Pinnacle Hybrid Pro
[  162.702668] audio device (eb1a:2881): interface 1, class 1
[  162.703132] audio device (eb1a:2881): interface 2, class 1
[  163.294981] em2880-dvb.c: DVB Init
[  163.298046] register disabled
[  163.320172] usbcore: registered new interface driver snd-usb-audio
[  163.745873] DVB: registering new adapter (em2880 DVB-T)
[  163.746937] DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
[  163.758261] Em28xx: Initialized (Em2880 DVB Extension) extension
[  172.754108] usb 1-3: USB disconnect, address 2
[  172.771104] em28xx-input.c: remote control handler detached
[  172.775731] em28xx #0: disconnecting em28xx#0 video
[  172.776622] em28xx #0: V4L2 VIDEO devices /dev/video0 deregistered
[  172.780158] em28xx #0: V4L2 VBI devices /dev/vbi0 deregistered
[  172.782889] [ cut here ]
[  172.782900] kernel BUG at kernel/module.c:837!
[  172.782907] invalid opcode:  [#1] PREEMPT
[  172.782918] Modules linked in: em28xx_dvb snd_usb_audio drx3973d s921 mt2060 
lgdt3304 zl10353 snd_usb_lib lgdt330x snd_hwdep dvb_core qt1010 tuner_xc3028
tvp5150 em28xx videodev v4l1_compat ppdev lp cpufreq_ondemand 
cpufreq_conservative ipv6 xt_tcpudp iptable_filter ip_tables x_tables 
leds_clevo_mail led_class
via via_agp drm agpgart eeprom snd_pcm_oss snd_mixer_oss cpufreq_userspace 
cpufreq_powersave powernow_k8 fan pcmcia firmware_class snd_via82xx 
snd_via82xx_modem
mousedev snd_ac97_codec snd_mpu401_uart snd_seq_midi ac97_bus 
snd_seq_midi_event snd_rawmidi i2c_viapro snd_pcm snd_seq yenta_socket 
snd_timer ide_cd_mod k8temp
psmouse snd_seq_device rsrc_nonstatic cdrom uhci_hcd snd_page_alloc serio_raw 
pcspkr ehci_hcd snd i2c_core hwmon 8139too soundcore usbcore mii pcmcia_core
bitrev crc32 video backlight output 8250_pnp 8250 serial_core parport_pc 
thermal parport battery ac button processor evdev
[  172.783036]
[  172.783036] Pid: 1752, comm: khubd Not tainted (2.6.27 #1)
[  172.783036] EIP: 0060:[c014c3d8] EFLAGS: 00010246 CPU: 0
[  172.783036] EIP is at symbol_put_addr+0x38/0x50
[  172.783036] EAX:  EBX: 6b6b6b6b ECX: f6e9e000 EDX: 
[  172.783036] ESI: f7bbb000 EDI:  EBP: f6e9fe38 ESP: f6e9fe34
[  172.783036]  DS: 007b ES: 007b FS:  GS:  SS: 0068
[  172.783036] Process khubd (pid: 1752, ti=f6e9e000 task=f6e9cb20 
task.ti=f6e9e000)
[  172.783036] Stack: f8d6cb60 f6e9fe4c f8d525e0  f68ad298 f68ad2b4 
f6e9fe68 f89288ce
[  172.783036]f8d6ca40 f6962f48 f68ad38c f68ad2b4 f8d6ca8c f6e9fe7c 
c0292f9c f68ad2b4
[  172.783036]f68ad3d0 f893dc60 f6e9fe8c c02930b3 f68ad350 f68ad2b4 
f6e9fea0 c02925c5
[  172.783036] Call Trace:
[  172.783036]  [f8d525e0] ? em28xx_usb_disconnect+0xd0/0x190 [em28xx]
[  172.783036]  [f89288ce] ? usb_unbind_interface+0x4e/0xf0 [usbcore]
[  172.783036]  [c0292f9c] ? __device_release_driver+0x7c/0xc0
[  172.783036]  [c02930b3] ? device_release_driver+0x23/0x40
[  172.783036]  [c02925c5] ? bus_remove_device+0x95/0xc0
[  172.783036]  [c0290de8] ? device_del+0x108/0x180
[  172.783036]  [f8925c14] ? usb_disable_device+0x84/0x100 [usbcore]
[  172.783036]  [f89212c0] ? 

[Em28xx] [PATCH] correct small typo in comment

2008-11-07 Thread Németh Márton
Correct small typo in em28xx_usb_disconnect() comment.
diff -r d59c8a104ac7 em28xx-video.c
--- a/em28xx-video.c	Sat Nov 08 06:38:58 2008 +0100
+++ b/em28xx-video.c	Sat Nov 08 08:46:22 2008 +0100
@@ -4082,7 +4082,7 @@
 
 /*
  * em28xx_usb_disconnect()
- * called when the device gets diconencted
+ * called when the device gets disconencted
  * video device will be unregistered on v4l2_close in case it is still open
  */
 static void em28xx_usb_disconnect(struct usb_interface *interface)
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


[Em28xx] [PATCH] more useful em28xx debug message

2008-03-16 Thread Németh Márton
From: Márton Németh [EMAIL PROTECTED]

Make one of the debug messages in em2880-dvb.c more useful.

Signed-off-by: Márton Németh [EMAIL PROTECTED]
---
diff -upr v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c 
../v4l/v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c
--- v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c
2008-03-16 17:14:11.0 +0100
+++ ../v4l/v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c 
2008-03-16 13:58:35.0 +0100
@@ -108,7 +108,7 @@ static void em2880_complete_irq(struct u

dvb_dmx_swfilter(dvb_dev-demux,urb-transfer_buffer,urb-actual_length);
for (i = 0; i  urb-number_of_packets; i++) {
if(urb-iso_frame_desc[i].status!=0){
-   dprintk(1,em2880-dvb.c: status != 0\n);
+   dprintk(1,em2880-dvb.c: iso_frame_desc[%i].status = 
%i\n, i, urb-iso_frame_desc[i].status);
continue;
} else if(urb-iso_frame_desc[i].actual_length0){
dvb_dmx_swfilter(dvb_dev-demux,urb-transfer_buffer + 
urb-iso_frame_desc[i].offset, urb-iso_frame_desc[i]
diff -upr v4l-dvb-kernel.orig/linux/drivers/media/video/em28xx/em2880-dvb.c v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c
--- v4l-dvb-kernel.orig/linux/drivers/media/video/em28xx/em2880-dvb.c	2008-03-11 18:15:50.0 +0100
+++ v4l-dvb-kernel/linux/drivers/media/video/em28xx/em2880-dvb.c	2008-03-16 17:56:55.0 +0100
@@ -98,7 +98,7 @@ static void em2880_complete_irq(struct u
 		dvb_dmx_swfilter(dvb_dev-demux,urb-transfer_buffer,urb-actual_length);
 	for (i = 0; i  urb-number_of_packets; i++) {
 		if(urb-iso_frame_desc[i].status!=0){
-			dprintk(1,em2880-dvb.c: status != 0\n);
+			dprintk(1,em2880-dvb.c: iso_frame_desc[%i].status = %i\n, i, urb-iso_frame_desc[i].status);
 			continue;
 		} else if(urb-iso_frame_desc[i].actual_length0){
 			dvb_dmx_swfilter(dvb_dev-demux,urb-transfer_buffer + urb-iso_frame_desc[i].offset, urb-iso_frame_desc[i]
___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] [PATCH] add minimal error handling for em28xx

2008-03-16 Thread Németh Márton
Markus Rechberger wrote:
 Hi Márton,
 
 On 3/16/08, Németh Márton [EMAIL PROTECTED] wrote:
 From: Márton Németh

 The mutex_lock_interruptible() checks for -ESHUTDOWN, this is the case when
 the device is already disconnected.

 The return value of mutex_lock_interruptible() should always be checked for
 errors because the mutex is locked only if there was no error.

 Every call of em28xx_read_reg(), em28xx_write_regs_req(),
 em28xx_write_regs()
 and em28xx_write_reg_bits() can fail because of several reasons (i.e. out of
 memory, device disconnected). Take the return values of these functions and
 return immediately.

 
 thanks for the patch, although the v4l-dvb-experimental/kernel tree
 has been stopped from my side. There's alot new code in
 em28xx-userspace2 and userspace-drivers, older code is still getting
 moved from the old repository to the new one too.
 It would be nice if you could apply your patch against
 http://mcentral.de/hg/~mrec/em28xx-userspace2
 
 I'd happily apply it against that tree.

How do I get that repository to my computer? Is there any documentation
how to do this?

The command

hg clone http://mcentral.de/hg/~mrec/em28xx-userspace2/


only gets some files, but no subdirectories. README mentions a lot of
subdirectories, so I guess I should do something different.

Márton Németh



___
Em28xx mailing list
Em28xx@mcentral.de
http://mcentral.de/mailman/listinfo/em28xx


Re: [Em28xx] em28xx analogue devices

2008-01-14 Thread Németh Márton
Hi Markus,

I have a Pinnacle Hybrid Pro Stick (320e) (USB ID=eb1a:2881). This
is working properly with the digital broadcast but I have problem
with the sound in case of the analog broadcast.

The sound is recognizable, but is very noisy.

I investigated the problem a little bit and I found the followings:

Endpoint | Alternate | Packet Size | tSamFreq
Addr.| No.   | [byte]  | [Hz]
-+---+-+--
83   | 0 | 0   | 0
83   | 1 | 196 | 48000
83   | 2 | 180 | 44100
83   | 3 | 132 | 32000
83   | 4 | 68  | 1600
83   | 5 | 36  | 8000

I guess that 2 bytes are transfered for one sample. Stereo sound is
transfered, and the packets are sent each 1ms. In case
tSamFreq=48000Hz means that there is 48000 sample in a second, so
there are 48 samples in 1ms. The packet size would be 48*2*2 = 192.
However, the packet size is 192+4 = 196. I guess that each packet
contains some kind of a 4 byte header, but I don't know the purpose.
In the USB Audio specification there is similar header bytes defined
in the ISO transfer.

Endpoint | Alternate | Max. Packet | tSamFreq | Packet Data
Addr.| No.   | Size [byte] | [Hz] | Size [byte]
-+---+-+--+-
83   | 0 | 0   | 0| 0
83   | 1 | 196 | 48000| 48*2*2=192
83   | 2 | 180 | 44100|?44.1*2*2=176.4?
83   | 3 | 132 | 32000| 32*2*2=128
83   | 4 | 68  | 16000| 16*2*2=64
83   | 5 | 36  | 8000 | 8*2*2=32

So there are 4 more bytes in most cases.

I used Wireshark ( http://www.wireshark.org/ ) to analyze the USB
URBs. I modified the usbmon feature of the Linux kernel a little
bit to get all the data I needed, and I created a so called dissector
which tries to analyze the USB Audio class USB URBs.
(See http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2081 ).

The other problem I found with analogue video was that I connected
a Video Casette Recorder to the my Pinnacle Hybrid Pro stick and in
case there was only a blue screen generated by the VCR, the
tvtime was frozen: no pictures were transfered from the kernel.
When I slowly unplugged the signal cable, the signal become noisier,
and tvtime started to show the noisy frames. In case there was
normal frames, tvtime could also show them properly.

If you need more information, I'll try to provide it for you.

Best regards,

Márton Németh

Markus Rechberger wrote:
 Hi guys,
 
 if there's anyone out there with a non PAL-BG standard and who has
 some problems let me know I currently rework some analogue standards
 since I've got a signal generator for NTSC/PAL/SECAM now. Digital
 standards will come right after I'm done with analogue stuff.
 
 As for february I took off 2 weeks (holiday) for fixing up the rest of
 the driver, I will have access to digital TV signal generators then
 (ATSC and DVB-T, as well as currently non supported digital standards)
 
 till february I'll focus on analogue devices (which also includes
 S-VIDEO, SCART)
 
 Markus

USB 2881 Video
Speed: 480Mb/s (high)
USB Version:  2.00
Device Class: 00(ifc )
Device Subclass: 00
Device Protocol: 00
Maximum Default Endpoint Size: 64
Number of Configurations: 1
Vendor Id: eb1a
Product Id: 2881
Revision Number:  1.00

Config Number: 1
Number of Interfaces: 3
Attributes: a0
MaxPower Needed: 500mA

Interface Number: 0
Name: (none)
Alternate Number: 0
Class: ff(vend.) 
Sub Class: 0
Protocol: 0
Number of Endpoints: 3

Endpoint Address: 81
Direction: in
Attribute: 3
Type: Int.
Max Packet Size: 1
Interval: 128ms

Endpoint Address: 82
Direction: in
Attribute: 1
Type: Isoc
Max Packet Size: 0
Interval: 125us

Endpoint Address: 84
Direction: in
Attribute: 1
Type: Isoc
Max Packet Size: 0
Interval: 125us

Interface Number: 0
Name: (none)
Alternate Number: 1
Class: ff(vend.) 
Sub Class: 0
Protocol: 0
Number of Endpoints: 3

Endpoint Address: 81
Direction: in
Attribute: 3
Type: Int.
Max Packet Size: 1
Interval: 128ms