Re: [PATCH 3/4] Wrap LFS64 functions only if __GLIBC__

2015-05-06 Thread Hans Petter Selasky

On 05/05/15 14:34, Mauro Carvalho Chehab wrote:

I'm afraid that removing the above would break for FreeBSD, as I think
it also uses glibc, but not 100% sure.

So, either we should get an ack from Hans Peter, or you should
change the tests to:

#if linux  __GLIBC__


Hi,

Linux might be defined when compiling webcamd. The following should be fine:

-#ifdef linux
+#if defined(linux)  defined(__GLIBC__)

Thank you!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Time for a v4l-utils 1.8.0 release

2015-05-05 Thread Hans Petter Selasky

On 05/06/15 04:07, Laurent Pinchart wrote:

Hi Mauro,

On Tuesday 05 May 2015 17:22:35 Mauro Carvalho Chehab wrote:

Em Tue, 05 May 2015 21:08:49 +0200 Gregor Jasny escreveu:

Hello,

It's already more than half a year since the last v4l-utils release. Do
you have any pending commits or objections? If no one vetos I'd like to
release this weekend.


There is are a additions I'd like to add to v4l-utils:

1) on DVB, ioctls may fail with -EAGAIN. Some parts of the libdvbv5 don't
handle it well. I made one quick hack for it, but didn't have time to
add a timeout to avoid an endless loop. The patch is simple. I just need
some time to do that;

2) The Media Controller control util (media-ctl) doesn't support DVB.

The patchset adding DVB support on media-ctl is ready, and I'm merging
right now, and matches what's there at Kernel version 4.1-rc1 and upper.

Yet, Laurent and Sakari want to do some changes at the Kernel API, before
setting it into a stone at Kernel v 4.1 release.


I think Hans wants changes too.


This has to happen on the next 4 weeks.


We'll try to, but depending on how review goes this might take more time.

In the meantime I suggest moving the media-ctl changes to a separate branch
and go with the v1.8.0 release as planned.


So, I suggest to postpone the release of 1.8.0 until the end of this month.




Hi,

Maybe someone would like to give the v4l-utils a spin on FreeBSD before 
release? Or is this the latest code in the .git ?


--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[APP-BUG] UVC camera not working with skype

2014-02-23 Thread Hans Petter Selasky

Hi,

I have debugged why a USB video class camera doesn't work with skype.

Skype finds the device and opens /dev/video0.

Skype tries to enumerate the device, but apparently does not care about 
the return value from the VIDIOC_ENUM_FRAMEINTERVALS. It finds the 
correct resolution and so on, but I suspect the FPS value is not 
matching what it expects.


drivers/media/usb/uvc/uvc_v4l2.c:

case VIDIOC_ENUM_FRAMEINTERVALS:
{

struct v4l2_frmivalenum *fival = arg;

if (frame-bFrameIntervalType) {
if (fival-index = frame-bFrameIntervalType)
return -EINVAL;// CPU goes here

fival-type = V4L2_FRMIVAL_TYPE_DISCRETE;
fival-discrete.numerator =

I see fival-index goes far beyond frame-bFrameIntervalType leading 
me to believe that skype tries to search for a specific setting, and if 
it doesn't find that it simply while's one.


Using another UVC based camera with skype works fine. I've attached the 
USB descriptor dump for the non-working USB camera.


I can test suggestions and patches.

Solution:

Possibly the UVC driver should provide some standard settings regardless 
of what the USB descriptors say. Might also be task for libv4l, Hans CC'ed.


Thank you!

--HPS

Bus /dev/usb Device /dev/ugen7.6: ID 041e:4058 Creative Technology, Ltd Live! 
Cam Optia AF
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass  239 Miscellaneous Device
  bDeviceSubClass 2 ?
  bDeviceProtocol 1 Interface Association
  bMaxPacketSize064
  idVendor   0x041e Creative Technology, Ltd
  idProduct  0x4058 Live! Cam Optia AF
  bcdDevice1.00
  iManufacturer   1 Creative Labs
  iProduct0 
  iSerial 0 
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 1073
bNumInterfaces  4
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Association:
  bLength 8
  bDescriptorType11
  bFirstInterface 0
  bInterfaceCount 2
  bFunctionClass 14 Video
  bFunctionSubClass   3 Video Interface Collection
  bFunctionProtocol   0 
  iFunction   0 
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass14 Video
  bInterfaceSubClass  1 Video Control
  bInterfaceProtocol  0 
  iInterface  0 
  VideoControl Interface Descriptor:
bLength13
bDescriptorType36
bDescriptorSubtype  1 (HEADER)
bcdUVC   1.00
wTotalLength   78
dwClockFrequency   48.00MHz
bInCollection   1
baInterfaceNr( 0)   1
  VideoControl Interface Descriptor:
bLength18
bDescriptorType36
bDescriptorSubtype  2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType  0x0201 Camera Sensor
bAssocTerminal  0
iTerminal   0 
wObjectiveFocalLengthMin  0
wObjectiveFocalLengthMax  0
wOcularFocalLength0
bControlSize  3
bmControls   0x0006002a
  Auto-Exposure Mode
  Exposure Time (Absolute)
  Focus (Absolute)
  Focus, Auto
  Privacy
  VideoControl Interface Descriptor:
bLength11
bDescriptorType36
bDescriptorSubtype  5 (PROCESSING_UNIT)
  Warning: Descriptor too short
bUnitID 2
bSourceID   1
wMaxMultiplier  0
bControlSize2
bmControls 0x157f
  Brightness
  Contrast
  Hue
  Saturation
  Sharpness
  Gamma
  White Balance Temperature
  Backlight Compensation
  Power Line Frequency
  White Balance Temperature, Auto
iProcessing 0 
bmVideoStandards 0x 9
  None
  SECAM - 625/50
  VideoControl Interface Descriptor:
bLength 9
bDescriptorType36
bDescriptorSubtype  3 (OUTPUT_TERMINAL)
bTerminalID 3
wTerminalType  0x0101 USB Streaming
bAssocTerminal  0
bSourceID   2
iTerminal   0 
  VideoControl Interface Descriptor:
bLength27
  

Re: [APP-BUG] UVC camera not working with skype

2014-02-23 Thread Hans Petter Selasky

On 02/23/14 13:06, Hans Petter Selasky wrote:

Hi,

I have debugged why a USB video class camera doesn't work with skype.

Skype finds the device and opens /dev/video0.


Forgot: Skype v4.2.0.13

--HPS

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [APP-BUG] UVC camera not working with skype

2014-02-23 Thread Hans Petter Selasky

On 02/23/14 14:51, Hans de Goede wrote:

Ugh, if we add special code to libv4l for this the amount of libv4l skype 
specific
fixes is going to become ridiculous (we also fake all cams doing 320x240 for 
skype).
Have you tried contacting skype about this ?


No, do you have an e-mail?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] [PATCH 10/21] radio-tea5764: some cleanups and clamp frequency when out-of-range AND [PATCH 15/21] tef6862: clamp frequency.

2013-10-28 Thread Hans Petter Selasky

On 05/31/13 12:02, Hans Verkuil wrote:

return -EINVAL;
+   }
+   clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);
tea5764_power_up(radio);
-   tea5764_tune(radio, (f-frequency * 125) / 2);
+   tea5764_tune(radio, (freq * 125) / 2);
return 0;


Hi Hans,

Should the part quoted above part perhaps read:

freq = clamp(freq, FREQ_MIN * FREQ_MUL, FREQ_MAX * FREQ_MUL);

Or did #define clamp() change recently?

http://lxr.free-electrons.com/source/include/linux/kernel.h


698 /**
699  * clamp - return a value clamped to a given range with strict typechecking
700  * @val: current value
701  * @min: minimum allowable value
702  * @max: maximum allowable value
703  *
704  * This macro does strict typechecking of min/max to make sure they are of 
the
705  * same type as val.  See the unnecessary pointer comparisons.
706  */
707 #define clamp(val, min, max) ({ \
708 typeof(val) __val = (val);  \
709 typeof(min) __min = (min);  \
710 typeof(max) __max = (max);  \
711 (void) (__val == __min);  \
712 (void) (__val == __max);  \
713 __val = __val  __min ? __min: __val;   \
714 __val  __max ? __max: __val; })


Thank you!

Same spotted in:


media_tree/drivers/media/radio/radio-tea5764.c: In function 
'vidioc_s_frequency':
media_tree/drivers/media/radio/radio-tea5764.c:359: warning: statement with no 
effect



media_tree/drivers/media/radio/tef6862.c: In function 'tef6862_s_frequency':
media_tree/drivers/media/radio/tef6862.c:115: warning: statement with no effect


Keep up the good work!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Hauppauge HVR-900 HD and HVR 930C-HD with si2165

2013-08-20 Thread Hans Petter Selasky

On 08/20/13 00:43, Konstantin Dimitrov wrote:

German-based company making DVB equipment and maybe if that's the same
RSD that Danny Griegs guy could be legit. however, nothing in the


Hi,

I've asked Danny to confirm his identity. The @googlemail.com e-mail 
transcript was quite empty :-(


According to Skype he is located in the GB. That's all I've got.

Hope this matter will resolve soon.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Hauppauge HVR-900 HD and HVR 930C-HD with si2165

2013-08-20 Thread Hans Petter Selasky

On 08/20/13 10:26, nibble.max wrote:

Hello Hans,

I am the original author of sit2 source code based on the reference code from 
silabs.
And we have signed NDA with silabs, it does not allow us to release the source 
code to the public.
I donot know it is permited or not when you do decompiling the binary code.



Thank you Max for clearing this up a bit,

I can tell you that the decompiled driver works like expected with the 
product I bought and lets me use this product under FreeBSD like I was 
expecting after reading the Linux-commercial's from the Vendor.


Maybe an idea for the future. Abstract binaries a bit more so that they 
are independent of the Linux header files and other kernel functions. 
Then I wouldn't have to do the decompile.


The other DVB-T adapter I had before outputted somtimes corrupted or too 
long USB packets on the isochronous endpoint when the bitrate was going 
too high. I do no longer see this problem with the adapter supported by 
Max's driver. And I am satisfied. Regarding you and Konstantin 
Dimitrov I don't want to have any opinion about what product is best.


--HPS

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Hauppauge HVR-900 HD and HVR 930C-HD with si2165

2013-08-19 Thread Hans Petter Selasky

On 08/18/13 21:02, Steven Toth wrote:

FYI: The Si2168 driver is available from dvbsky-linux-3.9-hps-v2.diff
inside. Maybe the Si2165 is similar?


Excellent.



Hi Guys,

I was contacted by someone claiming to be from RSD ??, named Danny 
Griegs, off-list, claiming I have the source code for sit2.c and cannot 
distribute it.


I want to make clear to everyone that the tarball I've provided only 
contains the C-equivalent of the objdump -dx output from the 
media_build-bst/v4l/sit2.o.x86 which is distributed officially by DVBSKY.


He claimed I had to pull the tarball off my site right away or face 
legal actions. I cannot understand this, and would like to ask you guys 
what you think. Obviously my sit2.c is too similar to their licensed 
sit2.c. And now these guys want to send a lawyer after me. What a mess. 
Should I laugh or cry. Any advice from you guys about this?


BTW: The hexdump of the sit2.o.x86 contains the string license=GPL. 
Does that give me any rights to redistribute the re-assembled C-code ?





2460  63 28 29 20 66 61 69 6c  65 64 0a 00 01 36 73 69  |c() failed...6si|
2470  74 32 3a 20 25 73 2c 20  70 6f 77 65 72 20 75 70  |t2: %s, power up|
2480  0a 00 01 36 73 69 74 32  3a 20 25 73 2c 20 70 6f  |...6sit2: %s, po|
2490  77 65 72 20 75 70 5b 25  64 5d 0a 00 76 65 72 73  |wer up[%d]..vers|
24a0  69 6f 6e 3d 31 2e 30 30  00 6c 69 63 65 6e 73 65  |ion=1.00.license|
24b0  3d 47 50 4c 00 61 75 74  68 6f 72 3d 4d 61 78 20  |=GPL.author=Max |
24c0  4e 69 62 62 6c 65 20 3c  6e 69 62 62 6c 65 2e 6d  |Nibble nibble.m|
24d0  61 78 40 67 6d 61 69 6c  2e 63 6f 6d 3e 00 64 65  |a...@gmail.com.de|
24e0  73 63 72 69 70 74 69 6f  6e 3d 73 69 74 32 20 64  |scription=sit2 d|
24f0  65 6d 6f 64 75 6c 61 74  6f 72 20 64 72 69 76 65  |emodulator drive|
2500  72 00 70 61 72 6d 3d 73  69 74 32 5f 64 65 62 75  |r.parm=sit2_debu|
2510  67 3a 41 63 74 69 76 61  74 65 73 20 66 72 6f 6e  |g:Activates fron|
2520  74 65 6e 64 20 64 65 62  75 67 67 69 6e 67 20 28  |tend debugging (|
2530  64 65 66 61 75 6c 74 3a  30 29 00 70 61 72 6d 74  |default:0).parmt|
2540  79 70 65 3d 73 69 74 32  5f 64 65 62 75 67 3a 69  |ype=sit2_debug:i|


Thank you.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Hauppauge HVR-900 HD and HVR 930C-HD with si2165

2013-08-18 Thread Hans Petter Selasky

On 08/17/13 13:53, Antti Palosaari wrote:

On 08/17/2013 02:30 PM, Ulf wrote:

Hi,

I know the topic Hauppauge HVR-900 HD and HVR 930C-HD with si2165
demodulator was already discussed
http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/40982
and
http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/46266.

Just for me as a confirmation nobody plans to work on a driver for
si2165.
Is there any chance how to push the development?


comment mode
http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/46266


As far as I know there is none working with si2165 Linux driver.

Last week I dumped out simple sniff from initial tuning to DVB-T channel
and parsed log - it was 1.1 MB after parsing - wow. I haven't analyzed
if it yet, but if it appears it is si2165 which generates that much
control I/O it could be big task to write driver.

Anyone has the idea if that amount of USB I/O traffic is caused by
cx231xx ?

regards
Antti



Hi,

FYI: The Si2168 driver is available from dvbsky-linux-3.9-hps-v2.diff 
inside. Maybe the Si2165 is similar?


http://www.selasky.org/hans_petter/distfiles/webcamd-3.10.0.7.tar.bz2

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Hauppauge HVR-900 HD and HVR 930C-HD with si2165

2013-08-18 Thread Hans Petter Selasky

On 08/18/13 17:00, Ulf wrote:

Hi,


It is DVB-S driver. HVR-900 is DVB-T and DVB-C.

The si2168 is a DVB-T2, DVB-T, and DVB-C demodulator 
http://www.silabs.com/Support%20Documents/TechnicalDocs/Si2168-A20-short.pdf.

I tried to apply the dvbsky-linux-3.9-hps-v2.diff to media_build.git (used 
do_patches.sh from 
http://www.selasky.org/hans_petter/distfiles/webcamd-3.10.0.7.tar.bz2), but I 
was not able to compile it. I already changed some includes, but then I got the 
next error.
I just wanted to test if the si2168 module will work with si2165, but as I 
don't expect it to work I stopped trying to compile the si2168.


Hi,

You need to replace the media_tree with a symbolic link to a real 
media_tree. Then it will work! The sources provided with webcamd are 
simply minimal.


There is a file called sources.txt:

Media tree sources used:


git clone git://linuxtv.org/media_tree.git
git checkout remotes/origin/master

top commit dfb9f94e8e5e7f73c8e2bcb7d4fb1de57e7c333d


Else you could install FreeBSD in VirtualBox or something like that and 
test.


Package is here:

http://www.freshports.org/multimedia/webcamd/

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: TT-USB2.0 and high bitrate packet loss (DVB-C/T)

2013-06-02 Thread Hans Petter Selasky

On 05/30/13 10:00, Hans Petter Selasky wrote:

Hi there,

I need to get in concat with someone that can handle, test and review a
patch for TT-USB2.0. I've found that for certain high-bitrate streams,
the TT-USB2.0 sends more ISOCHRONOUS MPEG data than is specified in the
wMaxPacketSize fields. I have a USB analyzer capture which shows this
clearly. This of course won't be received at the USB host and packet
drops appear inside the stream. The solution is to use another alternate
setting. The technotrend chip has many of these. I've now tested using
alternate setting 7 instead of 3.

Alternate setting 7 allows transferring a maximum of 3 * 1024 bytes.
Alternate setting 3 allows transferring a maximum of 1 * 940 bytes.

--HPS


Hi,

It turns out that this device, at least the version I bought, does not 
work with the XHCI at all when using multi-packet transfers, alternate 
setting 7, because DATA2 PID is used when transfer is less than 1024 
bytes. It should be DATA0 PID first, then 1 and 2 in the end. Probably a 
firmware update can fix this, but I'm not aware about if such exists. 
The PID issue was found using a USB analyzer.


Apparently this bug has gone undetected, because at least the EHCI high 
speed only controller I've got silently ignores this kind of errors and 
receives the data whilst the XHCI not. Conclusion:

Existing alternate setting must be used.

I think I will have to get another USB based receiver with CI slot. Any 
recommendations for DVB-T ?


--HPS

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


TT-USB2.0 and high bitrate packet loss (DVB-C/T)

2013-05-30 Thread Hans Petter Selasky

Hi there,

I need to get in concat with someone that can handle, test and review a 
patch for TT-USB2.0. I've found that for certain high-bitrate streams, 
the TT-USB2.0 sends more ISOCHRONOUS MPEG data than is specified in the 
wMaxPacketSize fields. I have a USB analyzer capture which shows this 
clearly. This of course won't be received at the USB host and packet 
drops appear inside the stream. The solution is to use another alternate 
setting. The technotrend chip has many of these. I've now tested using 
alternate setting 7 instead of 3.


Alternate setting 7 allows transferring a maximum of 3 * 1024 bytes.
Alternate setting 3 allows transferring a maximum of 1 * 940 bytes.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Correctly set data for USB request in case of a previous failure.

2013-02-05 Thread Hans Petter Selasky
On Wednesday 06 February 2013 00:23:08 Mauro Carvalho Chehab wrote:
 Em Mon, 14 Jan 2013 16:06:20 +0100
 
 Hans Petter Selasky hsela...@c2i.net escreveu:
  Improved patch follows:
 It would be even more improved if you send it to the right ML ;)
 
 I suspect that your original intention were to send it to
 linux-input ML, instead of linux-media :)

Ok, will do. Thanks!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Correctly set data for USB request in case of a previous failure.

2013-01-14 Thread Hans Petter Selasky
From 89326793e2429dc55d951f336b3e3e3b73bedb95 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 14 Jan 2013 13:53:21 +0100
Subject: [PATCH] Correctly set data for USB request in case of a previous
 failure.

Found-by: Jan Beich
Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/input/tablet/wacom_sys.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index f92d34f..aaf23ae 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -553,10 +553,10 @@ static int wacom_set_device_mode(struct usb_interface 
*intf, int report_id, int
if (!rep_data)
return error;
 
-   rep_data[0] = report_id;
-   rep_data[1] = mode;
-
do {
+   rep_data[0] = report_id;
+   rep_data[1] = mode;
+
error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
 report_id, rep_data, length, 1);
if (error = 0)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Correctly set data for USB request in case of a previous failure.

2013-01-14 Thread Hans Petter Selasky
Improved patch follows:

--HPS

From a88d72d2108f92f004a3f050a708d9b7f661f924 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 14 Jan 2013 13:53:21 +0100
Subject: [PATCH] Correctly initialize data for USB request.

Found-by: Jan Beich
Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/input/tablet/wacom.h | 1 +
 drivers/input/tablet/wacom_sys.c | 8 +---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index b79d451..d6fad87 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -89,6 +89,7 @@
 #include linux/init.h
 #include linux/usb/input.h
 #include linux/power_supply.h
+#include linux/string.h
 #include asm/unaligned.h
 
 /*
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index f92d34f..23bc71e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -553,10 +553,12 @@ static int wacom_set_device_mode(struct usb_interface 
*intf, int report_id, int
if (!rep_data)
return error;
 
-   rep_data[0] = report_id;
-   rep_data[1] = mode;
-
do {
+   memset(rep_data, 0, length);
+
+   rep_data[0] = report_id;
+   rep_data[1] = mode;
+
error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT,
 report_id, rep_data, length, 1);
if (error = 0)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add toggle to the tt3650_rc_query function of the ttusb2 driver

2012-10-03 Thread Hans Petter Selasky
On Tuesday 02 October 2012 21:52:11 Hans Petter Selasky wrote:
 On Saturday 08 September 2012 19:08:22 Jose Alberto Reguero wrote:
  This patch add the toggle bit to the tt3650_rc_query function of the
  ttusb2 driver.
  
  Signed-off-by: Jose Alberto Reguero jaregu...@telefonica.net
  
  Jose Alberto
 
 Hi,
 
 This patch looks OK.
 

Hi,

 Regarding the TTUSB2 support, I see an issue where the IR polling
 interference with the CAM access. If a IR poll request happens exactly
 between a write/read CAM request, then that CAM request will fail. How can
 this issue be solved without disabling the IR support entirely?

I checked the code and see that dvb_usb_generic_rw() will synchronize the 
requests, so this can't be the root cause. Currently I suspect the not brand 
new AMD based EHCI controller I'm using to connect my TTUSB adapter to be at 
fault. This is FreeBSD, not Linux. What I see when I dump all the transactions 
is that I have quite frequent timeouts on some of the I2C/CAM and IR commands 
going on the BULK endpoints. For example grepp'ed log extract looks like this:

   55 3B 42 02 00 A0 01 DF  00 00 00 00 00 FB F5 81  |U;B.|
   AA 3C 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.B...  |
   55 3C 42 02 00 01 01 DF  00 00 00 00 00 FB F5 81  |UB.|
   AA 3D 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.=B...  |
18:46:16.972329 usbus1.3 DONE-BULK-
EP=0081,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
   AA 3E 31 04 11 01 01 1A  -- -- -- -- -- -- -- --  |.1.|
   55 3E 31 04 10 01 01 DF  00 00 00 00 00 FB F5 81  |U1.|
   AA 3D 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.=B...  |
   55 3D 42 02 00 01 01 DF  00 00 00 00 00 FB F5 81  |U=B.|
   AA 40 41 01 01 -- -- --  -- -- -- -- -- -- -- --  |.@A..   |

I'm now trying some EHCI quirks, and will see what results I get later this 
week.

I can also say that VDR receives a ring buffer overflow at exactly the same 
time the USB BULK endpoint timeout happens 

If this sounds familar to anyone, please let me know.

Thank you,

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add toggle to the tt3650_rc_query function of the ttusb2 driver

2012-10-03 Thread Hans Petter Selasky
On Wednesday 03 October 2012 20:57:07 Hans Petter Selasky wrote:
 On Tuesday 02 October 2012 21:52:11 Hans Petter Selasky wrote:
  On Saturday 08 September 2012 19:08:22 Jose Alberto Reguero wrote:
   This patch add the toggle bit to the tt3650_rc_query function of the
   ttusb2 driver.
   
   Signed-off-by: Jose Alberto Reguero jaregu...@telefonica.net
   
   Jose Alberto
  
  Hi,
  
  This patch looks OK.
 
 Hi,
 
  Regarding the TTUSB2 support, I see an issue where the IR polling
  interference with the CAM access. If a IR poll request happens exactly
  between a write/read CAM request, then that CAM request will fail. How
  can this issue be solved without disabling the IR support entirely?
 
 I checked the code and see that dvb_usb_generic_rw() will synchronize the
 requests, so this can't be the root cause. Currently I suspect the not
 brand new AMD based EHCI controller I'm using to connect my TTUSB adapter
 to be at fault. This is FreeBSD, not Linux. What I see when I dump all the
 transactions is that I have quite frequent timeouts on some of the I2C/CAM
 and IR commands going on the BULK endpoints. For example grepp'ed log
 extract looks like this:
 
    55 3B 42 02 00 A0 01 DF  00 00 00 00 00 FB F5 81  |U;B.|
    AA 3C 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.B...  |
    55 3C 42 02 00 01 01 DF  00 00 00 00 00 FB F5 81  |UB.|
    AA 3D 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.=B...  |
 18:46:16.972329 usbus1.3 DONE-BULK-
 EP=0081,SPD=HIGH,NFR=0,SLEN=0,IVAL=0,ERR=TIMEOUT
    AA 3E 31 04 11 01 01 1A  -- -- -- -- -- -- -- --  |.1.|
    55 3E 31 04 10 01 01 DF  00 00 00 00 00 FB F5 81  |U1.|
    AA 3D 42 02 00 01 -- --  -- -- -- -- -- -- -- --  |.=B...  |
    55 3D 42 02 00 01 01 DF  00 00 00 00 00 FB F5 81  |U=B.|
    AA 40 41 01 01 -- -- --  -- -- -- -- -- -- -- --  |.@A..   |
 
 I'm now trying some EHCI quirks, and will see what results I get later this
 week.
 
 I can also say that VDR receives a ring buffer overflow at exactly the same
 time the USB BULK endpoint timeout happens 
 
 If this sounds familar to anyone, please let me know.
 
 Thank you,
 
 --HPS

More info if anyone cares to look at it:

vdr: [680141312] ERROR: can't write to CI adapter on device 0: Device not 
configured
vdr: [680142848] ERROR: 7 ring buffer overflows (1316 bytes dropped)
vdr: [680141312] CAM 1: module present
vdr: [680141312] CAM 1: module ready
vdr: [680141312] CAM 1: Conax Conditional Access, 01, 0B00, 0001
vdr: [680141312] CAM 1: doesn't reply to QUERY - only a single channel can be 
decrypted
vdr: [680141312] ERROR: can't write to CI adapter on device 0: Device not 
configured
vdr: [680142848] ERROR: 11 ring buffer overflows (2068 bytes dropped)
vdr: [680141312] CAM 1: module present
vdr: [680141312] CAM 1: module ready
vdr: [680141312] CAM 1: Conax Conditional Access, 01, 0B00, 0001
vdr: [680141312] CAM 1: doesn't reply to QUERY - only a single channel can be 
decrypted

Happens regularly, interrupts the stream and is very annoying :-)

--HPS

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Add toggle to the tt3650_rc_query function of the ttusb2 driver

2012-10-02 Thread Hans Petter Selasky
On Saturday 08 September 2012 19:08:22 Jose Alberto Reguero wrote:
 This patch add the toggle bit to the tt3650_rc_query function of the ttusb2
 driver.
 
 Signed-off-by: Jose Alberto Reguero jaregu...@telefonica.net
 
 Jose Alberto

Hi,

This patch looks OK.

Regarding the TTUSB2 support, I see an issue where the IR polling interference 
with the CAM access. If a IR poll request happens exactly between a write/read 
CAM request, then that CAM request will fail. How can this issue be solved 
without disabling the IR support entirely?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Strong pairing cam doesn't work with CT-3650 driver (ttusb2)

2012-09-15 Thread Hans Petter Selasky
On Friday 17 August 2012 22:59:21 Antti Palosaari wrote:
 On 08/17/2012 10:35 PM, Hans Petter Selasky wrote:
  Hi,
  
  Have anyone out there tested the CT-3650 USB driver in the Linux kernel
  with a strong pairing cam.
 
 Likely that means CI+ with some pairing features enabled.
 
  According to some web-forums, the hardware should support that given
  using the vendor provided DVB WinXXX software.
  
  drivers/media/dvb/dvb-usb/ttusb2.c
  
  Any clues how to debug or what can be wrong?
 
 Take USB traffic capture from working Windows setup and analyze what is
 done differently.
 

Just forget this thread. The CAM was broken. Works now.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH, RFC] Fix DVB ioctls failing if frontend open/closed too fast

2012-08-28 Thread Hans Petter Selasky
On Sunday 12 August 2012 05:06:49 Devin Heitmueller wrote:
 On Sat, Aug 11, 2012 at 10:15 PM, Mauro Carvalho Chehab
 
 mche...@redhat.com wrote:
  Devin/Antti,
  
  As Juergen mentioned your help on this patch, do you mind helping
  reviewing and testing it?
 
 I guided Juergen through the creation of the patch via #linuxtv a
 couple of weeks ago.  While I'm generally confident that it should
 work (and it does address his basic issue), I hadn't had the time to
 stare at the code long enough to see what other side effects it might
 produce.
 
 I'm tied up in other projects right now and am not confident I will
 have cycles to look at this closer.  Antti, if you want to give it
 some cycles, this would be a good fix to get upstream (and you've
 already been looking at dvb_frontend.c for quite a while, so I believe
 you would be able to spot a problem if one exists).
 
 Devin

Hi,

What is the status of this PATCH? Submitted or under testing ??

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Strong pairing cam doesn't work with CT-3650 driver (ttusb2)

2012-08-17 Thread Hans Petter Selasky
Hi,

Have anyone out there tested the CT-3650 USB driver in the Linux kernel with a 
strong pairing cam.

According to some web-forums, the hardware should support that given using the 
vendor provided DVB WinXXX software.

drivers/media/dvb/dvb-usb/ttusb2.c

Any clues how to debug or what can be wrong?

When inserting the CAM, VDR says that a CAM is present, but then after a while 
no CAM is present.

Log:

ttusb2: tt3650_ci_slot_reset 0
ttusb2: tt3650_ci_read_attribute_mem  - 0 0x00
ttusb2: tt3650_ci_read_attribute_mem 0002 - 0 0x00
TUPLE type:0x0 length:0
dvb_ca adapter 0: Invalid PC card inserted :(
dvb_ca_en50221_io_open
dvb_ca_en50221_thread_wakeup
dvb_ca_en50221_io_do_ioctl
dvb_ca_en50221_io_do_ioctl
dvb_ca_en50221_slot_shutdown
ttusb2: tt3650_ci_set_video_port 0 0
Slot 0 shutdown
dvb_ca_en50221_thread_wakeup
dvb_ca_en50221_io_poll
ttusb2: tt3650_ci_slot_reset 0
dvb_ca_en50221_io_do_ioctl
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
dvb_ca_en50221_io_poll
ttusb2: tt3650_ci_read_attribute_mem  - 0 0x1d
ttusb2: tt3650_ci_read_attribute_mem 0002 - 0 0x04
TUPLE type:0x1d length:4
ttusb2: tt3650_ci_read_attribute_mem 0004 - 0 0x00
  0x00: 0x00 .
ttusb2: tt3650_ci_read_attribute_mem 0006 - 0 0xdb
  0x01: 0xdb .
ttusb2: tt3650_ci_read_attribute_mem 0008 - 0 0x08
  0x02: 0x08 .
ttusb2: tt3650_ci_read_attribute_mem 000a - 0 0xff
  0x03: 0xff .
dvb_ca adapter 0: Invalid PC card inserted :(
dvb_ca_en50221_io_do_ioctl

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Add missing else case.

2012-08-03 Thread Hans Petter Selasky
From 59306435992d9349f10ad82a8adf14d98becbbe8 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Fri, 3 Aug 2012 08:34:05 +0200
Subject: [PATCH] Add missing else case.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/common/tuners/tuner-xc2028.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/common/tuners/tuner-xc2028.c 
b/drivers/media/common/tuners/tuner-xc2028.c
index ea0550e..49e63ec 100644
--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -1414,8 +1414,8 @@ static int xc2028_set_config(struct dvb_frontend *fe, 
void *priv_cfg)
tuner_err(Failed to request firmware %s\n,
  priv-fname);
priv-state = XC2028_NODEV;
-   }
-   priv-state = XC2028_WAITING_FIRMWARE;
+   } else
+   priv-state = XC2028_WAITING_FIRMWARE;
}
mutex_unlock(priv-lock);
 
-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about V4L2_MEMORY_USERPTR

2012-07-02 Thread Hans Petter Selasky
Hi Laurent and Sakari,

For the sake of the matter, here is the driver in question:
http://www.freshports.org/multimedia/webcamd/

Under native-Linux (kernel mode):

I've looked at the linux-media code a bit and it appears that video data is 
copied directly from the USB callback functions to the destination process in 
userspace. This works because the userspace buffer is mapped into kernel 
memory it appears. Correct me if I'm wrong:

video/videobuf-core.c:

err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);

Under FreeBSD where the Linux kernel code is running in user-space as a driver 
daemon, this part cannot be done exactly like this, so I've just patched out 
the V4L2_MEMORY_USERPTR feature until further.

Am I clear?

--HPS

On Monday 02 July 2012 11:24:15 Laurent Pinchart wrote:
 On Sunday 01 July 2012 17:00:58 Sakari Ailus wrote:
  On Fri, Mar 23, 2012 at 08:19:45AM +0100, Hans Petter Selasky wrote:
   Hi,
   
   I have a question about V4L2_MEMORY_USERPTR:
   
   From which context are the kernel's copy_to_user() functions called
   in relation to V4L2_MEMORY_USERPTR ? Can this be a USB callback
   function or is it only syscalls, like read/write/ioctl that are
   allowed to call copy_to_user() ?
   
   The reason for asking is that I am maintaining a userland port of the
   media tree's USB drivers for FreeBSD. At the present moment it is not
   allowed to call copy_to_user() or copy_from_user() unless the backtrace
   shows a syscall, so the V4L2_MEMORY_USERPTR feature is simply removed
   and disabled. I'm currently thinking how I can enable this feature.
  
  I hope this is still relevant --- I just read your message the first
  time.
  
  I don't know how V4L2 is being used in FreeBSD userland, but the intent
  of copy_to_user() function is to copy the contents of kernel memory to
  somewhere the user space has a mapping to (and the other way around for
  copy_from_user()).
 
 copy_(to|from)_user(), by definition, require a userspace memory context to
 perform the copy operation. They can't be called from interrupt context,
 kernel threads, or any other context where no userspace memory context is
 present.
 
  Are your video buffers allocated by the kernel or not? How is USB
  accessed when you don't have the Linux kernel USB framework around?
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Fix compiler warning.

2012-03-27 Thread Hans Petter Selasky
From 03d309b552e01622a678b2c500f80fe59746ca12 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 27 Mar 2012 17:53:19 +0200
Subject: [PATCH] Fix compiler warning.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/dvb-core/dvb_frontend.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-
core/dvb_frontend.c
index 4555baa..bfdf599 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -146,7 +146,7 @@ static int dtv_get_frontend(struct dvb_frontend *fe,
 
 static bool has_get_frontend(struct dvb_frontend *fe)
 {
-   return fe-ops.get_frontend;
+   return fe-ops.get_frontend != NULL;
 }
 
 /*
-- 
1.7.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[off-topic] Linux-media e-mail problems

2012-03-24 Thread Hans Petter Selasky
Hi,

FYI: I suddenly stopped receiving e-mails from this list last week, March 
16th. Does anyone have an explanation for that?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Question about V4L2_MEMORY_USERPTR

2012-03-23 Thread Hans Petter Selasky
Hi,

I have a question about V4L2_MEMORY_USERPTR:

From which context are the kernel's copy_to_user() functions called in 
relation to V4L2_MEMORY_USERPTR ? Can this be a USB callback function or is it 
only syscalls, like read/write/ioctl that are allowed to call copy_to_user() 
?

The reason for asking is that I am maintaining a userland port of the media 
tree's USB drivers for FreeBSD. At the present moment it is not allowed to 
call copy_to_user() or copy_from_user() unless the backtrace shows a syscall, 
so the V4L2_MEMORY_USERPTR feature is simply removed and disabled. I'm 
currently thinking how I can enable this feature.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL FOR v3.3] uvcvideo divide by 0 fix

2012-03-11 Thread Hans Petter Selasky
On Monday 20 February 2012 12:49:39 Laurent Pinchart wrote:
 Hi Mauro,
 
 The following changes since commit
 b01543dfe67bb1d191998e90d20534dc354de059:
 
   Linux 3.3-rc4 (2012-02-18 15:53:33 -0800)
 
 are available in the git repository at:
   git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-stable
 
 The patch fixes a divide by 0 bug reported by a couple of users already.
 Could you please make sure it gets into v3.3 ?
 
 Laurent Pinchart (1):
   uvcvideo: Avoid division by 0 in timestamp calculation
 
  drivers/media/video/uvc/uvc_video.c |   14 +-
  1 files changed, 9 insertions(+), 5 deletions(-)

Has this patch been pulled back into media_tree.git ?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] divide by zero in uvc_video_clock_update, v3.3-rc4

2012-02-20 Thread Hans Petter Selasky
On Monday 20 February 2012 00:41:51 James Hogan wrote:
 Hi,
 
 I just tried v3.3-rc4 on an Acer Aspire One Happy 2 netbook. I happened
 to open the settings dialog box of kopete, which shows a view of the
 webcam. The kernel switched to a text console with a register dump (see
 below), indicating a divide error in uvc_video_clock_update.
 
 The IP is on 7482, a divide, presumably by %r11 (see objdump output below)
 which is 0 in the register dump. It appears to be the div_u64 in
 uvc_video_clock_update().
 
 I haven't tried any other recent kernel versions.
 
 My asm is rusty and I don't really have any time to look further into it.
 Is this enough to go on?
 
 Thanks
 James

Hi,

This is a known issue which has been fixed by:

http://git.linuxtv.org/pinchartl/uvcvideo.git/commit/5c97eb2eb9c45dad8825de7754ceb33699451978

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Division by zero in UVC driver

2012-02-16 Thread Hans Petter Selasky
On Thursday 16 February 2012 07:30:17 Laurent Pinchart wrote:
 Hi Hans,
 
 On Wednesday 15 February 2012 18:27:29 Hans Petter Selasky wrote:
  Hi,
  
  After getting through the compilation issues regarding the uvc_debugfs, I
  am now facing another problem, which I think is more generic.
  
  The FreeBSD port of the Linux UVC driver, webcamd, gives a division by
  zero inside the UVC driver, because it does not properly check if the
  returned SOF counter is the same like the previous one. This can also
  happen on Linux if the UVC capable device is plugged exactly when the
  EHCI/OHCI/UHCI SOF counter is equal to zero!
 
 It's a know bug (at least to me :-)). Does
 http://git.linuxtv.org/pinchartl/uvcvideo.git/commit/5c97eb2eb9c45dad8825de
 7754ceb33699451978 fix your problem ? I've queued that patch in my tree for
 v3.4.

Your patch works! Thanks!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Make the USB Video Class debug filesystem support compile time optional.

2012-02-15 Thread Hans Petter Selasky
On Tuesday 14 February 2012 22:15:51 Hans Petter Selasky wrote:
 The following patch makes the recently added DEBUGFS for UVC optional.
 
 --HPS
 

Please ignore this patch. It appears that the DEBUGFS can be disabled by 
including the correct debugfs.h header file.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Division by zero in UVC driver

2012-02-15 Thread Hans Petter Selasky
Hi,

After getting through the compilation issues regarding the uvc_debugfs, I am 
now facing another problem, which I think is more generic.

The FreeBSD port of the Linux UVC driver, webcamd, gives a division by zero 
inside the UVC driver, because it does not properly check if the returned SOF 
counter is the same like the previous one. This can also happen on Linux if 
the UVC capable device is plugged exactly when the EHCI/OHCI/UHCI SOF counter 
is equal to zero!

Also please note that the SOF counter will only be updated after the each 
completed ISOCHRONOUS transfer on FreeBSD, due to limitations in LibUSB.

Debug info:

(gdb) list
651 else if (sof  mean + (1024  16))
652 sof -= 2048  16;
653 
654 y = (u64)(y2 - y1) * (u64)sof + (u64)y1 * (u64)x2
655   - (u64)y2 * (u64)x1;
656 y = div_u64(y, x2 - x1);
657 
658 div = div_u64_rem(y, NSEC_PER_SEC, rem);
659 ts.tv_sec = first-host_ts.tv_sec - 1 + div;
660 ts.tv_nsec = first-host_ts.tv_nsec + rem;
(gdb) 

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 80100a3c0 (LWP 100096/webcamd)]
0x005e9337 in div_u64 (rem=71210779720321120, div=0)
at kernel/linux_func.c:1649
1649{
(gdb) bt
#0  0x005e9337 in div_u64 (rem=71210779720321120, div=0)
at kernel/linux_func.c:1649
#1  0x005169f7 in uvc_video_clock_update (stream=0x8010bf500, 
v4l2_buf=0x801138a00, buf=0x801138a00)
at media_tree/drivers/media/video/uvc/uvc_video.c:656
#2  0x005125c3 in uvc_buffer_finish (vb=Variable vb is not 
available.
)
at media_tree/drivers/media/video/uvc/uvc_queue.c:114
#3  0x004ae76a in vb2_dqbuf (q=0x8010bf5b8, b=0x7f1f9d30, 
nonblocking=0 '\0') at media_tree/drivers/media/video/videobuf2-
core.c:1334
#4  0x0051236f in uvc_dequeue_buffer (queue=0x8010bf5b8, 
buf=0x7f1f9d30, nonblocking=0)
at media_tree/drivers/media/video/uvc/uvc_queue.c:193
#5  0x00513c50 in uvc_v4l2_do_ioctl (file=0x80111d418, cmd=3227014673, 
arg=0x7f1f9d30) at media_tree/drivers/media/video/uvc/uvc_v4l2.c:958
#6  0x00444780 in video_usercopy (file=0x80111d418, cmd=3227014673, 
arg=65536, func=0x513050 uvc_v4l2_do_ioctl)
at media_tree/drivers/media/video/v4l2-ioctl.c:2456
#7  0x00443b40 in v4l2_ioctl (filp=0x80111d418, cmd=3227014673, 
arg=65536) at media_tree/drivers/media/video/v4l2-dev.c:339
#8  0x005ea4aa in linux_ioctl (handle=0x80111d400, fflags=0, 
cmd=3227014673, arg=0x1) at kernel/linux_file.c:120
#9  0x005ef01a in v4b_ioctl (cdev=Variable cdev is not available.
) at webcamd.c:261
#10 0x000800a249e6 in cuse_wait_and_process ()

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Make the USB Video Class debug filesystem support compile time optional.

2012-02-14 Thread Hans Petter Selasky
The following patch makes the recently added DEBUGFS for UVC optional.

--HPS

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/uvc/Kconfig  |9 +
 drivers/media/video/uvc/Makefile |5 -
 drivers/media/video/uvc/uvc_driver.c |   12 ++--
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/uvc/Kconfig b/drivers/media/video/uvc/Kconfig
index 6c197da..45e89a9 100644
--- a/drivers/media/video/uvc/Kconfig
+++ b/drivers/media/video/uvc/Kconfig
@@ -7,6 +7,15 @@ config USB_VIDEO_CLASS
 
  For more information see: http://linux-uvc.berlios.de/
 
+config USB_VIDEO_CLASS_DEBUGFS
+   bool UVC debugfs support
+   default y
+   ---help---
+ This option makes the USB Video Class driver build with
+ debugfs support.
+
+ If you are in doubt, say Y.
+
 config USB_VIDEO_CLASS_INPUT_EVDEV
bool UVC input events device support
default y
diff --git a/drivers/media/video/uvc/Makefile b/drivers/media/video/uvc/Makefile
index c26d12f..a152a2a 100644
--- a/drivers/media/video/uvc/Makefile
+++ b/drivers/media/video/uvc/Makefile
@@ -1,5 +1,8 @@
 uvcvideo-objs  := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \
- uvc_status.o uvc_isight.o uvc_debugfs.o
+ uvc_status.o uvc_isight.o
+ifeq ($(CONFIG_USB_VIDEO_CLASS_DEBUGFS),y)
+uvcvideo-objs  += uvc_debugfs.o
+endif
 ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
 uvcvideo-objs  += uvc_entity.o
 endif
diff --git a/drivers/media/video/uvc/uvc_driver.c 
b/drivers/media/video/uvc/uvc_driver.c
index a240d43..291f77b 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1676,7 +1676,9 @@ static void uvc_unregister_video(struct uvc_device *dev)
video_unregister_device(stream-vdev);
stream-vdev = NULL;
 
+#ifdef CONFIG_USB_VIDEO_CLASS_DEBUGFS
uvc_debugfs_cleanup_stream(stream);
+#endif
}
 
/* Decrement the stream count and call uvc_delete explicitly if there
@@ -1702,8 +1704,9 @@ static int uvc_register_video(struct uvc_device *dev,
return ret;
}
 
+#ifdef CONFIG_USB_VIDEO_CLASS_DEBUGFS
uvc_debugfs_init_stream(stream);
-
+#endif
/* Register the device with V4L. */
vdev = video_device_alloc();
if (vdev == NULL) {
@@ -2411,11 +2414,14 @@ static int __init uvc_init(void)
 {
int ret;
 
+#ifdef CONFIG_USB_VIDEO_CLASS_DEBUGFS
uvc_debugfs_init();
-
+#endif
ret = usb_register(uvc_driver.driver);
if (ret  0) {
+#ifdef CONFIG_USB_VIDEO_CLASS_DEBUGFS
uvc_debugfs_cleanup();
+#endif
return ret;
}
 
@@ -2426,7 +2432,9 @@ static int __init uvc_init(void)
 static void __exit uvc_cleanup(void)
 {
usb_deregister(uvc_driver.driver);
+#ifdef CONFIG_USB_VIDEO_CLASS_DEBUGFS
uvc_debugfs_cleanup();
+#endif
 }
 
 module_init(uvc_init);
-- 
1.7.6
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Build log] FreeBSD 8-stable for staging/v3.2 branch

2012-01-11 Thread Hans Petter Selasky
Hi,

The following patches are used to make the media tree code compile under 
FreeBSD 8-stable:

http://hselasky.homeunix.org:8192/media_tree_patches_freebsd.txt

Please have a look and see if some of these should be included in the default 
media tree git. Some patches are about renaming functions so that they don't 
overlap existing functions in the Linux kernel.

The build log including warnings is given here:

http://hselasky.homeunix.org:8192/media_tree_build_log_freebsd.txt.gz

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: em28xx_isoc_dvb_max_packetsize for EM2884 (Terratec Cinergy HTC Stick)

2011-12-25 Thread Hans Petter Selasky
On Sunday 25 December 2011 15:04:17 Dennis Sperlich wrote:
 On 25.12.2011 11:52, Mauro Carvalho Chehab wrote:
  On 24-12-2011 19:58, Dennis Sperlich wrote:
  Hi,
  
  I have a Terratec Cinergy HTC Stick an tried the new support for the
  DVB-C part. It works for SD material (at least for free receivable
  stations, I tried afair only QAM64), but did not for HD stations
  (QAM256). I have only access to unencrypted ARD HD, ZDF HD and arte HD
  (via KabelDeutschland). The HD material was just digital artefacts, as
  far as mplayer could decode it. When I did a dumpstream and looked at
  the resulting file size I got something about 1MB/s which seems a
  little too low, because SD was already about 870kB/s. After looking
  around I found a solution in increasing the isoc_dvb_max_packetsize
  from 752 to 940 (multiple of 188). Then an HD stream was about 1.4MB/s
  and looked good. I'm not sure, whether this is the correct fix, but it
  works for me.
  
  If you need more testing pleas tell.
  
  Regards,
  Dennis
  

These numbers should not be hardcoded, but extracted from the USB endpoint 
descriptor!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] vtunerc: virtual DVB device - is it ok to NACK driver because of worrying about possible misusage?

2011-12-03 Thread Hans Petter Selasky
Hi,

Some input from the sideline reading this discussion. As a FreeBSD'er I would 
very much like to see two things happen:

- vtunerc goes into userspace like a client/server daemon pair using CUSE and 
can support _any_ /dev/dvb/adapter, also those created by CUSE itself. That 
means I could potentially use vtunerc in FreeBSD with drivers like cx88:

http://corona.homeunix.net/cx88wiki

- DVB-X solution in Linux gets mmap support to avoid endless copying of data 
between kernel and userspace.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Media tree build log from FreeBSD 8-stable

2011-11-08 Thread Hans Petter Selasky
Hi,

The following link shows the build log of the webcamd port built on FreeBSD 8-
stable. The webcamd port includes many Linux USB [media] device drivers which 
are built like a user-space daemon.

http://hselasky.homeunix.org:8192/medie_tree_build_log_freebsd.txt.gz

I'll try to send this regularly if you are interested.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] dvb/as102 nBox DVB-T dongle

2011-10-14 Thread Hans Petter Selasky
Hi,

Could someone pull the AS102 driver into the media tree?

http://git.linuxtv.org/media_tree.git/tree/HEAD:/drivers/media/dvb

--HPS


On Wednesday 20 July 2011 22:29:41 Piotr Chmura wrote:
 I just bought DVB-T USB dongle for one of polish digital platform. It
 works fine with as102 driver.
 Here is patch adding vendor and product ID to as102 driver taken from
 http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102.
 I tested it with kernel-3.0-rc7-git7 (had to change usb_buffer_alloc()
 to usb_alloc_coherent and usb_buffer_free to usb_free_coherent() ).
 
 patch:
 
 diff -Nur linux/drivers/media/dvb/as102/as102_usb_drv.c
 linux-mine/drivers/media/dvb/as102/as102_usb_drv.c
 --- as102/as102_usb_drv.c2011-07-20 21:37:33.924143297 +0200
 +++ /usr/src/linux/drivers/media/dvb/as102/as102_usb_drv.c2011-07-20
 20:40:21.0 +0200
 @@ -39,6 +39,7 @@
   static struct usb_device_id as102_usb_id_table[] = {
   { USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001)
 }, { USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
 +{ USB_DEVICE(NBOX_USB_VID, NBOX_USB_PID) },
   { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
   { } /* Terminating entry */
   };
 @@ -48,6 +49,7 @@
   static const char *as102_device_names[] = {
   AS102_REFERENCE_DESIGN,
   AS102_PCTV_74E,
 +AS102_NBOX,
   AS102_ELGATO_EYETV_DTT_NAME,
   NULL /* Terminating entry */
   };
 diff -Nur linux/drivers/media/dvb/as102/as102_usb_drv.h
 linux-mine/drivers/media/dvb/as102/as102_usb_drv.h
 --- as102/as102_usb_drv.h2011-07-20 21:37:33.925143297 +0200
 +++ /usr/src/linux/drivers/media/dvb/as102/as102_usb_drv.h2011-07-20
 20:39:46.0 +0200
 @@ -36,6 +36,11 @@
   #define PCTV_74E_USB_VID0x2013
   #define PCTV_74E_USB_PID0x0246
 
 +/* nBox DVB-T Stick */
 +#define AS102_NBOXnBox DVB-T Stick
 +#define NBOX_USB_VID0x0b89
 +#define NBOX_USB_PID0x0007
 +
   /* Elgato: EyeTV DTT Deluxe */
   #define AS102_ELGATO_EYETV_DTT_NAMEElgato EyeTV DTT Deluxe
   #define ELGATO_EYETV_DTT_USB_VID0x0fd9
 
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: recursive locking problem

2011-09-09 Thread Hans Petter Selasky
On Thursday 08 September 2011 18:34:32 Antti Palosaari wrote:
 lock() + lock() + unlock() == free.

Hi,

As far as I can see the Linux kernel's mutex API doesn't have support for 
checking if a mutex is owned. I guess you would have to do something like:

while (mutex_owned(xxx))
mutex_unlock(xxx);

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


origin/master branch update ?

2011-08-15 Thread Hans Petter Selasky
Hi,

When will the origin/master branch be updated regarding the media_tree.git ?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] DVB: dvb-net, make the kconfig text helpful

2011-06-17 Thread Hans Petter Selasky
On Thursday 16 June 2011 21:06:56 Jiri Slaby wrote:
 Telling the user they can disable an option if they want is not the
 much useful. Describe what it is good for instead.
 
 The text was derived from Mauro's email.

Acked-by: Hans Petter Selasky hsela...@c2i.net

PS: Don't forget the other patch to add a dependency to DVB_CORE.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] DVB: dvb-net, make the kconfig text helpful

2011-06-17 Thread Hans Petter Selasky
On Friday 17 June 2011 10:02:21 Jiri Slaby wrote:
 On 06/17/2011 08:04 AM, Hans Petter Selasky wrote:
  PS: Don't forget the other patch to add a dependency to DVB_CORE.
 
 Sorry, I'm not your fixing monkey. Fix your bugs on your own.

The PS was intended for Mauro. Sorry if you confused that.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB_NET help message is useless

2011-06-16 Thread Hans Petter Selasky
On Thursday 16 June 2011 09:06:59 Jiri Slaby wrote:
 I would send a patch, but I really have no idea what's that good for.

DVB network support is referring to the IP stack. This option is set to N 
when compiling the Linux DVB stack on systems without IP networking.

Please submit a patch if you need a better description.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 - resend] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

2011-06-02 Thread Hans Petter Selasky
On Thursday 02 June 2011 11:46:15 Lutz Sammer wrote:
 Hello Hans Petter,

Hi,

 
 I haven't tested your patch yet, but looking at the source I see some
 problems.
 
 What does your patch fix and how?

It switches from software derot to hardware derot, by writing zero to the 
derot register.

 
 If you have problem locking channels, try my locking patch:
 https://patchwork.kernel.org/patch/753382/
 
 On each step (timing, carrier, data) you reset the derot:
  stb0899_set_derot(state, 0);
 Why?

I have no good reason. It just works.

 
 Afaik you destroy already locked frequencies, which slows
 down the locking.
 
 Than you do 8 loops:
 for (index = 0; index  8; index++) {
 Why?

 
 All checks already contains some delays, if the delays are too
 short, you should fix this delays.

I can test patches regarding channel locking. The initial problem was the the 
stb0899 driver would not tune any channels.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 - resend] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

2011-05-28 Thread Hans Petter Selasky
(Hopefully without line wrapping of KMail.)

From 5449f996bb340e4423b3146d1e0172dd635c0398 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 24 May 2011 21:44:53 +0200
Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |  173 
 drivers/media/dvb/frontends/stb0899_drv.c  |1 -
 drivers/media/dvb/frontends/stb0899_priv.h |3 -
 3 files changed, 75 insertions(+), 102 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c 
