From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: linuxtv@stefanringel.de
Cc: linux-media@vger.kernel.org, d.belimov@gmail.com
Subject: Re: [PATCH 5/5] tm6000: bugfix data check
Date: Wed, 30 Nov 2011 15:21:59 -0200 [thread overview]
Message-ID: <4ED66637.2050406@redhat.com> (raw)
In-Reply-To: <1322509580-14460-5-git-send-email-linuxtv@stefanringel.de>
Hi Stefan and Dmitri,
The entire RC input looked badly implemented. It never worked with HVR-900H,
and it were doing polling even on URB interrupt mode.
I've rewritten the entire code, and fixed it to be more reliable.
I've tested both interrupt and polling modes, with HVR-900H. On HVR-900H,
polling mode returns 0 when a scancode arrives, 0xff otherwise. This is
not the expected behavior on polling mode, but it seems to e due to the
way this device is wired. Anyway, the test were enough to test both ways
of receiving scancodes.
So, I broke the code for interrupt-driven and for polling-driven IR. This
made the code simpler to understand and more reliable. Also, on interrupt
driven mode, the CPU won't need to wake on every 50ms due to IR.
Both NEC and RC-5 protocols were tested, and I tried to make sure that the
driver would support 1 byte scancode, where devices can't provide
two bytes.
Please double check the patches I've made against your devices, in order
to be sure that nothing went wrong. Maybe something more would be needed
for IR on tm5600/tm6000.
I should be applying them upstream later today or tomorrow.
Regards,
Mauro
On 28-11-2011 17:46, linuxtv@stefanringel.de wrote:
> From: Stefan Ringel<linuxtv@stefanringel.de>
>
> beholder use a map with 3 bytes, but many rc maps have 2 bytes, so I add a workaround for beholder rc.
>
> Signed-off-by: Stefan Ringel<linuxtv@stefanringel.de>
> ---
> drivers/media/video/tm6000/tm6000-input.c | 21 ++++++++++++++++-----
> 1 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/video/tm6000/tm6000-input.c b/drivers/media/video/tm6000/tm6000-input.c
> index 405d127..ae7772e 100644
> --- a/drivers/media/video/tm6000/tm6000-input.c
> +++ b/drivers/media/video/tm6000/tm6000-input.c
> @@ -178,9 +178,21 @@ static int default_polling_getkey(struct tm6000_IR *ir,
> poll_result->rc_data = ir->urb_data[0];
> break;
> case RC_TYPE_NEC:
> - if (ir->urb_data[1] == ((ir->key_addr>> 8)& 0xff)) {
> + switch (dev->model) {
> + case 10:
> + case 11:
> + case 14:
> + case 15:
Using magic numbers here is a very bad idea.
> + if (ir->urb_data[1] ==
> + ((ir->key_addr>> 8)& 0xff)) {
> + poll_result->rc_data =
> + ir->urb_data[0]
> + | ir->urb_data[1]<< 8;
> + }
Despite your comment, this is a 2 bytes scancode.
> + break;
> + default:
> poll_result->rc_data = ir->urb_data[0]
> - | ir->urb_data[1]<< 8;
> + | ir->urb_data[1]<< 8;
> }
> break;
> default:
> @@ -238,8 +250,6 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir)
> return;
> }
>
> - dprintk("ir->get_key result data=%04x\n", poll_result.rc_data);
> -
> if (ir->pwled) {
> if (ir->pwledcnt>= PWLED_OFF) {
> ir->pwled = 0;
> @@ -250,6 +260,7 @@ static void tm6000_ir_handle_key(struct tm6000_IR *ir)
> }
>
> if (ir->key) {
> + dprintk("ir->get_key result data=%04x\n", poll_result.rc_data);
> rc_keydown(ir->rc, poll_result.rc_data, 0);
> ir->key = 0;
> ir->pwled = 1;
> @@ -333,7 +344,7 @@ int tm6000_ir_int_start(struct tm6000_core *dev)
> ir->int_urb->transfer_buffer, size,
> tm6000_ir_urb_received, dev,
> dev->int_in.endp->desc.bInterval);
> - err = usb_submit_urb(ir->int_urb, GFP_KERNEL);
> + err = usb_submit_urb(ir->int_urb, GFP_ATOMIC);
> if (err) {
> kfree(ir->int_urb->transfer_buffer);
> usb_free_urb(ir->int_urb);
next prev parent reply other threads:[~2011-11-30 17:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1322509580-14460-1-git-send-email-linuxtv@stefanringel.de>
2011-11-28 19:46 ` [PATCH 2/5] tm6000: bugfix register setting linuxtv
2011-11-28 19:46 ` [PATCH 3/5] tm6000: bugfix interrupt reset linuxtv
2011-12-05 7:21 ` Thierry Reding
2011-12-05 12:04 ` Mauro Carvalho Chehab
2011-12-05 15:38 ` Thierry Reding
2011-12-05 18:21 ` Mauro Carvalho Chehab
2011-12-05 20:02 ` Stefan Ringel
2011-12-05 20:16 ` Mauro Carvalho Chehab
2011-12-06 6:51 ` Thierry Reding
2011-12-06 8:12 ` Thierry Reding
2011-12-06 12:25 ` Mauro Carvalho Chehab
2011-12-06 13:05 ` [PATCH] [media] tm6000: Fix fast USB access quirk Thierry Reding
2011-12-06 12:22 ` [PATCH 3/5] tm6000: bugfix interrupt reset Mauro Carvalho Chehab
2011-11-28 19:46 ` [PATCH 4/5] tm6000: bugfix bulk transfer linuxtv
2011-11-28 19:46 ` [PATCH 5/5] tm6000: bugfix data check linuxtv
2011-11-30 17:21 ` Mauro Carvalho Chehab [this message]
2011-12-06 13:39 ` [PATCH 1/2] [media] tm6000: Fix check for interrupt endpoint Thierry Reding
2011-12-06 13:39 ` [PATCH 2/2] [media] tm6000: Fix bad indentation Thierry Reding
2011-12-06 13:58 ` Antti Palosaari
2011-12-06 14:13 ` Thierry Reding
2011-12-06 20:58 ` Mauro Carvalho Chehab
2011-12-06 21:03 ` Antti Palosaari
2011-12-07 13:24 ` Mauro Carvalho Chehab
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=4ED66637.2050406@redhat.com \
--to=mchehab@redhat.com \
--cc=d.belimov@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=linuxtv@stefanringel.de \
/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.