All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Merle <thierry.merle@free.fr>
To: Tomi Orava <tomimo@ncircle.nullnet.fi>
Cc: linux-dvb@linuxtv.org
Subject: Re: [linux-dvb] Testers wanted for alternative version of Terratec Cinergy T2 driver
Date: Thu, 08 May 2008 23:18:23 +0200	[thread overview]
Message-ID: <48236E1F.5080300@free.fr> (raw)
In-Reply-To: <4821F9A9.6030304@ncircle.nullnet.fi>

[-- Attachment #1: Type: text/plain, Size: 5401 bytes --]

Tomi Orava a écrit :
> 
> Hi,
> 
>>>> Well, I see some issues after taking a closer look at your driver:
>>>> 1- checkpatch.pl raises errors: 90 errors, 53 warnings, 995 lines
>>>> checked
>>>> 2- there is a compilation error (I applied the patch on the latest
>>>> v4l-dvb tree):
>>>> cinergyT2-core.c: In function 'cinergyt2_usb_probe':
>>>> cinergyT2-core.c:138: error: too few arguments to function
>>>> 'dvb_usb_device_init'
>>>> 3- you should replace the existing driver, not proposing a different
>>>> driver. I mean, patch directly
>>>> linux/drivers/media/dvb/cinergyT2/cinergyT2.c.
> 
> I did some cleanups pointed by the checkpach.pl script.
Good! No more error.

> However, I did not replace the original Cinergy T2 driver
> as I think that this new driver should be located in the
> very same directory as the rest of the usb-dvb drivers.
> 
Agreed, but you should remove the old cinergyT2 driver.

Furthermore there is another issue: when I plug the device, the device usage count is set to 0.
When I remove the device the device usage count goes to -1 (displayed as 4294967295).
This is a misbehavior of the dvb framework but perhaps something needs to be initialized somewhere in the driver. I will look at it...dvb-usb: TerraTec/qanu USB2.0 Highspeed DVB-T Receiver successfully initialized and connected.
I noticed this error when I plug the device (I load manually the driver before, so I suspect a thing in the probe function):
sysfs: duplicate filename 'cinergyT2' can not be created
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Pid: 2922, comm: modprobe Not tainted 2.6.24.3 #13
 [<c017896a>] sysfs_add_one+0x54/0xb7
 [<c0178d8c>] create_dir+0x3c/0x6b
 [<c0178de8>] sysfs_create_dir+0x2d/0x40
 [<c01a8d07>] kobject_get+0xf/0x13
 [<c01a90fc>] kobject_add+0xd3/0x17a
 [<c01a91f7>] kobject_register+0x19/0x2d
 [<c02013b0>] bus_add_driver+0x50/0x197
 [<e00c7e07>] usb_register_driver+0x66/0xc8 [usbcore]
 [<c0142813>] __vunmap+0xbd/0xd1
 [<e023c018>] cinergyt2_init+0x18/0x5a [cinergyT2]
 [<c012421f>] blocking_notifier_call_chain+0x17/0x1a
 [<c012b688>] sys_init_module+0x11d4/0x12e9
 [<c0103bc2>] syscall_call+0x7/0xb
 [<c0280000>] __xfrm_lookup+0x1b/0x460
 =======================
kobject_add failed for cinergyT2 with -EEXIST, don't try to register things with the same name in the same directory.
Pid: 2922, comm: modprobe Not tainted 2.6.24.3 #13
 [<c01a9171>] kobject_add+0x148/0x17a
 [<c01a91f7>] kobject_register+0x19/0x2d
 [<c02013b0>] bus_add_driver+0x50/0x197
 [<e00c7e07>] usb_register_driver+0x66/0xc8 [usbcore]
 [<c0142813>] __vunmap+0xbd/0xd1
 [<e023c018>] cinergyt2_init+0x18/0x5a [cinergyT2]
 [<c012421f>] blocking_notifier_call_chain+0x17/0x1a
 [<c012b688>] sys_init_module+0x11d4/0x12e9
 [<c0103bc2>] syscall_call+0x7/0xb
 [<c0280000>] __xfrm_lookup+0x1b/0x460
 =======================
usbcore: error -17 registering interface 	driver cinergyT2

> The current patch is against the v4l-dvb tree.
> 
> Regards,
> Tomi Orava
> 
> diff -r 41b3f12d6ce4 linux/drivers/media/dvb/dvb-usb/Kconfig
> --- a/linux/drivers/media/dvb/dvb-usb/Kconfig	Tue May 06 11:09:01 2008 -0300
> +++ b/linux/drivers/media/dvb/dvb-usb/Kconfig	Wed May 07 22:34:53 2008 +0300
> @@ -241,3 +241,11 @@ config DVB_USB_AF9005_REMOTE
>  	  Say Y here to support the default remote control decoding for the
>  	  Afatech AF9005 based receiver.
>  
> +config 	DVB_USB_CINERGY_T2
> +	tristate "Alternative driver for Terratec CinergyT2/qanu USB2 DVB-T receiver"
Just remove the "Alternative" word.
[SNIP]
> diff -r 41b3f12d6ce4 linux/drivers/media/dvb/dvb-usb/cinergyT2-core.c
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/linux/drivers/media/dvb/dvb-usb/cinergyT2-core.c	Wed May 07 22:34:53 2008 +0300
> @@ -0,0 +1,235 @@
[SNIP]
> +
> +/* slightly modified version of dvb_usb_generic_rw -function */
> +
> +int cinergyt2_cmd(struct dvb_usb_device *d, char *wbuf, int wlen,
> +			char *rbuf, int rlen, int delay_ms)
> +{
I studied the differences between this function and the original dvb_usb_generic_rw function.
The only difference is that cinergyt2_cmd returns the number of bytes that usb_bulk_msg has read (actlen).
This value is only used in cinergyT2-remote that can be removed (see further) so this function should be removed and calls replaced by the original dvb_usb_generic_rw
[SNIP}
> diff -r 41b3f12d6ce4 linux/drivers/media/dvb/dvb-usb/cinergyT2-remote.c
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/linux/drivers/media/dvb/dvb-usb/cinergyT2-remote.c	Wed May 07 22:34:53 2008 +0300
> @@ -0,0 +1,336 @@
[SNIP]
> +struct cinergyt2_rc_key cinergyt2_rc_keys[] = {
> +	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfe01eb04, 	KEY_POWER },
In fact, the rc keycodes are nearly standard:
first byte=RC event type (CINERGYT2_RC_EVENT_TYPE_NONE, CINERGYT2_RC_EVENT_TYPE_NEC, CINERGYT2_RC_EVENT_TYPE_RC5)
then comes a couple of bytes: the custom code=0x04 and the custom code "checksum" =0xeb
then the last couple of bytes: the key code=0x01 and the key code checksum=0xfe
This processing is done in a same way in dvd-usb-remote.
I joined to this email a patch against your patch that uses this module. Obviously you can integrate in your patch .
I will look at the module count problem and the irrecord problem, we are close to propose this beautiful patch ;)
Cheers,
Thierry


[-- Attachment #2: remove_cinergyT2_remote.patch --]
[-- Type: text/plain, Size: 14405 bytes --]

diff -r f51aa257acfa linux/drivers/media/dvb/dvb-usb/Makefile
--- a/linux/drivers/media/dvb/dvb-usb/Makefile	Thu May 08 22:53:56 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/Makefile	Thu May 08 23:06:34 2008 +0200
@@ -61,7 +61,7 @@
 dvb-usb-af9005-remote-objs = af9005-remote.o
 obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
 
-dvb-usb-cinergyT2-objs = cinergyT2-core.o cinergyT2-fe.o cinergyT2-remote.o
+dvb-usb-cinergyT2-objs = cinergyT2-core.o cinergyT2-fe.o
 obj-$(CONFIG_DVB_USB_CINERGY_T2) += dvb-usb-cinergyT2.o
 
 
diff -r f51aa257acfa linux/drivers/media/dvb/dvb-usb/cinergyT2-core.c
--- a/linux/drivers/media/dvb/dvb-usb/cinergyT2-core.c	Thu May 08 22:53:56 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/cinergyT2-core.c	Thu May 08 23:06:34 2008 +0200
@@ -37,10 +37,6 @@
 module_param_named(debug, dvb_usb_cinergyt2_debug, int, 0644);
 MODULE_PARM_DESC(debug, "set debugging level (1=info, xfer=2, rc=4 "
 		"(or-able)).");
-
-module_param_named(disable_remote, disable_remote, int, 0644);
-MODULE_PARM_DESC(disable_remote, "Disable remote controller support (int)");
-
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
@@ -135,9 +131,65 @@
 	/* Copy this pointer as we are gonna need it in the release phase */
 	cinergyt2_usb_device = adap->dev;
 
-	ret = cinergyt2_remote_init(adap->dev);
-	if (ret)
-		err("could not initialize remote control.");
+	return 0;
+}
+
+static struct dvb_usb_rc_key cinergyt2_rc_keys [] = {
+	{ 0x04,	0x01,	KEY_POWER },
+	{ 0x04,	0x02,	KEY_1 },
+	{ 0x04,	0x03,	KEY_2 },
+	{ 0x04,	0x04,	KEY_3 },
+	{ 0x04,	0x05,	KEY_4 },
+	{ 0x04,	0x06,	KEY_5 },
+	{ 0x04,	0x07,	KEY_6 },
+	{ 0x04,	0x08,	KEY_7 },
+	{ 0x04,	0x09,	KEY_8 },
+	{ 0x04,	0x0a,	KEY_9 },
+	{ 0x04,	0x0c,	KEY_0 },
+	{ 0x04,	0x0b,	KEY_VIDEO },
+	{ 0x04,	0x0d,	KEY_REFRESH },
+	{ 0x04,	0x0e,	KEY_SELECT },
+	{ 0x04,	0x0f,	KEY_EPG },
+	{ 0x04,	0x10,	KEY_UP },
+	{ 0x04,	0x14,	KEY_DOWN },
+	{ 0x04,	0x11,	KEY_LEFT },
+	{ 0x04,	0x13,	KEY_RIGHT },
+	{ 0x04,	0x12,	KEY_OK },
+	{ 0x04,	0x15,	KEY_TEXT },
+	{ 0x04,	0x16,	KEY_INFO },
+	{ 0x04,	0x17,	KEY_RED },
+	{ 0x04,	0x18,	KEY_GREEN },
+	{ 0x04,	0x19,	KEY_YELLOW },
+	{ 0x04,	0x1a,	KEY_BLUE },
+	{ 0x04,	0x1c,	KEY_VOLUMEUP },
+	{ 0x04,	0x1e,	KEY_VOLUMEDOWN },
+	{ 0x04,	0x1d,	KEY_MUTE },
+	{ 0x04,	0x1b,	KEY_CHANNELUP },
+	{ 0x04,	0x1f,	KEY_CHANNELDOWN },
+	{ 0x04,	0x40,	KEY_PAUSE },
+	{ 0x04,	0x4c,	KEY_PLAY },
+	{ 0x04,	0x58,	KEY_RECORD },
+	{ 0x04,	0x54,	KEY_PREVIOUS },
+	{ 0x04,	0x48,	KEY_STOP },
+	{ 0x04,	0x5c,	KEY_NEXT }
+};
+
+static int cinergyt2_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+{
+	u8 key[5]={0,0,0,0,0},cmd = CINERGYT2_EP1_GET_RC_EVENTS;
+	*state = REMOTE_NO_KEY_PRESSED;
+
+	cinergyt2_cmd(d,&cmd,1,key,sizeof(key),0);
+	if(key[4] == 0xff) {
+		return 0;
+	}
+
+	/* hack to pass checksum on the custom field (is set to 0xeb) */
+	key[2] = ~0x04;
+	dvb_usb_nec_rc_key_to_event(d,key,event,state);
+ 	if (key[0] != 0)
+		deb_info("key: %x %x %x %x %x\n",
+			 key[0],key[1],key[2],key[3],key[4]);
 
 	return 0;
 }
@@ -182,9 +234,9 @@
 	.power_ctrl       = cinergyt2_power_ctrl,
 
 	.rc_interval      = 50,
-	.rc_key_map       = 0,
-	.rc_key_map_size  = 0,
-	.rc_query         = 0,
+	.rc_key_map       = cinergyt2_rc_keys,
+	.rc_key_map_size  = ARRAY_SIZE(cinergyt2_rc_keys),
+	.rc_query         = cinergyt2_rc_query,
 
 	.generic_bulk_ctrl_endpoint = 1,
 
@@ -223,7 +275,6 @@
 
 static void __exit cinergyt2_usb_exit(void)
 {
-	cinergyt2_remote_exit(cinergyt2_usb_device);
 	usb_deregister(&cinergyt2_driver);
 }
 
diff -r f51aa257acfa linux/drivers/media/dvb/dvb-usb/cinergyT2-remote.c
--- a/linux/drivers/media/dvb/dvb-usb/cinergyT2-remote.c	Thu May 08 22:53:56 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*
- * TerraTec Cinergy T2/qanu USB2 DVB-T adapter.
- *
- * Copyright (C) 2007 Tomi Orava (tomimo@ncircle.nullnet.fi)
- *
- * Based on the dvb-usb-framework code and the
- * original Terratec Cinergy T2 driver by:
- *
- * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
- *		    Holger Waechtler <holger@qanu.de>
- *
- *  Protocol Spec published on http://qanu.de/specs/terratec_cinergyT2.pdf
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include "cinergyT2.h"
-
-enum {
-	CINERGYT2_RC_EVENT_TYPE_NONE = 0x00,
-	CINERGYT2_RC_EVENT_TYPE_NEC  = 0x01,
-	CINERGYT2_RC_EVENT_TYPE_RC5  = 0x02
-};
-
-/**
- * struct dvb_usb_rc_key - a remote control key and its input-event
- * @custom: the vendor/custom part of the key
- * @data: the actual key part
- * @event: the input event assigned to key identified by custom and data
- */
-struct cinergyt2_rc_key {
-	u32 custom;
-	u32 data;
-	u32 event;
-};
-
-
-struct cinergyt2_rc_event {
-	char custom;
-	uint32_t data;
-} __attribute__((packed));
-
-
-extern int disable_remote;
-
-struct cinergyt2_rc_key cinergyt2_rc_keys[] = {
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfe01eb04, 	KEY_POWER },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfd02eb04, 	KEY_1 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfc03eb04, 	KEY_2 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfb04eb04, 	KEY_3 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xfa05eb04, 	KEY_4 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf906eb04, 	KEY_5 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf807eb04, 	KEY_6 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf708eb04, 	KEY_7 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf609eb04, 	KEY_8 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf50aeb04, 	KEY_9 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf30ceb04, 	KEY_0 },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf40beb04, 	KEY_VIDEO },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf20deb04, 	KEY_REFRESH },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf10eeb04, 	KEY_SELECT },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xf00feb04, 	KEY_EPG },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xef10eb04, 	KEY_UP },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xeb14eb04, 	KEY_DOWN },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xee11eb04, 	KEY_LEFT },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xec13eb04, 	KEY_RIGHT },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xed12eb04, 	KEY_OK },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xea15eb04, 	KEY_TEXT },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe916eb04, 	KEY_INFO },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe817eb04, 	KEY_RED },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe718eb04, 	KEY_GREEN },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe619eb04, 	KEY_YELLOW },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe51aeb04, 	KEY_BLUE },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe31ceb04, 	KEY_VOLUMEUP },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe11eeb04, 	KEY_VOLUMEDOWN },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe21deb04, 	KEY_MUTE },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe41beb04, 	KEY_CHANNELUP },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xe01feb04, 	KEY_CHANNELDOWN },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xbf40eb04, 	KEY_PAUSE },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xb34ceb04, 	KEY_PLAY },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xa758eb04, 	KEY_RECORD },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xab54eb04, 	KEY_PREVIOUS },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xb748eb04, 	KEY_STOP },
-	{ CINERGYT2_RC_EVENT_TYPE_NEC, 	0xa35ceb04, 	KEY_NEXT }
-};
-
-int cinergyt2_rc_keys_size = ARRAY_SIZE(cinergyt2_rc_keys);
-
-
-static int cinergyt2_decode_rc_key(struct dvb_usb_device *dev, int type,
-					int data, u32 *event, int *state)
-{
-	int i, key, found;
-
-	*state = REMOTE_NO_KEY_PRESSED;
-	key = le32_to_cpu(data);
-
-	/* info("cinergyt2_decode_rc_key() type=%d, key=0x%x \
-	* 		(converted=0x%x)\n", type, data, key);
-	*/
-
-	switch (type) {
-	case CINERGYT2_RC_EVENT_TYPE_NEC:
-		if (key == ~0) {
-			/* Stop key repeat */
-			*state = REMOTE_NO_KEY_PRESSED;
-			break;
-		}
-		found = 0;
-
-		for (i = 0; i < cinergyt2_rc_keys_size; i++) {
-			if (cinergyt2_rc_keys[i].data == key) {
-				*event = cinergyt2_rc_keys[i].event;
-				*state = REMOTE_KEY_PRESSED;
-				found = 1;
-				/* deb_info("Remote key pressed! key = %d\n",
-				* 		i);
-				*/
-				break;
-			}
-		}
-		if (found == 0)
-			err("cinergyT2: Unknown remote control key detected!"
-				"key=0x%x (raw=0x%x)\n", key, data);
-		break;
-
-	case CINERGYT2_RC_EVENT_TYPE_RC5:
-	case CINERGYT2_RC_EVENT_TYPE_NONE:
-	default:
-		info("Unhandled remote key detected! type=0x%x\n", type);
-		break;
-	}
-	return 0;
-}
-
-static int cinergyt2_rc_process(struct dvb_usb_device *dev)
-{
-	char buf[1] = { CINERGYT2_EP1_GET_RC_EVENTS };
-	struct cinergyt2_rc_event rc_events[12];
-	int len, i, state;
-	u32 event;
-	/* struct cinergyt2_device_state *st = dev->priv; */
-
-	len = cinergyt2_cmd(dev, buf, sizeof(buf),
-				(char *)rc_events, sizeof(rc_events), 0);
-	if (len < 0) {
-		/* printk(KERN_INFO "Failed to read RC event data!\n"); */
-		return 0;
-	}
-
-	if (len == 0)
-		return 0;
-
-	state = REMOTE_NO_KEY_PRESSED;
-
-	for (i = 0; i < (len / sizeof(rc_events[0])); i++) {
-		/* deb_info("[%d/%d] rc_events[%d].data = %x (converted=%x),
-		* 		type=%x\n",
-		*		i, len / sizeof(rc_events[0]),
-		*		i, rc_events[i].data,
-		*		le32_to_cpu(rc_events[i].data),
-		*		rc_events[i].custom);
-		 */
-
-		cinergyt2_decode_rc_key(dev, rc_events[i].custom,
-					rc_events[i].data, &event, &state);
-		switch (state) {
-		case REMOTE_NO_KEY_PRESSED:
-			break;
-
-		case REMOTE_KEY_PRESSED:
-			/* deb_rc("key pressed\n"); */
-			dev->last_event = event;
-			input_event(dev->rc_input_dev, EV_KEY,
-					event, 1);
-			input_event(dev->rc_input_dev, EV_KEY,
-					dev->last_event, 0);
-			input_sync(dev->rc_input_dev);
-			break;
-
-		case REMOTE_KEY_REPEAT:
-			/* deb_rc("key repeated\n"); */
-			input_event(dev->rc_input_dev, EV_KEY,
-					event, 1);
-			input_event(dev->rc_input_dev, EV_KEY,
-					dev->last_event, 0);
-			input_sync(dev->rc_input_dev);
-			break;
-		default:
-			break;
-		}
-
-	}
-	return 0;
-}
-
-/*
- * Code copied from dvb-usb-remote.c and modified for Cinergy T2
- */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
-static void cinergyt2_read_remote_control(void *data)
-#else
-static void cinergyt2_read_remote_control(struct work_struct *work)
-#endif
-{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
-	struct dvb_usb_device *d = data;
-#else
-	struct dvb_usb_device *d =
-		container_of(work, struct dvb_usb_device,
-				rc_query_work.work);
-#endif
-
-	/* TODO: need a lock here.
-	* We can simply skip checking for the remote control
-	*  if we're busy.
-	*/
-
-	/* when the parameter has been set to 1 via sysfs while
-	* the driver was running
-	*/
-
-	if (disable_remote)
-		return;
-
-	if (cinergyt2_rc_process(d))
-		err("error while querying for an remote control event.");
-
-	schedule_delayed_work(&d->rc_query_work,
-				msecs_to_jiffies(d->props.rc_interval));
-}
-
-
-
-int cinergyt2_remote_init(struct dvb_usb_device *d)
-{
-	struct input_dev *input_dev;
-	int i;
-	int err;
-
-	if (disable_remote) {
-		err("Remote controller support disabled!\n");
-		return 0;
-	}
-
-	usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
-	strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
-
-	input_dev = input_allocate_device();
-	if (!input_dev) {
-		err("Failed to allocate new input device!\n");
-		return -ENOMEM;
-	}
-
-	input_dev->evbit[0] = BIT(EV_KEY);
-	input_dev->name = "IR-receiver inside an USB DVB receiver";
-	input_dev->phys = d->rc_phys;
-	usb_to_input_id(d->udev, &input_dev->id);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
-	input_dev->dev.parent = &d->udev->dev;
-#else
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
-	input_dev->cdev.dev = &d->udev->dev;
-#endif
-#endif
-
-	/* set the bits for the keys */
-	deb_rc("key map size: %d\n", cinergyt2_rc_keys_size);
-	for (i = 0; i < cinergyt2_rc_keys_size; i++) {
-		deb_rc("setting bit for event %d item %d\n",
-			cinergyt2_rc_keys[i].event, i);
-		set_bit(cinergyt2_rc_keys[i].event, input_dev->keybit);
-	}
-
-	/* Start the remote-control polling. */
-	if (d->props.rc_interval < 40)
-		d->props.rc_interval = 100; /* default */
-
-	/* setting these two values to non-zero,
-	 * we have to manage key repeats */
-
-	input_dev->rep[REP_PERIOD] = d->props.rc_interval;
-	input_dev->rep[REP_DELAY]  = d->props.rc_interval + 150;
-
-	err = input_register_device(input_dev);
-	if (err) {
-		input_free_device(input_dev);
-		err("Failed to register new input device!\n");
-		return err;
-	}
-
-	d->rc_input_dev = input_dev;
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
-	INIT_WORK(&d->rc_query_work, cinergyt2_read_remote_control, d);
-#else
-	INIT_DELAYED_WORK(&d->rc_query_work, cinergyt2_read_remote_control);
-#endif
-
-	info("schedule remote query interval to %d msecs.",
-		d->props.rc_interval);
-
-	schedule_delayed_work(&d->rc_query_work,
-				msecs_to_jiffies(d->props.rc_interval));
-
-	d->state |= DVB_USB_STATE_REMOTE;
-
-	return 0;
-}
-EXPORT_SYMBOL(cinergyt2_remote_init);
-
-
-int cinergyt2_remote_exit(struct dvb_usb_device *d)
-{
-	if (d->state & DVB_USB_STATE_REMOTE) {
-		cancel_rearming_delayed_work(&d->rc_query_work);
-		flush_scheduled_work();
-		input_unregister_device(d->rc_input_dev);
-	}
-	d->state &= ~DVB_USB_STATE_REMOTE;
-	return 0;
-}
-EXPORT_SYMBOL(cinergyt2_remote_exit);
diff -r f51aa257acfa linux/drivers/media/dvb/dvb-usb/cinergyT2.h
--- a/linux/drivers/media/dvb/dvb-usb/cinergyT2.h	Thu May 08 22:53:56 2008 +0200
+++ b/linux/drivers/media/dvb/dvb-usb/cinergyT2.h	Thu May 08 23:06:34 2008 +0200
@@ -37,7 +37,6 @@
 
 #define DRIVER_NAME "TerraTec/qanu USB2.0 Highspeed DVB-T Receiver"
 
-extern int disable_remote;
 extern int dvb_usb_cinergyt2_debug;
 
 #define deb_info(args...)  dprintk(dvb_usb_cinergyt2_debug,  0x001, args)
@@ -94,8 +93,5 @@
 extern int cinergyt2_cmd(struct dvb_usb_device *d,  char *wbuf,  int wlen,
 			char *rbuf,  int rlen,  int delay_ms);
 
-extern int cinergyt2_remote_init(struct dvb_usb_device *d);
-extern int cinergyt2_remote_exit(struct dvb_usb_device *d);
-
 #endif /* _DVB_USB_CINERGYT2_H_ */
 

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

  parent reply	other threads:[~2008-05-08 21:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <43276.192.168.9.10.1192357983.squirrel@ncircle.nullnet.fi>
     [not found] ` <20071018181040.GA6960@dose.home.local>
     [not found]   ` <20071018182940.GA7317@dose.home.local>
     [not found]     ` <20071018201418.GA16574@dose.home.local>
     [not found]       ` <47075.192.168.9.10.1193248379.squirrel@ncircle.nullnet.fi>
     [not found]         ` <472A0CC2.8040509@free.fr>
2008-04-23 19:39           ` [linux-dvb] Testers wanted for alternative version of Terratec Cinergy T2 driver Thierry Merle
     [not found]             ` <16781.192.100.124.220.1209712634.squirrel@ncircle.nullnet.fi>
2008-05-02 17:08               ` Thierry Merle
     [not found]                 ` <30354.192.100.124.220.1209969477.squirrel@ncircle.nullnet.fi>
2008-05-05 19:57                   ` Thierry Merle
2008-05-07 18:49                     ` Tomi Orava
2008-05-07 22:21                       ` Antti Palosaari
2008-05-13 10:27                         ` Tomi Orava
2008-05-08 21:18                       ` Thierry Merle [this message]
2008-05-12 18:49                         ` Tomi Orava
2008-05-12 19:05                           ` Patrick Boettcher
2008-06-16 15:24                             ` Tino Keitel
2008-06-20 19:44                               ` Thierry Merle
2008-06-20 21:17                                 ` Tomi Orava
2008-06-20 22:16                                   ` Thierry Merle
2008-06-20 22:52                                     ` Tomi Orava
2008-06-21 14:47                                       ` Thierry Merle
2008-06-22 17:17                               ` Tino Keitel
2008-06-25  8:55                                 ` Tomi Orava
2008-05-13 17:36                           ` Thierry Merle
2008-05-08 20:47                     ` Ingo Peukes
2008-05-12 18:32                       ` Tomi Orava
2008-05-13 14:41                         ` Ingo Peukes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48236E1F.5080300@free.fr \
    --to=thierry.merle@free.fr \
    --cc=linux-dvb@linuxtv.org \
    --cc=tomimo@ncircle.nullnet.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.