b/drivers/media/dvb/frontends/stb0899_algo.c
index d70eee0..9156c3b 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, 
u32 master_clk, u32 sr
  */
 static long stb0899_calc_derot_time(long srate)
 {
-   if (srate  0)
+   if (srate  999)
return (10 / (srate / 1000));
else
return 0;
@@ -200,6 +200,39 @@ static enum stb0899_status stb0899_check_tmg(struct 
stb0899_state *state)
 }
 
 /*
+ * stb0899_set_derot
+ * set frequency derotor in HZ.
+ */
+static void
+stb0899_set_derot(struct stb0899_state *state, s16 derot)
+{
+   u8 cfr[2];
+
+   derot *= state-config-inversion;
+
+   cfr[0] = (u8)(derot  8);
+   cfr[1] = (u8)derot;
+
+   /* set derotator frequency in Hz */
+   stb0899_write_regs(state, STB0899_CFRM, cfr, 2);
+}
+
+/*
+ * stb0899_get_derot
+ * get frequency derotor in HZ.
+ */
+static s16
+stb0899_get_derot(struct stb0899_state *state)
+{
+   u8 cfr[2] = {0, 0};
+
+   /* get derotator frequency in Hz */
+   stb0899_read_regs(state, STB0899_CFRM, cfr, 2);
+
+   return (state-config-inversion * (s16)MAKEWORD16(cfr[0], cfr[1]));
+}
+
+/*
  * stb0899_search_tmg
  * perform a fs/2 zig-zag to find timing
  */
@@ -207,36 +240,22 @@ static enum stb0899_status stb0899_search_tmg(struct 
stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
struct stb0899_params *params = state-params;
-
-   short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
-   int index = 0;
-   u8 cfr[2];
+   int index;
 
internal-status = NOTIMING;
 
-   /* timing loop computation  symbol rate optimisation   */
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_step = (params-srate / 2L) / internal-mclk;
+   /* let the hardware figure out derot frequency */
+   stb0899_set_derot(state, 0);
 
-   while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
-   index++;
-   derot_freq += index * internal-direction * derot_step; /* next 
derot zig zag position  */
-
-   if (abs(derot_freq)  derot_limit)
-   next_loop--;
+   for (index = 0; index  8; index++) {
+   if (stb0899_check_tmg(state) == TIMINGOK) {
+   /* get derotator frequency */
+   internal-derot_freq = stb0899_get_derot(state);
 
-   if (next_loop) {
-   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(state-config-inversion * derot_freq));
-   STB0899_SETFIELD_VAL(CFRL, cfr[1], 
LSB(state-config-inversion * derot_freq));
-   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator frequency */
+   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK 
! 
+   Derot Freq = %d @ %d, internal-derot_freq, 
index);
+   break;
}
-   internal-direction = -internal-direction; /* Change 
zigzag direction  */
-   }
-
-   if (internal-status == TIMINGOK) {
-   stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get 
derotator frequency  */
-   internal-derot_freq = state-config-inversion * 
MAKEWORD16(cfr[0], cfr[1]);
-   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK ! Derot 
Freq = %d, internal-derot_freq);
}
 
return internal-status;
@@ -277,50 +296,26 @@ static enum stb0899_status stb0899_check_carrier(struct 
stb0899_state *state)
 static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
-
-   short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 
3;
-   int index = 0;
-   u8 cfr[2];
+   int index;
u8 reg;
 
internal-status = NOCARRIER;
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_freq = internal-derot_freq;
+
+   /* let the hardware figure out derot frequency */
+   stb0899_set_derot(state, 0);
 
reg = stb0899_read_reg(state, STB0899_CFD);
STB0899_SETFIELD_VAL(CFD_ON, reg

Re: [PATCH v3] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

2011-05-28 Thread Hans Petter Selasky
On Saturday 28 May 2011 12:30:17 Mariusz Bialonczyk wrote:
 Hello
 I don't know what mailer you're using but your patches
 to the ML are malformed (word wrapped).
 
 Please have a look:
 http://www.kernel.org/doc/Documentation/email-clients.txt
 
 I don't know for sure but you may need to send them
 again (all those malformed)...
 
 regards,

I tried to resend the e-mail w/o word wrapping. I'm using KMail.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] Correct error code from -ENOMEM to -EINVAL. Make sure the return value is set in all cases.

2011-05-26 Thread Hans Petter Selasky
From 9b38a5c9878b5e4be2899ae291c4524f5f5fc218 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 26 May 2011 09:49:52 +0200
Subject: [PATCH] Correct error code from -ENOMEM to -EINVAL. Make sure the 
return value is set in all cases.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/sr030pc30.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c
index c901721..8afb0e8 100644
--- a/drivers/media/video/sr030pc30.c
+++ b/drivers/media/video/sr030pc30.c
@@ -726,8 +726,10 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int 
on)
const struct sr030pc30_platform_data *pdata = info-pdata;
int ret;
 
-   if (WARN(pdata == NULL, No platform data!\n))
-   return -ENOMEM;
+   if (pdata == NULL) {
+   WARN(1, No platform data!\n);
+   return -EINVAL;
+   }
 
/*
 * Put sensor into power sleep mode before switching off
@@ -746,6 +748,7 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
if (on) {
ret = sr030pc30_base_config(sd);
} else {
+   ret = 0;
info-curr_win = NULL;
info-curr_fmt = NULL;
}
-- 
1.7.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] Remove unused definitions which can cause conflict with definitions in usb/ch9.h.

2011-05-26 Thread Hans Petter Selasky
From 0dd2949dfeae431ed4ffbd00fd14a10dc3747ad0 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 26 May 2011 09:56:55 +0200
Subject: [PATCH] Remove unused definitions which can cause conflict with 
definitions in usb/ch9.h.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/dvb-usb/gp8psk.h |3 ---
 drivers/media/dvb/dvb-usb/vp7045.h |3 ---
 2 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h 
b/drivers/media/dvb/dvb-usb/gp8psk.h
index 831749a..ed32b9d 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.h
+++ b/drivers/media/dvb/dvb-usb/gp8psk.h
@@ -78,9 +78,6 @@ extern int dvb_usb_gp8psk_debug;
 #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */
 
 #define GET_USB_SPEED 0x07
- #define USB_SPEED_LOW0
- #define USB_SPEED_FULL   1
- #define USB_SPEED_HIGH   2
 
 #define RESET_FX2 0x13
 
diff --git a/drivers/media/dvb/dvb-usb/vp7045.h 
b/drivers/media/dvb/dvb-usb/vp7045.h
index 969688f..cf5ec46 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.h
+++ b/drivers/media/dvb/dvb-usb/vp7045.h
@@ -36,9 +36,6 @@
  #define Tuner_Power_OFF  0
 
 #define GET_USB_SPEED 0x07
- #define USB_SPEED_LOW0
- #define USB_SPEED_FULL   1
- #define USB_SPEED_HIGH   2
 
 #define LOCK_TUNER_COMMAND0x09
 
-- 
1.7.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] Correct and add some parameter descriptions.

2011-05-26 Thread Hans Petter Selasky
From 70d02ce19f64fae4ceee563501e8462a76e17b91 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 26 May 2011 10:06:09 +0200
Subject: [PATCH] Correct and add some parameter descriptions.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/tda7432.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 3941f95..bd21854 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -49,10 +49,11 @@ static int maxvol;
 static int loudness; /* disable loudness by default */
 static int debug;   /* insmod parameter */
 module_param(debug, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, Set debugging level from 0 to 3. Default is off(0).);
 module_param(loudness, int, S_IRUGO);
-MODULE_PARM_DESC(maxvol,Set maximium volume to +20db (0), default is 0db(1));
+MODULE_PARM_DESC(loudness, Turn loudness on(1) else off(0). Default is 
off(0).);
 module_param(maxvol, int, S_IRUGO | S_IWUSR);
-
+MODULE_PARM_DESC(maxvol, Set maximium volume to +20dB(0) else +0dB(1). 
Default is +20dB(0).);
 
 
 /* Structure of address and subaddresses for the tda7432 */
-- 
1.7.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend

2011-05-25 Thread Hans Petter Selasky
(The initial patch cause too long tune delay on non-present carriers. Use the 
hardware derot, by writing zero to the derot register.)

From 2b960abaeeaa32f6bcaa350ca80906c467ab9cb1 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 24 May 2011 21:44:53 +0200
Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend 
hardware.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |  130 

 drivers/media/dvb/frontends/stb0899_priv.h |2 -
 2 files changed, 36 insertions(+), 96 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c 
b/drivers/media/dvb/frontends/stb0899_algo.c
index d70eee0..0cdaac2 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, 
u32 master_clk, u32 sr
  */
 static long stb0899_calc_derot_time(long srate)
 {
-   if (srate  0)
+   if (srate  999)
return (10 / (srate / 1000));
else
return 0;
@@ -207,36 +207,23 @@ static enum stb0899_status stb0899_search_tmg(struct 
stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
struct stb0899_params *params = state-params;
-
-   short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
-   int index = 0;
-   u8 cfr[2];
+   int index;
+   u8 cfr[2] = {0,0};
 
internal-status = NOTIMING;
 
-   /* timing loop computation  symbol rate optimisation   */
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_step = (params-srate / 2L) / internal-mclk;
-
-   while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
-   index++;
-   derot_freq += index * internal-direction * derot_step; /* next 
derot zig zag position  */
+   /* let the hardware figure out derot frequency */
+   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency 

*/
 
-   if (abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(state-config-inversion * 
derot_freq));
-   STB0899_SETFIELD_VAL(CFRL, cfr[1], 
LSB(state-config-inversion * 
derot_freq));
-   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator 
frequency   */
+   for (index = 0; index  8; index++) {
+   if (stb0899_check_tmg(state) == TIMINGOK) {
+   /* get derotator frequency */
+   stb0899_read_regs(state, STB0899_CFRM, cfr, 2);
+   internal-derot_freq = state-config-inversion * 
MAKEWORD16(cfr[0], cfr[1]);
+   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK 
! 
+   Derot Freq = %d, internal-derot_freq);
+   break;
}
-   internal-direction = -internal-direction; /* Change 
zigzag direction  
*/
-   }
-
-   if (internal-status == TIMINGOK) {
-   stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get 
derotator 
frequency   */
-   internal-derot_freq = state-config-inversion * 
MAKEWORD16(cfr[0], 
cfr[1]);
-   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK ! Derot 
Freq = 
%d, internal-derot_freq);
}
 
return internal-status;
@@ -277,50 +264,25 @@ static enum stb0899_status stb0899_check_carrier(struct 
stb0899_state *state)
 static enum stb0899_status stb0899_search_carrier(struct stb0899_state 
*state)
 {
struct stb0899_internal *internal = state-internal;
-
-   short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 
3;
-   int index = 0;
+   int index;
u8 cfr[2];
u8 reg;
 
internal-status = NOCARRIER;
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_freq = internal-derot_freq;
 
reg = stb0899_read_reg(state, STB0899_CFD);
STB0899_SETFIELD_VAL(CFD_ON, reg, 1);
stb0899_write_reg(state, STB0899_CFD, reg);
 
-   do {
-   dprintk(state-verbose, FE_DEBUG, 1, Derot Freq=%d, mclk=%d, 
derot_freq, internal-mclk);
-   if (stb0899_check_carrier(state) == NOCARRIER) {
-   index++;
-   last_derot_freq = derot_freq;
-   derot_freq += index * internal-direction * 
internal-derot_step; 
/* next zig zag derotator position */
-
-   if(abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   reg = stb0899_read_reg(state, STB0899_CFD);
-   STB0899_SETFIELD_VAL(CFD_ON, reg, 1

[PATCH v3] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

2011-05-25 Thread Hans Petter Selasky
(This patch needs testing and review.)

From 5449f996bb340e4423b3146d1e0172dd635c0398 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 24 May 2011 21:44:53 +0200
Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |  173 
 drivers/media/dvb/frontends/stb0899_drv.c  |1 -
 drivers/media/dvb/frontends/stb0899_priv.h |3 -
 3 files changed, 75 insertions(+), 102 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c 
b/drivers/media/dvb/frontends/stb0899_algo.c
index d70eee0..9156c3b 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, 
u32 master_clk, u32 sr
  */
 static long stb0899_calc_derot_time(long srate)
 {
-   if (srate  0)
+   if (srate  999)
return (10 / (srate / 1000));
else
return 0;
@@ -200,6 +200,39 @@ static enum stb0899_status stb0899_check_tmg(struct 
stb0899_state *state)
 }
 
 /*
+ * stb0899_set_derot
+ * set frequency derotor in HZ.
+ */
+static void
+stb0899_set_derot(struct stb0899_state *state, s16 derot)
+{
+   u8 cfr[2];
+
+   derot *= state-config-inversion;
+
+   cfr[0] = (u8)(derot  8);
+   cfr[1] = (u8)derot;
+
+   /* set derotator frequency in Hz */
+   stb0899_write_regs(state, STB0899_CFRM, cfr, 2);
+}
+
+/*
+ * stb0899_get_derot
+ * get frequency derotor in HZ.
+ */
+static s16
+stb0899_get_derot(struct stb0899_state *state)
+{
+   u8 cfr[2] = {0, 0};
+
+   /* get derotator frequency in Hz */
+   stb0899_read_regs(state, STB0899_CFRM, cfr, 2);
+
+   return (state-config-inversion * (s16)MAKEWORD16(cfr[0], cfr[1]));
+}
+
+/*
  * stb0899_search_tmg
  * perform a fs/2 zig-zag to find timing
  */
@@ -207,36 +240,22 @@ static enum stb0899_status stb0899_search_tmg(struct 
stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
struct stb0899_params *params = state-params;
-
-   short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
-   int index = 0;
-   u8 cfr[2];
+   int index;
 
internal-status = NOTIMING;
 
-   /* timing loop computation  symbol rate optimisation   */
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_step = (params-srate / 2L) / internal-mclk;
+   /* let the hardware figure out derot frequency */
+   stb0899_set_derot(state, 0);
 
-   while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
-   index++;
-   derot_freq += index * internal-direction * derot_step; /* next 
derot zig zag position  */
-
-   if (abs(derot_freq)  derot_limit)
-   next_loop--;
+   for (index = 0; index  8; index++) {
+   if (stb0899_check_tmg(state) == TIMINGOK) {
+   /* get derotator frequency */
+   internal-derot_freq = stb0899_get_derot(state);
 
-   if (next_loop) {
-   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(state-config-inversion * derot_freq));
-   STB0899_SETFIELD_VAL(CFRL, cfr[1], 
LSB(state-config-inversion * derot_freq));
-   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator frequency */
+   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK 
! 
+   Derot Freq = %d @ %d, internal-derot_freq, 
index);
+   break;
}
-   internal-direction = -internal-direction; /* Change 
zigzag direction  */
-   }
-
-   if (internal-status == TIMINGOK) {
-   stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get 
derotator frequency  */
-   internal-derot_freq = state-config-inversion * 
MAKEWORD16(cfr[0], cfr[1]);
-   dprintk(state-verbose, FE_DEBUG, 1, ---TIMING OK ! Derot 
Freq = %d, internal-derot_freq);
}
 
return internal-status;
@@ -277,50 +296,26 @@ static enum stb0899_status stb0899_check_carrier(struct 
stb0899_state *state)
 static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
-
-   short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 
3;
-   int index = 0;
-   u8 cfr[2];
+   int index;
u8 reg;
 
internal-status = NOCARRIER;
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_freq = internal-derot_freq;
+
+   /* let the hardware figure out derot frequency */
+   stb0899_set_derot(state, 0);
 
reg = stb0899_read_reg(state, STB0899_CFD);
STB0899_SETFIELD_VAL(CFD_ON, reg, 1

[RFC] drivers/media/dvb/dvb-usb/pctv452e.c does not work in latest media_tree.git

2011-05-24 Thread Hans Petter Selasky
On Tuesday 24 May 2011 15:59:57 André Weidemann wrote:
 Hi Peter,

 For the time being the S2-3200 and related cards do not seem to work.
  From my understanding this patch should have been rolled back, but
 Mauro did not. Feel free to post a message to the linux-media mailing
 list. Maybe someone there knows a bit more...
 
 Regards
   André

Hi,

I did some more investigation and found what appears to be close to a fix:

media_tree/drivers/media/dvb/frontends/stb0899_algo.c

There is some automagic frequency guessing which does not work:

/* timing loop computation  symbol rate optimisation   */
derot_limit = (internal-sub_range / 2L) / internal-mclk;
derot_step = (params-srate / 2L) / internal-mclk;
^ by changing this line to:
+derot_step = (params-srate / 16L) / internal-mclk;

Things are starting to look better. I'm thinking about using a simple:

derot_freq = ((index * index) - index) * internal-direction;

This gives 127 steps before the maximum is reached.

while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
index++;
derot_freq += index * internal-direction * derot_step; /* 
next derot zig zag position  */

if (abs(derot_freq)  derot_limit)
next_loop--;

if (next_loop) {
STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state-config-
inversion * derot_freq));
STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state-config-
inversion * derot_freq));
stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator frequency */
}
internal-direction = -internal-direction; /* Change 
zigzag direction  */
}

Any comments?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC] drivers/media/dvb/dvb-usb/pctv452e.c does not work in latest media_tree.git

