public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow the user to restrict the RC5 address
@ 2009-03-26  2:34 Udo A. Steinberg
  2009-03-26  7:24 ` Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Udo A. Steinberg @ 2009-03-26  2:34 UTC (permalink / raw)
  To: mchehab, Darron Broad; +Cc: v4l-dvb-maintainer, linux-media

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

Mauro,

This patch allows users with multiple remotes to specify an RC5 address for a
remote from which key codes will be accepted. If no address is specified, the
default value of 0 accepts key codes from any remote. This replaces the current
hard-coded address checks, which are too restrictive.


Signed-off-by: Udo Steinberg <udo@hypervisor.org>


--- linux-2.6.29/drivers/media/video/ir-kbd-i2c.c	2009-03-24 00:12:14.000000000 +0100
+++ linux-2.6.29/drivers/media/video/ir-kbd-i2c.new	2009-03-26 03:12:11.000000000 +0100
@@ -58,6 +58,9 @@
 module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
 MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)");
 
+static unsigned int device;
+module_param(device, uint, 0644);    /* RC5 device address */
+MODULE_PARM_DESC(device, "Specify device address: 0=any (defaults to 0)");
 
 #define DEVNAME "ir-kbd-i2c"
 #define dprintk(level, fmt, arg...)	if (debug >= level) \
@@ -104,8 +107,8 @@
 		/* invalid key press */
 		return 0;
 
-	if (dev!=0x1e && dev!=0x1f)
-		/* not a hauppauge remote */
+	if (device && device != dev)
+		/* not an acceptable remote */
 		return 0;
 
 	if (!range)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Allow the user to restrict the RC5 address
  2009-03-26  2:34 [PATCH] Allow the user to restrict the RC5 address Udo A. Steinberg
@ 2009-03-26  7:24 ` Hans Verkuil
  2009-03-26 16:45   ` Steven Toth
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Verkuil @ 2009-03-26  7:24 UTC (permalink / raw)
  To: Udo A. Steinberg
  Cc: mchehab, Darron Broad, v4l-dvb-maintainer, linux-media,
	Steven Toth

On Thursday 26 March 2009 03:34:53 Udo A. Steinberg wrote:
> Mauro,
>
> This patch allows users with multiple remotes to specify an RC5 address
> for a remote from which key codes will be accepted. If no address is
> specified, the default value of 0 accepts key codes from any remote. This
> replaces the current hard-coded address checks, which are too
> restrictive.

I think this should be reviewed by Steve Toth first (CC-ed him).

One thing that this patch breaks is if you have multiple Hauppauge remotes, 
some sending 0x1e, some 0x1f. With this patch I can't use both, only one.

It might be better to have an option to explicitly allow old Hauppauge 
remotes that send 0x00.

Or an heuristic: if you see a remote with device 0x1e or 0x1f, then filter 
remotes with device 0x00 afterwards.

A third option might be to extend the hauppauge option, allowing you to 
specify '2=Old WinTV remote' or something like that, and if set device 0x00 
will be allowed.

Regards,

	Hans

>
>
> Signed-off-by: Udo Steinberg <udo@hypervisor.org>
>
>
> --- linux-2.6.29/drivers/media/video/ir-kbd-i2c.c	2009-03-24
> 00:12:14.000000000 +0100 +++
> linux-2.6.29/drivers/media/video/ir-kbd-i2c.new	2009-03-26
> 03:12:11.000000000 +0100 @@ -58,6 +58,9 @@
>  module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
>  MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey
> (defaults to 0)");
>
> +static unsigned int device;
> +module_param(device, uint, 0644);    /* RC5 device address */
> +MODULE_PARM_DESC(device, "Specify device address: 0=any (defaults to
> 0)");
>
>  #define DEVNAME "ir-kbd-i2c"
>  #define dprintk(level, fmt, arg...)	if (debug >= level) \
> @@ -104,8 +107,8 @@
>  		/* invalid key press */
>  		return 0;
>
> -	if (dev!=0x1e && dev!=0x1f)
> -		/* not a hauppauge remote */
> +	if (device && device != dev)
> +		/* not an acceptable remote */
>  		return 0;
>
>  	if (!range)



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Allow the user to restrict the RC5 address
  2009-03-26  7:24 ` Hans Verkuil
@ 2009-03-26 16:45   ` Steven Toth
  2009-03-26 18:45     ` Udo A. Steinberg
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Toth @ 2009-03-26 16:45 UTC (permalink / raw)
  To: Hans Verkuil
  Cc: Udo A. Steinberg, mchehab@redhat.com, Darron Broad,
	v4l-dvb-maintainer@linuxtv.org, linux-media@vger.kernel.org