2011-05-24 Thread Hans Petter Selasky
Final patch. Please test and review!

From 83224b9c4b5402332589139549b387066bff8277 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 24 May 2011 21:44:53 +0200
Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend 
hardware.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |  113 ---
 1 files changed, 50 insertions(+), 63 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c 
b/drivers/media/dvb/frontends/stb0899_algo.c
index d70eee0..1dbd9be 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -23,6 +23,13 @@
 #include stb0899_priv.h
 #include stb0899_reg.h
 
+#include linux/kernel.h
+#include linux/module.h
+
+static int derot_max = 8192;
+module_param(derot_max, int, 0644);
+MODULE_PARM_DESC(derot_max, Set Maximum Derot Value (0..32767));
+
 static inline u32 stb0899_do_div(u64 n, u32 d)
 {
/* wrap do_div() for ease of use */
@@ -117,7 +124,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, 
u32 master_clk, u32 sr
  */
 static long stb0899_calc_derot_time(long srate)
 {
-   if (srate  0)
+   if (srate  999)
return (10 / (srate / 1000));
else
return 0;
@@ -207,30 +214,22 @@ static enum stb0899_status stb0899_search_tmg(struct 
stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
struct stb0899_params *params = state-params;
-
-   short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
+   int derot_freq = 0;
int index = 0;
u8 cfr[2];
 
internal-status = NOTIMING;
+   internal-direction = 1;
 
-   /* timing loop computation  symbol rate optimisation   */
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_step = (params-srate / 2L) / internal-mclk;
+   while ((stb0899_check_tmg(state) != TIMINGOK)  (abs(derot_freq) = 
derot_max)) {
+   derot_freq += index * (index - 1) * internal-direction;
/* next 
derot zig zag position  */
 
-   while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
-   index++;
-   derot_freq += index * internal-direction * derot_step; /* next 
derot zig zag position  */
+   STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state-config-inversion 
* 
derot_freq));
+   STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state-config-inversion 
* 
derot_freq));
+   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator 
frequency   */
 
-   if (abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(state-config-inversion * 
derot_freq));
-   STB0899_SETFIELD_VAL(CFRL, cfr[1], 
LSB(state-config-inversion * 
derot_freq));
-   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator 
frequency   */
-   }
internal-direction = -internal-direction; /* Change 
zigzag direction  
*/
+   index++;
}
 
if (internal-status == TIMINGOK) {
@@ -277,50 +276,41 @@ static enum stb0899_status stb0899_check_carrier(struct 
stb0899_state *state)
 static enum stb0899_status stb0899_search_carrier(struct stb0899_state 
*state)
 {
struct stb0899_internal *internal = state-internal;
-
-   short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 
3;
+   int derot_freq;
int index = 0;
u8 cfr[2];
u8 reg;
 
internal-status = NOCARRIER;
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
+   internal-direction = 1;
derot_freq = internal-derot_freq;
 
reg = stb0899_read_reg(state, STB0899_CFD);
STB0899_SETFIELD_VAL(CFD_ON, reg, 1);
stb0899_write_reg(state, STB0899_CFD, reg);
 
-   do {
+   while ((stb0899_check_carrier(state) == NOCARRIER)  (abs(derot_freq) 
= 
derot_max)) {
+
+   derot_freq += index * (index - 1) * internal-direction;
/* next 
derot zig zag position  */
+
dprintk(state-verbose, FE_DEBUG, 1, Derot Freq=%d, mclk=%d, 
derot_freq, internal-mclk);
-   if (stb0899_check_carrier(state) == NOCARRIER) {
-   index++;
-   last_derot_freq = derot_freq;
-   derot_freq += index * internal-direction * 
internal-derot_step; 
/* next zig zag derotator position */
-
-   if(abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   reg = stb0899_read_reg(state, STB0899_CFD);
-   STB0899_SETFIELD_VAL(CFD_ON, reg, 1

[PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend hardware.

2011-05-24 Thread Hans Petter Selasky
(This time without any word wrappings)

From 83224b9c4b5402332589139549b387066bff8277 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Tue, 24 May 2011 21:44:53 +0200
Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend 
hardware.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |  113 ---
 1 files changed, 50 insertions(+), 63 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c 
b/drivers/media/dvb/frontends/stb0899_algo.c
index d70eee0..1dbd9be 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -23,6 +23,13 @@
 #include stb0899_priv.h
 #include stb0899_reg.h
 
+#include linux/kernel.h
+#include linux/module.h
+
+static int derot_max = 8192;
+module_param(derot_max, int, 0644);
+MODULE_PARM_DESC(derot_max, Set Maximum Derot Value (0..32767));
+
 static inline u32 stb0899_do_div(u64 n, u32 d)
 {
/* wrap do_div() for ease of use */
@@ -117,7 +124,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, 
u32 master_clk, u32 sr
  */
 static long stb0899_calc_derot_time(long srate)
 {
-   if (srate  0)
+   if (srate  999)
return (10 / (srate / 1000));
else
return 0;
@@ -207,30 +214,22 @@ static enum stb0899_status stb0899_search_tmg(struct 
stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
struct stb0899_params *params = state-params;
-
-   short int derot_step, derot_freq = 0, derot_limit, next_loop = 3;
+   int derot_freq = 0;
int index = 0;
u8 cfr[2];
 
internal-status = NOTIMING;
+   internal-direction = 1;
 
-   /* timing loop computation  symbol rate optimisation   */
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
-   derot_step = (params-srate / 2L) / internal-mclk;
+   while ((stb0899_check_tmg(state) != TIMINGOK)  (abs(derot_freq) = 
derot_max)) {
+   derot_freq += index * (index - 1) * internal-direction;
/* next derot zig zag position  */
 
-   while ((stb0899_check_tmg(state) != TIMINGOK)  next_loop) {
-   index++;
-   derot_freq += index * internal-direction * derot_step; /* next 
derot zig zag position  */
+   STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state-config-inversion 
* derot_freq));
+   STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state-config-inversion 
* derot_freq));
+   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator 
frequency */
 
-   if (abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   STB0899_SETFIELD_VAL(CFRM, cfr[0], 
MSB(state-config-inversion * derot_freq));
-   STB0899_SETFIELD_VAL(CFRL, cfr[1], 
LSB(state-config-inversion * derot_freq));
-   stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* 
derotator frequency */
-   }
internal-direction = -internal-direction; /* Change 
zigzag direction  */
+   index++;
}
 
if (internal-status == TIMINGOK) {
@@ -277,50 +276,41 @@ static enum stb0899_status stb0899_check_carrier(struct 
stb0899_state *state)
 static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state)
 {
struct stb0899_internal *internal = state-internal;
-
-   short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 
3;
+   int derot_freq;
int index = 0;
u8 cfr[2];
u8 reg;
 
internal-status = NOCARRIER;
-   derot_limit = (internal-sub_range / 2L) / internal-mclk;
+   internal-direction = 1;
derot_freq = internal-derot_freq;
 
reg = stb0899_read_reg(state, STB0899_CFD);
STB0899_SETFIELD_VAL(CFD_ON, reg, 1);
stb0899_write_reg(state, STB0899_CFD, reg);
 
-   do {
+   while ((stb0899_check_carrier(state) == NOCARRIER)  (abs(derot_freq) 
= derot_max)) {
+
+   derot_freq += index * (index - 1) * internal-direction;
/* next derot zig zag position  */
+
dprintk(state-verbose, FE_DEBUG, 1, Derot Freq=%d, mclk=%d, 
derot_freq, internal-mclk);
-   if (stb0899_check_carrier(state) == NOCARRIER) {
-   index++;
-   last_derot_freq = derot_freq;
-   derot_freq += index * internal-direction * 
internal-derot_step; /* next zig zag derotator 
position */
-
-   if(abs(derot_freq)  derot_limit)
-   next_loop--;
-
-   if (next_loop) {
-   reg = stb0899_read_reg(state, STB0899_CFD);
-   STB0899_SETFIELD_VAL(CFD_ON, reg, 1

[PATCH] Correct a module parameter description to describe the correct parameter.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 0b5b16dfa302229060eb4ceae0498f0d60ab86c1 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 12:50:01 +0200
Subject: [PATCH] Correct a module parameter description to describe the correct parameter.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/cx24116.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/cx24116.c b/drivers/media/dvb/frontends/cx24116.c
index 2410d8b..cf1ec6c 100644
--- a/drivers/media/dvb/frontends/cx24116.c
+++ b/drivers/media/dvb/frontends/cx24116.c
@@ -137,7 +137,7 @@ MODULE_PARM_DESC(toneburst, DiSEqC toneburst 0=OFF, 1=TONE CACHE, \
 /* SNR measurements */
 static int esno_snr;
 module_param(esno_snr, int, 0644);
-MODULE_PARM_DESC(debug, SNR return units, 0=PERCENTAGE 0-100, \
+MODULE_PARM_DESC(esno_snr, SNR return units, 0=PERCENTAGE 0-100, \
 	1=ESNO(db * 10) (default:0));
 
 enum cmds {
-- 
1.7.1.1



[PATCH] The info and err macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 83b2408914b9c02600c8288459ed869037efd1dd Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 12:54:21 +0200
Subject: [PATCH] The info and err macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/cx24123.c|   34 +-
 drivers/media/dvb/frontends/dib3000mb.c  |   12 
 drivers/media/dvb/frontends/dib3000mb_priv.h |   10 +++
 3 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index b1dd8ac..b73fb90 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -41,8 +41,8 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Activates frontend debugging (default:0));
 
-#define info(args...) do { printk(KERN_INFO CX24123:  args); } while (0)
-#define err(args...)  do { printk(KERN_ERR  CX24123:  args); } while (0)
+#define cx_info(args...) do { printk(KERN_INFO CX24123:  args); } while (0)
+#define cx_err(args...)  do { printk(KERN_ERR  CX24123:  args); } while (0)
 
 #define dprintk(args...) \
 	do { \
@@ -274,7 +274,7 @@ static int cx24123_i2c_readreg(struct cx24123_state *state, u8 i2c_addr, u8 reg)
 	ret = i2c_transfer(state-i2c, msg, 2);
 
 	if (ret != 2) {
-		err(%s: reg=0x%x (error=%d)\n, __func__, reg, ret);
+		cx_err(%s: reg=0x%x (error=%d)\n, __func__, reg, ret);
 		return ret;
 	}
 
@@ -620,7 +620,7 @@ static int cx24123_pll_writereg(struct dvb_frontend *fe,
 	cx24123_writereg(state, 0x22, (data  16)  0xff);
 	while ((cx24123_readreg(state, 0x20)  0x40) == 0) {
 		if (time_after(jiffies, timeout)) {
-			err(%s:  demodulator is not responding, \
+			cx_err(%s:  demodulator is not responding, \
 possibly hung, aborting.\n, __func__);
 			return -EREMOTEIO;
 		}
@@ -632,7 +632,7 @@ static int cx24123_pll_writereg(struct dvb_frontend *fe,
 	cx24123_writereg(state, 0x22, (data  8)  0xff);
 	while ((cx24123_readreg(state, 0x20)  0x40) == 0) {
 		if (time_after(jiffies, timeout)) {
-			err(%s:  demodulator is not responding, \
+			cx_err(%s:  demodulator is not responding, \
 possibly hung, aborting.\n, __func__);
 			return -EREMOTEIO;
 		}
@@ -645,7 +645,7 @@ static int cx24123_pll_writereg(struct dvb_frontend *fe,
 	cx24123_writereg(state, 0x22, (data)  0xff);
 	while ((cx24123_readreg(state, 0x20)  0x80)) {
 		if (time_after(jiffies, timeout)) {
-			err(%s:  demodulator is not responding, \
+			cx_err(%s:  demodulator is not responding, \
 possibly hung, aborting.\n, __func__);
 			return -EREMOTEIO;
 		}
@@ -668,7 +668,7 @@ static int cx24123_pll_tune(struct dvb_frontend *fe,
 	dprintk(frequency=%i\n, p-frequency);
 
 	if (cx24123_pll_calculate(fe, p) != 0) {
-		err(%s: cx24123_pll_calcutate failed\n, __func__);
+		cx_err(%s: cx24123_pll_calcutate failed\n, __func__);
 		return -EINVAL;
 	}
 
@@ -765,7 +765,7 @@ static void cx24123_wait_for_diseqc(struct cx24123_state *state)
 	unsigned long timeout = jiffies + msecs_to_jiffies(200);
 	while (!(cx24123_readreg(state, 0x29)  0x40)) {
 		if (time_after(jiffies, timeout)) {
-			err(%s: diseqc queue not ready,  \
+			cx_err(%s: diseqc queue not ready,  \
 command may be lost.\n, __func__);
 			break;
 		}
@@ -947,7 +947,7 @@ static int cx24123_set_frontend(struct dvb_frontend *fe,
 	else if (fe-ops.tuner_ops.set_params)
 		fe-ops.tuner_ops.set_params(fe, p);
 	else
-		err(it seems I don't have a tuner...);
+		cx_err(it seems I don't have a tuner...);
 
 	/* Enable automatic acquisition and reset cycle */
 	cx24123_writereg(state, 0x03, (cx24123_readreg(state, 0x03) | 0x07));
@@ -968,11 +968,11 @@ static int cx24123_get_frontend(struct dvb_frontend *fe,
 	dprintk(\n);
 
 	if (cx24123_get_inversion(state, p-inversion) != 0) {
-		err(%s: Failed to get inversion status\n, __func__);
+		cx_err(%s: Failed to get inversion status\n, __func__);
 		return -EREMOTEIO;
 	}
 	if (cx24123_get_fec(state, p-u.qpsk.fec_inner) != 0) {
-		err(%s: Failed to get fec status\n, __func__);
+		cx_err(%s: Failed to get fec status\n, __func__);
 		return -EREMOTEIO;
 	}
 	p-frequency = state-currentfreq;
@@ -999,7 +999,7 @@ static int cx24123_set_tone(struct dvb_frontend *fe, fe_sec_tone_mode_t tone)
 		dprintk(setting tone off\n);
 		return cx24123_writereg(state, 0x29, val  0xef);
 	default:
-		err(CASE reached default with tone=%d\n, tone);
+		cx_err(CASE reached default with tone=%d\n, tone);
 		return -EINVAL;
 	}
 
@@ -1075,7 +1075,7 @@ struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
 
 	dprintk(\n);
 	if (state == NULL) {
-		err(Unable to kzalloc\n);
+		cx_err(Unable to kzalloc\n);
 		goto error;
 	}
 
@@ -1087,13 +1087,13 @@ struct dvb_frontend *cx24123_attach(const struct cx24123_config *config,
 	state-demod_rev = cx24123_readreg(state, 0x00);
 	switch

[PATCH] Fix warning about invalid trigraph sequence.

2011-05-23 Thread Hans Petter Selasky
--HPS
From e3b824b49f3d853ba16d9cdda836bd2fe81c7775 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 12:59:37 +0200
Subject: [PATCH] Fix warning about invalid trigraph sequence.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/cpia2/cpia2_v4l.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 5111bbc..e909838 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -438,7 +438,7 @@ static int cpia2_querycap(struct file *file, void *fh, struct v4l2_capability *v
 		strcat(vc-card,  (676/);
 		break;
 	default:
-		strcat(vc-card,  (???/);
+		strcat(vc-card,  (XXX/);
 		break;
 	}
 	switch (cam-params.version.sensor_flags) {
@@ -458,7 +458,7 @@ static int cpia2_querycap(struct file *file, void *fh, struct v4l2_capability *v
 		strcat(vc-card, 500));
 		break;
 	default:
-		strcat(vc-card, ???));
+		strcat(vc-card, XXX));
 		break;
 	}
 
-- 
1.7.1.1



[PATCH] Make code more readable by not using the return value of the WARN() macro. Set ret variable in an undefined case.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 94b88b92763f9309018ba04c200a8842ce1ff0ed Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:07:08 +0200
Subject: [PATCH] Make code more readable by not using the return value of the WARN() macro. Set ret variable in an undefined case.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/sr030pc30.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/sr030pc30.c b/drivers/media/video/sr030pc30.c
index c901721..6cc64c9 100644
--- a/drivers/media/video/sr030pc30.c
+++ b/drivers/media/video/sr030pc30.c
@@ -726,8 +726,10 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
 	const struct sr030pc30_platform_data *pdata = info-pdata;
 	int ret;
 
-	if (WARN(pdata == NULL, No platform data!\n))
+	if (pdata == NULL) {
+		WARN(1, No platform data!\n);
 		return -ENOMEM;
+	}
 
 	/*
 	 * Put sensor into power sleep mode before switching off
@@ -746,6 +748,7 @@ static int sr030pc30_s_power(struct v4l2_subdev *sd, int on)
 	if (on) {
 		ret = sr030pc30_base_config(sd);
 	} else {
+		ret = 0;
 		info-curr_win = NULL;
 		info-curr_fmt = NULL;
 	}
-- 
1.7.1.1



[PATCH] Make nchg variable signed because the code compares this variable against negative values.

2011-05-23 Thread Hans Petter Selasky
--HPS
From b05d4913df24f11c7b7a2e07201bb87a04a949bc Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:09:18 +0200
Subject: [PATCH] Make nchg variable signed because the code compares this variable against negative values.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/gspca/sonixj.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 6415aff..81b8a60 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -60,7 +60,7 @@ struct sd {
 
 	u32 pktsz;			/* (used by pkt_scan) */
 	u16 npkt;
-	u8 nchg;
+	s8 nchg;
 	s8 short_mark;
 
 	u8 quality;			/* image quality */
-- 
1.7.1.1



[PATCH] Fix compile warning: Dereferencing type-punned pointer will break strict-aliasing rules.

2011-05-23 Thread Hans Petter Selasky
--HPS
From c7a1e3b3f761a8bd75799248dd83499f59eaedae Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:13:06 +0200
Subject: [PATCH] Fix compile warning: Dereferencing type-punned pointer will break strict-aliasing rules.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/v4l2-ioctl.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index 506edcc..213ba7d 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -2264,7 +2264,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
 break;
 			}
 			*user_ptr = (void __user *)buf-m.planes;
-			*kernel_ptr = (void **)buf-m.planes;
+			*kernel_ptr = (void *)buf-m.planes;
 			*array_size = sizeof(struct v4l2_plane) * buf-length;
 			ret = 1;
 		}
@@ -2278,7 +2278,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
 
 		if (ctrls-count != 0) {
 			*user_ptr = (void __user *)ctrls-controls;
-			*kernel_ptr = (void **)ctrls-controls;
+			*kernel_ptr = (void *)ctrls-controls;
 			*array_size = sizeof(struct v4l2_ext_control)
 * ctrls-count;
 			ret = 1;
-- 
1.7.1.1



[PATCH] The USB_SPEED... keywords are already defined by the USB stack. Rename currently unused macros to avoid possible future warnings and errors.

2011-05-23 Thread Hans Petter Selasky
--HPS
From f7a0f7254da47ff88f69314f14043b01ba0764eb Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 12:43:50 +0200
Subject: [PATCH] The USB_SPEED_XXX keywords are already defined by the USB stack. Rename currently unused macros to avoid possible future warnings and errors.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/dvb-usb/gp8psk.h |6 +++---
 drivers/media/dvb/dvb-usb/vp7045.h |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h
index 831749a..c271b68 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.h
+++ b/drivers/media/dvb/dvb-usb/gp8psk.h
@@ -78,9 +78,9 @@ extern int dvb_usb_gp8psk_debug;
 #define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */
 
 #define GET_USB_SPEED 0x07
- #define USB_SPEED_LOW0
- #define USB_SPEED_FULL   1
- #define USB_SPEED_HIGH   2
+ #define TH_USB_SPEED_LOW 0
+ #define TH_USB_SPEED_FULL1
+ #define TH_USB_SPEED_HIGH2
 
 #define RESET_FX2 0x13
 
diff --git a/drivers/media/dvb/dvb-usb/vp7045.h b/drivers/media/dvb/dvb-usb/vp7045.h
index 969688f..7ce6c00 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.h
+++ b/drivers/media/dvb/dvb-usb/vp7045.h
@@ -36,9 +36,9 @@
  #define Tuner_Power_OFF  0
 
 #define GET_USB_SPEED 0x07
- #define USB_SPEED_LOW0
- #define USB_SPEED_FULL   1
- #define USB_SPEED_HIGH   2
+ #define TH_USB_SPEED_LOW 0
+ #define TH_USB_SPEED_FULL1
+ #define TH_USB_SPEED_HIGH2
 
 #define LOCK_TUNER_COMMAND0x09
 
-- 
1.7.1.1



[PATCH] Define parameter description after the parameter itself.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 2f5378e5c5cc5528473f77321879fb075005d3dd Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:26:04 +0200
Subject: [PATCH] Define parameter description after the parameter itself.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/video/tda7432.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 3941f95..398b9fb 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -50,8 +50,8 @@ static int loudness; /* disable loudness by default */
 static int debug;	 /* insmod parameter */
 module_param(debug, int, S_IRUGO | S_IWUSR);
 module_param(loudness, int, S_IRUGO);
-MODULE_PARM_DESC(maxvol,Set maximium volume to +20db (0), default is 0db(1));
 module_param(maxvol, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(maxvol,Set maximium volume to +20db (0), default is 0db(1));
 
 
 
-- 
1.7.1.1



[PATCH] Remove invalid parameter description.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 843559156c08edaf3ef616df005eae8b8d14b186 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:28:50 +0200
Subject: [PATCH] Remove invalid parameter description.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/tda8261.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/tda8261.c b/drivers/media/dvb/frontends/tda8261.c
index 1742056..53c7d8f 100644
--- a/drivers/media/dvb/frontends/tda8261.c
+++ b/drivers/media/dvb/frontends/tda8261.c
@@ -224,7 +224,6 @@ exit:
 }
 
 EXPORT_SYMBOL(tda8261_attach);
-MODULE_PARM_DESC(verbose, Set verbosity level);
 
 MODULE_AUTHOR(Manu Abraham);
 MODULE_DESCRIPTION(TDA8261 8PSK/QPSK Tuner);
-- 
1.7.1.1



[PATCH] The dbg, warn and info macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings. Refactor lineshift in printouts.

2011-05-23 Thread Hans Petter Selasky
--HPS
From c05334a4162912164d9e8d2d551f1bc2a5fdce82 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:40:00 +0200
Subject: [PATCH] The dbg, warn and info macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings. Refactor lineshift in printouts.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/itd1000.c |   25 +++--
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/media/dvb/frontends/itd1000.c b/drivers/media/dvb/frontends/itd1000.c
index f7a40a1..aa9ccb8 100644
--- a/drivers/media/dvb/frontends/itd1000.c
+++ b/drivers/media/dvb/frontends/itd1000.c
@@ -35,21 +35,18 @@ static int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Turn on/off debugging (default:off).);
 
-#define deb(args...)  do { \
+#define itd_dbg(args...)  do { \
 	if (debug) { \
 		printk(KERN_DEBUG   ITD1000:  args);\
-		printk(\n); \
 	} \
 } while (0)
 
-#define warn(args...) do { \
+#define itd_warn(args...) do { \
 	printk(KERN_WARNING ITD1000:  args); \
-	printk(\n); \
 } while (0)
 
-#define info(args...) do { \
+#define itd_info(args...) do { \
 	printk(KERN_INFOITD1000:  args); \
-	printk(\n); \
 } while (0)
 
 /* don't write more than one byte with flexcop behind */
@@ -62,7 +59,7 @@ static int itd1000_write_regs(struct itd1000_state *state, u8 reg, u8 v[], u8 le
 	buf[0] = reg;
 	memcpy(buf[1], v, len);
 
-	/* deb(wr %02x: %02x, reg, v[0]); */
+	/* itd_dbg(wr %02x: %02x\n, reg, v[0]); */
 
 	if (i2c_transfer(state-i2c, msg, 1) != 1) {
 		printk(KERN_WARNING itd1000 I2C write failed\n);
@@ -83,7 +80,7 @@ static int itd1000_read_reg(struct itd1000_state *state, u8 reg)
 	itd1000_write_regs(state, (reg - 1)  0xff, state-shadow[(reg - 1)  0xff], 1);
 
 	if (i2c_transfer(state-i2c, msg, 2) != 2) {
-		warn(itd1000 I2C read failed);
+		itd_warn(itd1000 I2C read failed\n);
 		return -EREMOTEIO;
 	}
 	return val;
@@ -127,14 +124,14 @@ static void itd1000_set_lpf_bw(struct itd1000_state *state, u32 symbol_rate)
 	u8 bbgvmin = itd1000_read_reg(state, BBGVMIN)  0xf0;
 	u8 bw  = itd1000_read_reg(state, BW)   0xf0;
 
-	deb(symbol_rate = %d, symbol_rate);
+	itd_dbg(symbol_rate = %d\n, symbol_rate);
 
 	/* not sure what is that ? - starting to download the table */
 	itd1000_write_reg(state, CON1, con1 | (1  1));
 
 	for (i = 0; i  ARRAY_SIZE(itd1000_lpf_pga); i++)
 		if (symbol_rate  itd1000_lpf_pga[i].symbol_rate) {
-			deb(symrate: index: %d pgaext: %x, bbgvmin: %x, i, itd1000_lpf_pga[i].pgaext, itd1000_lpf_pga[i].bbgvmin);
+			itd_dbg(symrate: index: %d pgaext: %x, bbgvmin: %x\n, i, itd1000_lpf_pga[i].pgaext, itd1000_lpf_pga[i].bbgvmin);
 			itd1000_write_reg(state, PLLFH,   pllfh | (itd1000_lpf_pga[i].pgaext  4));
 			itd1000_write_reg(state, BBGVMIN, bbgvmin | (itd1000_lpf_pga[i].bbgvmin));
 			itd1000_write_reg(state, BW,  bw | (i  0x0f));
@@ -182,7 +179,7 @@ static void itd1000_set_vco(struct itd1000_state *state, u32 freq_khz)
 
 			adcout = itd1000_read_reg(state, PLLLOCK)  0x0f;
 
-			deb(VCO: %dkHz: %d - ADCOUT: %d %02x, freq_khz, itd1000_vcorg[i].vcorg, adcout, vco_chp1_i2c);
+			itd_dbg(VCO: %dkHz: %d - ADCOUT: %d %02x\n, freq_khz, itd1000_vcorg[i].vcorg, adcout, vco_chp1_i2c);
 
 			if (adcout  13) {
 if (!(itd1000_vcorg[i].vcorg == 7 || itd1000_vcorg[i].vcorg == 15))
@@ -232,7 +229,7 @@ static void itd1000_set_lo(struct itd1000_state *state, u32 freq_khz)
 	pllf = (u32) tmp;
 
 	state-frequency = ((plln * 1000) + (pllf * 1000)/1048576) * 2*FREF;
-	deb(frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = %d, freq_khz, state-frequency, pllf, plln);
+	itd_dbg(frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = %d\n, freq_khz, state-frequency, pllf, plln);
 
 	itd1000_write_reg(state, PLLNH, 0x80); /* PLLNH */;
 	itd1000_write_reg(state, PLLNL, plln  0xff);
@@ -242,7 +239,7 @@ static void itd1000_set_lo(struct itd1000_state *state, u32 freq_khz)
 
 	for (i = 0; i  ARRAY_SIZE(itd1000_fre_values); i++) {
 		if (freq_khz = itd1000_fre_values[i].freq) {
-			deb(fre_values: %d, i);
+			itd_dbg(fre_values: %d\n, i);
 			itd1000_write_reg(state, RFTR, itd1000_fre_values[i].values[0]);
 			for (j = 0; j  9; j++)
 itd1000_write_reg(state, RFST1+j, itd1000_fre_values[i].values[j+1]);
@@ -382,7 +379,7 @@ struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter
 		kfree(state);
 		return NULL;
 	}
-	info(successfully identified (ID: %d), i);
+	itd_info(successfully identified (ID: %d)\n, i);
 
 	memset(state-shadow, 0xff, sizeof(state-shadow));
 	for (i = 0x65; i  0x9c; i++)
-- 
1.7.1.1



[PATCH] The info and err macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 49bc5e480f51a9b756f1f7f1503d237e8a1ba939 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 13:42:40 +0200
Subject: [PATCH] The info and err macros are already defined by the USB stack. Rename these macros to avoid macro redefinition warnings.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/cx24113.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/dvb/frontends/cx24113.c b/drivers/media/dvb/frontends/cx24113.c
index e9ee555..c341d57 100644
--- a/drivers/media/dvb/frontends/cx24113.c
+++ b/drivers/media/dvb/frontends/cx24113.c
@@ -31,8 +31,8 @@
 
 static int debug;
 
-#define info(args...) do { printk(KERN_INFO CX24113:  args); } while (0)
-#define err(args...)  do { printk(KERN_ERR  CX24113:  args); } while (0)
+#define cx_info(args...) do { printk(KERN_INFO CX24113:  args); } while (0)
+#define cx_err(args...)  do { printk(KERN_ERR  CX24113:  args); } while (0)
 
 #define dprintk(args...) \
 	do { \
@@ -341,7 +341,7 @@ static void cx24113_calc_pll_nf(struct cx24113_state *state, u16 *n, s32 *f)
 	} while (N  6  R  3);
 
 	if (N  6) {
-		err(strange frequency: N  6\n);
+		cx_err(strange frequency: N  6\n);
 		return;
 	}
 	F = freq_hz;
@@ -563,7 +563,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 		kzalloc(sizeof(struct cx24113_state), GFP_KERNEL);
 	int rc;
 	if (state == NULL) {
-		err(Unable to kzalloc\n);
+		cx_err(Unable to kzalloc\n);
 		goto error;
 	}
 
@@ -571,7 +571,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 	state-config = config;
 	state-i2c = i2c;
 
-	info(trying to detect myself\n);
+	cx_info(trying to detect myself\n);
 
 	/* making a dummy read, because of some expected troubles
 	 * after power on */
@@ -579,24 +579,24 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe,
 
 	rc = cx24113_readreg(state, 0x00);
 	if (rc  0) {
-		info(CX24113 not found.\n);
+		cx_info(CX24113 not found.\n);
 		goto error;
 	}
 	state-rev = rc;
 
 	switch (rc) {
 	case 0x43:
-		info(detected CX24113 variant\n);
+		cx_info(detected CX24113 variant\n);
 		break;
 	case REV_CX24113:
-		info(successfully detected\n);
+		cx_info(successfully detected\n);
 		break;
 	default:
-		err(unsupported device id: %x\n, state-rev);
+		cx_err(unsupported device id: %x\n, state-rev);
 		goto error;
 	}
 	state-ver = cx24113_readreg(state, 0x01);
-	info(version: %x\n, state-ver);
+	cx_info(version: %x\n, state-ver);
 
 	/* create dvb_frontend */
 	memcpy(fe-ops.tuner_ops, cx24113_tuner_ops,
-- 
1.7.1.1



[PATCH] Make DVB NET configurable in the kernel.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 7222450a9d6f96f652237c65019fb25f54586d01 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 14:43:35 +0200
Subject: [PATCH] Make DVB NET configurable in the kernel.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/Kconfig|   12 +++-
 drivers/media/dvb/dvb-core/Makefile  |4 +++-
 drivers/media/dvb/dvb-core/dvb_net.h |   26 ++
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 6995940..dc61895 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -68,7 +68,6 @@ config VIDEO_V4L2_SUBDEV_API
 
 config DVB_CORE
 	tristate DVB for Linux
-	depends on NET  INET
 	select CRC32
 	help
 	  DVB core utility functions for device handling, software fallbacks etc.
@@ -85,6 +84,17 @@ config DVB_CORE
 
 	  If unsure say N.
 
+config DVB_NET
+	bool DVB Network Support
+	default (NET  INET)
+	depends on NET  INET
+	help
+	  The DVB network support in the DVB core can
+	  optionally be disabled if this
+	  option is set to N.
+
+	  If unsure say Y.
+
 config VIDEO_MEDIA
 	tristate
 	default (DVB_CORE  (VIDEO_DEV = n)) || (VIDEO_DEV  (DVB_CORE = n)) || (DVB_CORE  VIDEO_DEV)
diff --git a/drivers/media/dvb/dvb-core/Makefile b/drivers/media/dvb/dvb-core/Makefile
index 0b51828..8f22bcd 100644
--- a/drivers/media/dvb/dvb-core/Makefile
+++ b/drivers/media/dvb/dvb-core/Makefile
@@ -2,8 +2,10 @@
 # Makefile for the kernel DVB device drivers.
 #
 
+dvb-net-$(CONFIG_DVB_NET) := dvb_net.o
+
 dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o 	\
 		 dvb_ca_en50221.o dvb_frontend.o 		\
-		 dvb_net.o dvb_ringbuffer.o dvb_math.o
+		 $(dvb-net-y) dvb_ringbuffer.o dvb_math.o
 
 obj-$(CONFIG_DVB_CORE) += dvb-core.o
diff --git a/drivers/media/dvb/dvb-core/dvb_net.h b/drivers/media/dvb/dvb-core/dvb_net.h
index 3a3126c..8a0907f 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.h
+++ b/drivers/media/dvb/dvb-core/dvb_net.h
@@ -32,6 +32,8 @@
 
 #define DVB_NET_DEVICES_MAX 10
 
+#ifdef CONFIG_DVB_NET
+
 struct dvb_net {
 	struct dvb_device *dvbdev;
 	struct net_device *device[DVB_NET_DEVICES_MAX];
@@ -45,3 +47,27 @@ void dvb_net_release(struct dvb_net *);
 int  dvb_net_init(struct dvb_adapter *, struct dvb_net *, struct dmx_demux *);
 
 #endif
+
+#ifndef CONFIG_DVB_NET
+
+struct dvb_dev_stub;
+
+struct dvb_net {
+	struct dvb_dev_stub *dvbdev;
+};
+
+static inline void dvb_net_release(struct dvb_net *dvbnet)
+{
+	dvbnet-dvbdev = 0;
+}
+
+static inline int dvb_net_init(struct dvb_adapter *adap,
+struct dvb_net *dvbnet, struct dmx_demux *dmx)
+{
+	dvbnet-dvbdev = (void *)1;
+	return 0;
+}
+
+#endif
+
+#endif
-- 
1.7.1.1



[PATCH] Inlined functions should be static.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 446037f0f999759b4b801b6512d18bae769465bb Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 16:06:22 +0200
Subject: [PATCH] Inlined functions should be static.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_algo.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c
index 2da55ec..d70eee0 100644
--- a/drivers/media/dvb/frontends/stb0899_algo.c
+++ b/drivers/media/dvb/frontends/stb0899_algo.c
@@ -23,7 +23,7 @@
 #include stb0899_priv.h
 #include stb0899_reg.h
 
-inline u32 stb0899_do_div(u64 n, u32 d)
+static inline u32 stb0899_do_div(u64 n, u32 d)
 {
 	/* wrap do_div() for ease of use */
 
-- 
1.7.1.1



[PATCH] Increase a timeout, so that bad scheduling does not accidentially cause a timeout.

2011-05-23 Thread Hans Petter Selasky
--HPS
From 18faaafc9cbbe478bb49023bbeae490149048560 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 16:21:47 +0200
Subject: [PATCH] Increase a timeout, so that bad scheduling does not accidentially cause a timeout.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 drivers/media/dvb/frontends/stb0899_drv.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/stb0899_drv.c b/drivers/media/dvb/frontends/stb0899_drv.c
index 37a222d..ddb9141 100644
--- a/drivers/media/dvb/frontends/stb0899_drv.c
+++ b/drivers/media/dvb/frontends/stb0899_drv.c
@@ -706,7 +706,7 @@ static int stb0899_send_diseqc_msg(struct dvb_frontend *fe, struct dvb_diseqc_ma
 	stb0899_write_reg(state, STB0899_DISCNTRL1, reg);
 	for (i = 0; i  cmd-msg_len; i++) {
 		/* wait for FIFO empty	*/
-		if (stb0899_wait_diseqc_fifo_empty(state, 10)  0)
+		if (stb0899_wait_diseqc_fifo_empty(state, 100)  0)
 			return -ETIMEDOUT;
 
 		stb0899_write_reg(state, STB0899_DISFIFO, cmd-msg[i]);
-- 
1.7.1.1



Re: [PATCH] FE_GET_PROPERTY should be _IOW, because the associated structure is transferred from userspace to kernelspace. Keep the old ioctl around for compatibility so that existing code is not brok

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 16:37:18 Andreas Oberritter wrote:
 On 05/23/2011 03:58 PM, Hans Petter Selasky wrote:
  From be7d0f72ebf4d945cfb2a5c9cc871707f72e1e3c Mon Sep 17 00:00:00 2001
  From: Hans Petter Selasky hsela...@c2i.net
  Date: Mon, 23 May 2011 15:56:31 +0200
  Subject: [PATCH] FE_GET_PROPERTY should be _IOW, because the associated
  structure is transferred from userspace to kernelspace. Keep the old
  ioctl around for compatibility so that existing code is not broken.
 

Hi,

 Good catch, but I think _IOWR would be right, because the result gets
 copied from kernelspace to userspace.

Those flags are only for the IOCTL associated structure itself. The V4L DVB 
kernel only reads the dtv_properties structure in either case and does not 
write any data back to it. That's why only _IOW is required.

I checked somewhat and the R/W bits in the IOCTL command does not appear do be 
matched to the R/W permissions you have on the file handle? Or am I mistaken?

In other words the IOCTL R/W (_IOC_READ, _IOC_WRITE) bits should not reflect 
what the IOCTL actually does, like modifying indirect data?

 
 It would be nice if you could send future patches inline rather than
 attached. I'd suggest using git format-patch and git send-email.

I will try to have a look at that. I'm waiting for the 16 patches I've 
submitted today to get reviewed and committed, before I start the next batch.

Thank you!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Add missing include guard to header file.

2011-05-23 Thread Hans Petter Selasky
From 30f6407c5eb67ac8ebf7da169c1f8e500e221db6 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Mon, 23 May 2011 17:10:40 +0200
Subject: [PATCH] Add missing include guard to header file.

Signed-off-by: Hans Petter Selasky hsela...@c2i.net
---
 include/media/videobuf-dvb.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index 07cf4b9..bf36572 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -4,6 +4,9 @@
 #include dvb_net.h
 #include dvb_frontend.h
 
+#ifndef _VIDEOBUF_DVB_H_
+#define_VIDEOBUF_DVB_H_
+
 struct videobuf_dvb {
/* filling that the job of the driver */
char   *name;
@@ -54,6 +57,7 @@ void videobuf_dvb_dealloc_frontends(struct 
videobuf_dvb_frontends *f);
 struct videobuf_dvb_frontend * videobuf_dvb_get_frontend(struct 
videobuf_dvb_frontends *f, int id);
 int videobuf_dvb_find_frontend(struct videobuf_dvb_frontends *f, struct 
dvb_frontend *p);
 
+#endif /* _VIDEOBUF_DVB_H_ */
 
 /*
  * Local variables:
-- 
1.7.1.1


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote:
 Em 23-05-2011 11:37, Hans Petter Selasky escreveu:

 I don't have any ttusb device here, but I doubt that this would work.

Hi,

It is already tested and works fine.

What I see is that interface 1 does not have an alternate setting like the 
driver code expects, while interface 0 does. So it is the opposite of what the 
driver expects. Maybe the manufacturer changed something. Endpoints are still 
the same.

Please find attached an USB descriptor dump from this device.

 
 Alternates should be selected depending on the bandwidth needed. The right
 way is to write some logic that will get the maximum packet size for each
 mode, between the alternates that provide the type of transfer (Bulk or
 ISOC) accepted by the driver.

Right, but this driver doesn't do this. It only selects a working one.

--HPS
ugen6.2: WinTV NOVA-t USB Hauppauge at usbus6, cfg=0 md=HOST spd=FULL 
(12Mbps) pwr=ON

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0100 
  bDeviceClass = 0x 
  bDeviceSubClass = 0x 
  bDeviceProtocol = 0x 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x0b48 
  idProduct = 0x1005 
  bcdDevice = 0x0100 
  iManufacturer = 0x0001  Hauppauge
  iProduct = 0x0002  WinTV NOVA-t USB
  iSerialNumber = 0x  no string
  bNumConfigurations = 0x0001 


 Configuration index 0

bLength = 0x0009 
bDescriptorType = 0x0002 
wTotalLength = 0x019f 
bNumInterfaces = 0x0002 
bConfigurationValue = 0x0001 
iConfiguration = 0x0004  Config0
bmAttributes = 0x0040 
bMaxPower = 0x 

Interface 0
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x 
  bNumEndpoints = 0x0003 
  bInterfaceClass = 0x 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  no string

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  IN
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 1
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0001  OUT
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 2
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0082  IN
bmAttributes = 0x0001  ISOCHRONOUS
wMaxPacketSize = 0x 
bInterval = 0x0001 
bRefresh = 0x 
bSynchAddress = 0x 


Interface 0 Alt 1
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x0001 
  bNumEndpoints = 0x0003 
  bInterfaceClass = 0x 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  no string

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  IN
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 1
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0001  OUT
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 2
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0082  IN
bmAttributes = 0x0001  ISOCHRONOUS
wMaxPacketSize = 0x0390 
bInterval = 0x0001 
bRefresh = 0x 
bSynchAddress = 0x 


Interface 0 Alt 2
  bLength = 0x0009 
  bDescriptorType = 0x0004 
  bInterfaceNumber = 0x 
  bAlternateSetting = 0x0002 
  bNumEndpoints = 0x0003 
  bInterfaceClass = 0x 
  bInterfaceSubClass = 0x 
  bInterfaceProtocol = 0x 
  iInterface = 0x  no string

 Endpoint 0
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0081  IN
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 1
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0001  OUT
bmAttributes = 0x0002  BULK
wMaxPacketSize = 0x0020 
bInterval = 0x 
bRefresh = 0x 
bSynchAddress = 0x 

 Endpoint 2
bLength = 0x0007 
bDescriptorType = 0x0005 
bEndpointAddress = 0x0082  IN
bmAttributes = 0x0001  ISOCHRONOUS
wMaxPacketSize = 0x0360 
bInterval = 0x0001 
bRefresh = 0x 
bSynchAddress

Re: [PATCH] Inlined functions should be static.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 20:29:28 Mauro Carvalho Chehab wrote:
 Em 23-05-2011 15:23, Guennadi Liakhovetski escreveu:
  On Mon, 23 May 2011, Hans Petter Selasky wrote:
  --HPS
  
  (again, inlining would save me copy-pasting)
 
 Yeah... hard to comment not-inlined patches...
 
  -inline u32 stb0899_do_div(u64 n, u32 d)
  +static inline u32 stb0899_do_div(u64 n, u32 d)
  
  while at it you could as well remove the unneeded in a C file inline
  attribute.
 
 hmm... foo_do_div()... it seems to be yet-another-implementation
 of asm/div64.h. If so, it is better to just remove this thing
 and use the existing function.
 

The reason for this patch is that some version of GCC generated some garbage 
code on this function under certain conditions. Removing inline completly on 
this static function in a C file is fine by me. Do I need to create another 
patch?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Make code more readable by not using the return value of the WARN() macro. Set ret variable in an undefined case.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 20:22:02 Guennadi Liakhovetski wrote:
 Please, inline patches. Otherwise, this is what one gets, when replying.
 
 On Mon, 23 May 2011, Hans Petter Selasky wrote:
  --HPS
 
 In any case, just throwing in my 2 cents - no idea how not using the
 return value of WARN() makes code more readable. On the contrary, using it
 is a standard practice. This patch doesn't seem like an improvement to me.

There is no strong reason for the WARN() part, you may ignore that, but the 
ret = 0, part is still valid. Should I generate a new patch or can you handle 
this?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote:
 Em 23-05-2011 15:48, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 11:37, Hans Petter Selasky escreveu:
  
  I don't have any ttusb device here, but I doubt that this would work.
  
  Hi,
  
  It is already tested and works fine.
 
 This will work for you, but it will likely break for the others. Your patch
 is assuming that returning an error if selecting alt 1 is enough to know
 that alt 0 should be used.
 
  What I see is that interface 1 does not have an alternate setting like
  the driver code expects, while interface 0 does. So it is the opposite
  of what the driver expects. Maybe the manufacturer changed something.
  Endpoints are still the same.
 
 That sometimes happen. Or maybe you just need a different size.
 
  Please find attached an USB descriptor dump from this device.
 
 Int 0, endpoint 0:
 
 Interface 0
   bLength = 0x0009
   bDescriptorType = 0x0004
   bInterfaceNumber = 0x
   bAlternateSetting = 0x
   bNumEndpoints = 0x0003
   bInterfaceClass = 0x
   bInterfaceSubClass = 0x
   bInterfaceProtocol = 0x
   iInterface = 0x  no string
 
 ...
 
  Endpoint 2
 bLength = 0x0007
 bDescriptorType = 0x0005
 bEndpointAddress = 0x0082  IN
 bmAttributes = 0x0001  ISOCHRONOUS
 wMaxPacketSize = 0x
 bInterval = 0x0001
 bRefresh = 0x
 bSynchAddress = 0x
 
 ...
 
 Interface 0 Alt 1
   bLength = 0x0009
   bDescriptorType = 0x0004
   bInterfaceNumber = 0x
   bAlternateSetting = 0x0001
   bNumEndpoints = 0x0003
   bInterfaceClass = 0x
   bInterfaceSubClass = 0x
   bInterfaceProtocol = 0x
   iInterface = 0x  no string
 
 ...
  Endpoint 2
 bLength = 0x0007
 bDescriptorType = 0x0005
 bEndpointAddress = 0x0082  IN
 bmAttributes = 0x0001  ISOCHRONOUS
 wMaxPacketSize = 0x0390
 bInterval = 0x0001
 bRefresh = 0x
 bSynchAddress = 0x
 

Hi,

 Hmm... assuming that the driver is using ISOC transfers, the difference
 between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so,
 you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is
 0x390.
 
 What the driver should be doing is to select an alt mode where the
 wMaxPacketSize is big enough to handle the transfer.

I can write the code to do that. Summed up:

1) Search interface 0, for alternate settings that have an ISOC-IN and 
wMaxPacket != 0. Select this alternate setting.

2) Search interface 1, for alternate settings that have an ISOC-IN and 
wMaxPacket != 0. Select this alternate setting.
 
3) Done.

Do you think this will work better?

 Calculating what big enough   is device-dependent, but, basically, a 480
 Mbps USB bus is capable of providing 800 isoc slots per interval. If the
 packets are bigger, the max bandwidth is bigger.

This is a FULL speed device, max 10MBit/second.

 You're able to see the amount of packets per interval by doing a cat
 /proc/bus/usb/devices:
 
 T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 8
 B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
 
 The B: line above shows the USB bandwidth usage.

Do you need this information to proceed with the patch?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 21:47:57 Mauro Carvalho Chehab wrote:
 Em 23-05-2011 16:17, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 15:48, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 11:37, Hans Petter Selasky escreveu:
  
  I don't have any ttusb device here, but I doubt that this would work.
  
  Hi,
  
  It is already tested and works fine.
  
  This will work for you, but it will likely break for the others. Your
  patch is assuming that returning an error if selecting alt 1 is enough
  to know that alt 0 should be used.
  
  What I see is that interface 1 does not have an alternate setting like
  the driver code expects, while interface 0 does. So it is the opposite
  of what the driver expects. Maybe the manufacturer changed something.
  Endpoints are still the same.
  
  That sometimes happen. Or maybe you just need a different size.
  
  Please find attached an USB descriptor dump from this device.
  
  Int 0, endpoint 0:
  Interface 0
  
bLength = 0x0009
bDescriptorType = 0x0004
bInterfaceNumber = 0x
bAlternateSetting = 0x
bNumEndpoints = 0x0003
bInterfaceClass = 0x
bInterfaceSubClass = 0x
bInterfaceProtocol = 0x
iInterface = 0x  no string
  
  ...
  
   Endpoint 2
   
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0082  IN
  bmAttributes = 0x0001  ISOCHRONOUS
  wMaxPacketSize = 0x
  bInterval = 0x0001
  bRefresh = 0x
  bSynchAddress = 0x
  
  ...
  
  Interface 0 Alt 1
  
bLength = 0x0009
bDescriptorType = 0x0004
bInterfaceNumber = 0x
bAlternateSetting = 0x0001
bNumEndpoints = 0x0003
bInterfaceClass = 0x
bInterfaceSubClass = 0x
bInterfaceProtocol = 0x
iInterface = 0x  no string
  
  ...
  
   Endpoint 2
   
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0082  IN
  bmAttributes = 0x0001  ISOCHRONOUS
  wMaxPacketSize = 0x0390
  bInterval = 0x0001
  bRefresh = 0x
  bSynchAddress = 0x
  
  Hi,
  
  Hmm... assuming that the driver is using ISOC transfers, the difference
  between alt 0 and alt 1 is that, on alt0, the mwMaxPacketSize is 0 (so,
  you can't use it for isoc transfers), while, on alt 1, wMaxPacketSize is
  0x390.
  
  What the driver should be doing is to select an alt mode where the
  wMaxPacketSize is big enough to handle the transfer.
  
  I can write the code to do that. Summed up:
  
  1) Search interface 0, for alternate settings that have an ISOC-IN and
  wMaxPacket != 0. Select this alternate setting.
  
  2) Search interface 1, for alternate settings that have an ISOC-IN and
  wMaxPacket != 0. Select this alternate setting.
  
  3) Done.
  
  Do you think this will work better?
  
  Calculating what big enough   is device-dependent, but, basically, a
  480 Mbps USB bus is capable of providing 800 isoc slots per interval.
  If the packets are bigger, the max bandwidth is bigger.
  
  This is a FULL speed device, max 10MBit/second.
 
 Hmm... USB 1.1 devices are even more limited on the amount of used
 bandwidth. The above procedure is better than the one you've proposed, but
 yet you may not be able to receive channels with higher bandwidths.
 
 The usb max limit is lower than the maximum bandwidth. I think that full
 speed provides 900 isoc slots per interval, but the interval for usb 1.1 is
 higher (1s, while the interval for usb 2.0 is 125 us), but you need to
 double check such constraints at the USB 1.1 and 2.0 specs, as I may be
 wrong on that, as I read it a long time ago ;)

Hi,

There are 1000 frames per second when using Full Speed USB. I know the device 
cannot receive all streams, but it is very well suited for DVB radio.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Alternate setting 1 must be selected for interface 0 on the model that I received. Else the rest is identical.

2011-05-23 Thread Hans Petter Selasky
On Monday 23 May 2011 22:04:07 Mauro Carvalho Chehab wrote:
 Em 23-05-2011 16:52, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 21:47:57 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 16:17, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 21:06:32 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 15:48, Hans Petter Selasky escreveu:
  On Monday 23 May 2011 20:14:45 Mauro Carvalho Chehab wrote:
  Em 23-05-2011 11:37, Hans Petter Selasky escreveu:
  
  I don't have any ttusb device here, but I doubt that this would
  work.
  
  Hi,
  
  It is already tested and works fine.
  
  This will work for you, but it will likely break for the others. Your
  patch is assuming that returning an error if selecting alt 1 is enough
  to know that alt 0 should be used.
  
  What I see is that interface 1 does not have an alternate setting
  like the driver code expects, while interface 0 does. So it is the
  opposite of what the driver expects. Maybe the manufacturer changed
  something. Endpoints are still the same.
  
  That sometimes happen. Or maybe you just need a different size.
  
  Please find attached an USB descriptor dump from this device.
  
  Int 0, endpoint 0:
  Interface 0
  
bLength = 0x0009
bDescriptorType = 0x0004
bInterfaceNumber = 0x
bAlternateSetting = 0x
bNumEndpoints = 0x0003
bInterfaceClass = 0x
bInterfaceSubClass = 0x
bInterfaceProtocol = 0x
iInterface = 0x  no string
  
  ...
  
   Endpoint 2
   
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0082  IN
  bmAttributes = 0x0001  ISOCHRONOUS
  wMaxPacketSize = 0x
  bInterval = 0x0001
  bRefresh = 0x
  bSynchAddress = 0x
  
  ...
  
  Interface 0 Alt 1
  
bLength = 0x0009
bDescriptorType = 0x0004
bInterfaceNumber = 0x
bAlternateSetting = 0x0001
bNumEndpoints = 0x0003
bInterfaceClass = 0x
bInterfaceSubClass = 0x
bInterfaceProtocol = 0x
iInterface = 0x  no string
  
  ...
  
   Endpoint 2
   
  bLength = 0x0007
  bDescriptorType = 0x0005
  bEndpointAddress = 0x0082  IN
  bmAttributes = 0x0001  ISOCHRONOUS
  wMaxPacketSize = 0x0390
  bInterval = 0x0001
  bRefresh = 0x
  bSynchAddress = 0x
  
  Hi,
  
  Hmm... assuming that the driver is using ISOC transfers, the
  difference between alt 0 and alt 1 is that, on alt0, the
  mwMaxPacketSize is 0 (so, you can't use it for isoc transfers),
  while, on alt 1, wMaxPacketSize is 0x390.
  
  What the driver should be doing is to select an alt mode where the
  wMaxPacketSize is big enough to handle the transfer.
  
  I can write the code to do that. Summed up:
  
  1) Search interface 0, for alternate settings that have an ISOC-IN and
  wMaxPacket != 0. Select this alternate setting.
  
  2) Search interface 1, for alternate settings that have an ISOC-IN and
  wMaxPacket != 0. Select this alternate setting.
  
  3) Done.
  
  Do you think this will work better?
  
  Calculating what big enough   is device-dependent, but, basically, a
  480 Mbps USB bus is capable of providing 800 isoc slots per interval.
  If the packets are bigger, the max bandwidth is bigger.
  
  This is a FULL speed device, max 10MBit/second.
  
  Hmm... USB 1.1 devices are even more limited on the amount of used
  bandwidth. The above procedure is better than the one you've proposed,
  but yet you may not be able to receive channels with higher bandwidths.
  
  The usb max limit is lower than the maximum bandwidth. I think that
  full speed provides 900 isoc slots per interval, but the interval for
  usb 1.1 is higher (1s, while the interval for usb 2.0 is 125 us), but
  you need to double check such constraints at the USB 1.1 and 2.0 specs,
  as I may be wrong on that, as I read it a long time ago ;)
  
  Hi,
  
  There are 1000 frames per second when using Full Speed USB.
 
 No, it is 900. See [1]:
 
 [1]
 http://www.google.com.br/url?sa=tsource=webcd=1ved=0CBgQFjAAurl=http%3
 A%2F%2Fmprolab.teipir.gr%2Fvivlio80X86%2Fusb11.pdfei=DrzaTfD5HqW90AHY-Jn8A
 wusg=AFQjCNHZW7ogFrjqoim1lTduQTHTDJoAUg
 
 5.6.4 Isochronous Transfer Bus Access Constraints
  Isochronous transfers can be used only by full-speed devices.
  The USB requires that no more than 90% of any frame be allocated for
 periodic (isochronous and interrupt) transfers.
 
 90% of 1000 frames is 900 frames/s. That's the maximum limit for ISOC
 transfers.

Hi,

FULL speed USB has 1000 frames per second which is constant. During each frame 
that last 1ms you can send max 1200 bytes approximately simplex. You are 
allowed to use up to 90% of 1200 bytes, which is 1080 bytes which is just 
above the maximum of 1023 bytes for isochronous transfers.

Hope you see now!

--HPS
--
To unsubscribe from

Re: [RFC] Make dvb_net.c optional

2011-05-22 Thread Hans Petter Selasky
On Saturday 21 May 2011 12:58:33 Mauro Carvalho Chehab wrote:
 Em 19-05-2011 05:35, Hans Petter Selasky escreveu:
  Hi,
  
  In my setup I am building the DVB code without dvb_net.c, because there
  is no IP-stack currently in my Linux kernel. Is this worth a separate
  configuration entry?
 
 I have no problems with that, but your patch is wrong ;) It is not adding
 the new symbol at the Kconfig. IMHO, if we add such patch, the defaut for
 config DVB_NET should be y, and such symbol needs to depend on having the
 network enabled.

Yes, I know my patch is not complete. Then I will go ahead and make a complete 
patch and post it. Thank you!

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCHES] Various MODULE parameter releated fixes

2011-05-22 Thread Hans Petter Selasky
On Saturday 21 May 2011 13:01:57 Mauro Carvalho Chehab wrote:
 Em 19-05-2011 05:38, Hans Petter Selasky escreveu:
  --HPS
 
 The patches look sane, but, please send one patch per email. Otherwise,
 only the first patch will be caught by patchwork:
   https://patchwork.kernel.org/patch/796522/
 
 Also, please sign your patches (with Signed-off-by:) and send them
 in-lined, otherwise replies (like this one) become very bad, as the patch
 is not replied on most email clients used by developers.

Ok. Got it. Will do.

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] Make dvb_net.c optional

2011-05-19 Thread Hans Petter Selasky
Hi,

In my setup I am building the DVB code without dvb_net.c, because there is no 
IP-stack currently in my Linux kernel. Is this worth a separate 
configuration entry?

--HPS
From e7fe34933638e882e1ed1eab1761ecd14ef9125e Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 19 May 2011 02:26:33 +0200
Subject: [PATCH] Make dvb_net configurable.

---
 ../media_tree/drivers/media/dvb/dvb-core/Makefile |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/../media_tree/drivers/media/dvb/dvb-core/Makefile b/../media_tree/drivers/media/dvb/dvb-core/Makefile
index 0b51828..8f22bcd 100644
--- a/../media_tree/drivers/media/dvb/dvb-core/Makefile
+++ b/../media_tree/drivers/media/dvb/dvb-core/Makefile
@@ -2,8 +2,10 @@
 # Makefile for the kernel DVB device drivers.
 #
 
+dvb-net-$(CONFIG_DVB_NET) := dvb_net.o
+
 dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o 	\
 		 dvb_ca_en50221.o dvb_frontend.o 		\
-		 dvb_net.o dvb_ringbuffer.o dvb_math.o
+		 $(dvb-net-y) dvb_ringbuffer.o dvb_math.o
 
 obj-$(CONFIG_DVB_CORE) += dvb-core.o
-- 
1.7.1.1



[PATCHES] Various MODULE parameter releated fixes

2011-05-19 Thread Hans Petter Selasky
--HPS
From 0e135fa9cd9cb377bd8930253a547d6d9ae6d01b Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 19 May 2011 02:46:40 +0200
Subject: [PATCH] Parameter description should be after parameter.

---
 ../media_tree/drivers/media/video/tda7432.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/../media_tree/drivers/media/video/tda7432.c b/../media_tree/drivers/media/video/tda7432.c
index 3941f95..398b9fb 100644
--- a/../media_tree/drivers/media/video/tda7432.c
+++ b/../media_tree/drivers/media/video/tda7432.c
@@ -50,8 +50,8 @@ static int loudness; /* disable loudness by default */
 static int debug;	 /* insmod parameter */
 module_param(debug, int, S_IRUGO | S_IWUSR);
 module_param(loudness, int, S_IRUGO);
-MODULE_PARM_DESC(maxvol,Set maximium volume to +20db (0), default is 0db(1));
 module_param(maxvol, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(maxvol,Set maximium volume to +20db (0), default is 0db(1));
 
 
 
-- 
1.7.1.1

From 7191938e7da088ccb5e8bad36e99ca495e53d206 Mon Sep 17 00:00:00 2001
From: Hans Petter Selasky hsela...@c2i.net
Date: Thu, 19 May 2011 02:56:48 +0200
Subject: [PATCH] Remove invalid parameter description.

---
 ../media_tree/drivers/media/dvb/frontends/tda8261.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/../media_tree/drivers/media/dvb/frontends/tda8261.c b/../media_tree/drivers/media/dvb/frontends/tda8261.c
index 1742056..53c7d8f 100644
--- a/../media_tree/drivers/media/dvb/frontends/tda8261.c
+++ b/../media_tree/drivers/media/dvb/frontends/tda8261.c
@@ -224,7 +224,6 @@ exit:
 }
 
 EXPORT_SYMBOL(tda8261_attach);
-MODULE_PARM_DESC(verbose, Set verbosity level);
 
 MODULE_AUTHOR(Manu Abraham);
 MODULE_DESCRIPTION(TDA8261 8PSK/QPSK Tuner);
-- 
1.7.1.1

--- cx24116.c.orig	2011-03-20 23:11:40.0 +0100
+++ cx24116.c	2011-03-20 23:12:35.0 +0100
@@ -137,7 +137,7 @@
 /* SNR measurements */
 static int esno_snr;
 module_param(esno_snr, int, 0644);
-MODULE_PARM_DESC(debug, SNR return units, 0=PERCENTAGE 0-100, \
+MODULE_PARM_DESC(esno_snr, SNR return units, 0=PERCENTAGE 0-100, \
 	1=ESNO(db * 10) (default:0));
 
 enum cmds {


Re: [RFC v3] V4L2 API for flash devices

2011-04-15 Thread Hans Petter Selasky
On Friday 15 April 2011 09:37:17 Sakari Ailus wrote:
 Hi,
 
 This is a third proposal for an interface for controlling flash devices
 on the V4L2/v4l2_subdev APIs. My plan is to use the interface in the
 ADP1653 driver, the flash controller used in the Nokia N900.
 
 Thanks to everyone who commented the previous version of this RFC! I
 hope I managed to factor in everyone's comments. Please bug me if you
 think I missed something. :-)
 
 Comments and questions are very, very welcome as always. There are still
 many open questions which I would like to resolve. I've written my
 proposal on the two last ones below the question itself.
 

Hi,

I looked through your specification and did not find the answer to my 
question. Do you support more than one flasher per webcam/camera?

--HPS
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cx24116.c - fix for wrong parameter description

2011-03-28 Thread Hans Petter Selasky

See attachment.

--HPS
--- cx24116.c.orig	2011-03-20 23:11:40.0 +0100
+++ cx24116.c	2011-03-20 23:12:35.0 +0100
@@ -137,7 +137,7 @@
 /* SNR measurements */
 static int esno_snr;
 module_param(esno_snr, int, 0644);
-MODULE_PARM_DESC(debug, SNR return units, 0=PERCENTAGE 0-100, \
+MODULE_PARM_DESC(esno_snr, SNR return units, 0=PERCENTAGE 0-100, \
 	1=ESNO(db * 10) (default:0));
 
 enum cmds {


Add support for [non-standard?] DiSEqC switch MAXIMUM DiSEqC 4/1

2011-03-14 Thread Hans Petter Selasky
Hi,

The local guy over here mounted what he claimed is a fully standard 4/1
DiSEqC switch which works with every sat-receiver around. After some
brief investigation, it appears this DiSEqC switch is using a non-standard?
scheme, which is not supported by w_scan nor vdr. Correct me if I'm wrong.

To get the switch working with VDR I need an option to turn off the switch
power. This is part of the sequence to program the switch.

I've attached patches for w_scan and VDR to work with the DiSEqC
switch I've got. I don't have any documentation on the switch. All the
programming was the result of two days of reverse engineering. And I did
not open the switch either :-)

Manufacturer homepage:
http://www.kjaerulff1.com/en-gb/p/30_maximum_diseqc_41_switch

Information needed for VDR's diseqc.conf

#
# Full sequence for LNB-A
#
LNB.A 11700 V  9750 t F W45 v W15 W45 F W45 v W15 W45 t W45
LNB.A 9 V 10600 t F W45 v W15 W45 F W45 v W15 W45 T W45
LNB.A 11700 H  9750 t F W45 V W15 W45 F W45 V W15 W45 t W45
LNB.A 9 H 10600 t F W45 V W15 W45 F W45 V W15 W45 T W45

#
# Full sequence for LNB-B
#
LNB.B 11700 V  9750 t F W45 v W15 [E0 10 26] W45 F W45 v W15 [E0 10 26] W45 t 
W45
LNB.B 9 V 10600 t F W45 v W15 [E0 10 26] W45 F W45 v W15 [E0 10 26] W45 T 
W45
LNB.B 11700 H  9750 t F W45 V W15 [E0 10 26] W45 F W45 V W15 [E0 10 26] W45 t 
W45
LNB.B 9 H 10600 t F W45 V W15 [E0 10 26] W45 F W45 V W15 [E0 10 26] W45 T 
W45

#
# Full sequence for LNB-C
#
LNB.C 11700 V  9750 t F W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 27] W45 t 
W45
LNB.C 9 V 10600 t F W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 27] W45 T 
W45
LNB.C 11700 H  9750 t F W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 27] W45 t 
W45
LNB.C 9 H 10600 t F W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 27] W45 T 
W45

#
# Full sequence for LNB-D
#
LNB.D 11700 V  9750 t F W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 26] W45 F 
W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 26] W45 t W45
LNB.D 9 V 10600 t F W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 26] W45 F 
W45 v W15 [E0 10 27] W45 F W45 v W15 [E0 10 26] W45 T W45
LNB.D 11700 H  9750 t F W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 26] W45 F 
W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 26] W45 t W45
LNB.D 9 H 10600 t F W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 26] W45 F 
W45 V W15 [E0 10 27] W45 F W45 V W15 [E0 10 26] W45 T W45


Good luck!

I hope the patches can be included into VDR and w_scan. Not sure if this is the 
right list to post the patches.

--HPS
diff -u -r work.orig/vdr-1.7.16/diseqc.c work/vdr-1.7.16/diseqc.c
--- work.orig/vdr-1.7.16/diseqc.c	2011-03-13 15:01:52.0 +0100
+++ work/vdr-1.7.16/diseqc.c	2011-03-13 15:02:26.0 +0100
@@ -137,6 +137,7 @@
   case ' ': break;
   case 't': return daToneOff;
   case 'T': return daToneOn;
+  case 'F': return daVoltageOff;
   case 'v': return daVoltage13;
   case 'V': return daVoltage18;
   case 'A': return daMiniA;
diff -u -r work.orig/vdr-1.7.16/diseqc.conf work/vdr-1.7.16/diseqc.conf
--- work.orig/vdr-1.7.16/diseqc.conf	2011-03-13 15:01:52.0 +0100
+++ work/vdr-1.7.16/diseqc.conf	2011-03-13 15:02:40.0 +0100
@@ -14,6 +14,7 @@
 # command:
 #   t tone off
 #   T tone on
+#   F voltage off (0V)
 #   v voltage low (13V)
 #   V voltage high (18V)
 #   A mini A
diff -u -r work.orig/vdr-1.7.16/diseqc.h work/vdr-1.7.16/diseqc.h
--- work.orig/vdr-1.7.16/diseqc.h	2011-03-13 15:01:52.0 +0100
+++ work/vdr-1.7.16/diseqc.h	2011-03-13 15:02:49.0 +0100
@@ -18,6 +18,7 @@
 daNone,
 daToneOff,
 daToneOn,
+daVoltageOff,
 daVoltage13,
 daVoltage18,
 daMiniA,
diff -u -r work.orig/vdr-1.7.16/dvbdevice.c work/vdr-1.7.16/dvbdevice.c
--- work.orig/vdr-1.7.16/dvbdevice.c	2011-03-13 15:01:52.0 +0100
+++ work/vdr-1.7.16/dvbdevice.c	2011-03-13 15:03:14.0 +0100
@@ -402,6 +402,7 @@
 case cDiseqc::daNone:  break;
 case cDiseqc::daToneOff:   CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_OFF)); break;
 case cDiseqc::daToneOn:CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_ON)); break;
+case cDiseqc::daVoltageOff: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_OFF)); break;
 case cDiseqc::daVoltage13: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_13)); break;
 case cDiseqc::daVoltage18: CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, SEC_VOLTAGE_18)); break;
 case cDiseqc::daMiniA: CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_A)); break;
diff -u -r work.orig/vdr-1.7.16/include/vdr/diseqc.h work/vdr-1.7.16/include/vdr/diseqc.h
--- work.orig/vdr-1.7.16/include/vdr/diseqc.h	2011-03-13 15:01:52.0 +0100
+++ work/vdr-1.7.16/include/vdr/diseqc.h	2011-03-13 15:02:49.0 +0100
@@ -18,6 +18,7 @@
 daNone,