Hans Verkuil wrote:
> On Thursday 26 March 2009 03:34:53 Udo A. Steinberg wrote:
>   
>> Mauro,
>>
>> This patch allows users with multiple remotes to specify an RC5 address
>> for a remote from which key codes will be accepted. If no address is
>> specified, the default value of 0 accepts key codes from any remote. This
>> replaces the current hard-coded address checks, which are too
>> restrictive.
>>     
>
> I think this should be reviewed by Steve Toth first (CC-ed him).
>
> One thing that this patch breaks is if you have multiple Hauppauge remotes, 
> some sending 0x1e, some 0x1f. With this patch I can't use both, only one.
>
>   
Hans, thanks for bringing this to my attention.

Mauro, This patch is a regression, although a small one. it probably 
needs a little more work.

I too tend to have multiple remotes, I don't think it's that unusual for 
long standing Hauppauge customers to have many boards with many types of 
remotes.

> It might be better to have an option to explicitly allow old Hauppauge 
> remotes that send 0x00.
>
>   
I could live with this. It relegates older remotes but those remotes are 
no longer made. This feels like a good compromise.

- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Allow the user to restrict the RC5 address
  2009-03-26 16:45   ` Steven Toth
@ 2009-03-26 18:45     ` Udo A. Steinberg
  2009-03-27  7:28       ` [v4l-dvb-maintainer] " Hans Verkuil
  0 siblings, 1 reply; 5+ messages in thread
From: Udo A. Steinberg @ 2009-03-26 18:45 UTC (permalink / raw)
  To: Steven Toth
  Cc: Hans Verkuil, mchehab@redhat.com, Darron Broad,
	v4l-dvb-maintainer@linuxtv.org, linux-media@vger.kernel.org

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

On Thu, 26 Mar 2009 12:45:18 -0400 Steven Toth (ST) wrote:

ST> I too tend to have multiple remotes, I don't think it's that unusual for
ST> long standing Hauppauge customers to have many boards with many types of
ST> remotes.
ST> 
ST> > It might be better to have an option to explicitly allow old Hauppauge
ST> > remotes that send 0x00.
ST> >
ST> I could live with this. It relegates older remotes but those remotes
ST> are no longer made. This feels like a good compromise.

How about changing the parameter such that it is a filter mask? The default
value of 0x0 would accept all remotes. For non-zero values, each bit set in
the parameter would filter the device address corresponding to that bit, e.g.
0x1 would filter address 0x0, 0x80000000 would filter address 0x1f, etc.

Cheers,

	- Udo

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v4l-dvb-maintainer] [PATCH] Allow the user to restrict the RC5 address
  2009-03-26 18:45     ` Udo A. Steinberg
@ 2009-03-27  7:28       ` Hans Verkuil
  0 siblings, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2009-03-27  7:28 UTC (permalink / raw)
  To: v4l-dvb-maintainer
  Cc: Udo A. Steinberg, Steven Toth, Darron Broad, mchehab@redhat.com,
	linux-media@vger.kernel.org

On Thursday 26 March 2009 19:45:53 Udo A. Steinberg wrote:
> On Thu, 26 Mar 2009 12:45:18 -0400 Steven Toth (ST) wrote:
>
> ST> I too tend to have multiple remotes, I don't think it's that unusual
> for ST> long standing Hauppauge customers to have many boards with many
> types of ST> remotes.
> ST>
> ST> > It might be better to have an option to explicitly allow old
> Hauppauge ST> > remotes that send 0x00.
> ST> >
> ST> I could live with this. It relegates older remotes but those remotes
> ST> are no longer made. This feels like a good compromise.
>
> How about changing the parameter such that it is a filter mask? The
> default value of 0x0 would accept all remotes. For non-zero values, each
> bit set in the parameter would filter the device address corresponding to
> that bit, e.g. 0x1 would filter address 0x0, 0x80000000 would filter
> address 0x1f, etc.

Seems way to complicated to me. Remember that end users have no idea about 
the device addresses, so it should be a simple to understand module option. 
So I'd just go with Steve's preference.

Regards,

	Hans

>
> Cheers,
>
> 	- Udo



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-27  7:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26  2:34 [PATCH] Allow the user to restrict the RC5 address Udo A. Steinberg
2009-03-26  7:24 ` Hans Verkuil
2009-03-26 16:45   ` Steven Toth
2009-03-26 18:45     ` Udo A. Steinberg
2009-03-27  7:28       ` [v4l-dvb-maintainer] " Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox