From: Marko Ristola <marko.ristola@kolumbus.fi>
To: linux-dvb <linux-dvb@linuxtv.org>
Subject: [linux-dvb] Ticlkess Mantis remote control implementation
Date: Tue, 24 Jun 2008 22:50:51 +0300 [thread overview]
Message-ID: <4861501B.9050507@kolumbus.fi> (raw)
Hi,
I have still my own version of Manu's jusst.de/mantis driver that is
based on v4l-dvb-linuxtv main branch,
mainly because I use so new Linux kernels.
I have done the following improvement lately:
I implemented a remote control patch, that doesn't poll the remote
control all the time.
It polls the remote control only if you press the button (a tickless
version, you know).
It surprised me, that the actual implementation was really small, it
took very few lines of code.
The idea is, that the remote control informs (thrue irq)
mantis_query_rc() to be active.
mantis_query_rc takes care that it will reactivate itself after 250ms,
until remote control
hasn't sent any "user is still pressing a button" messages.
POLL_FREQ (HZ/4) time (250ms) must be more than the remote control
message interval (230ms).
This way we can ensure that the remote control sends at least one
message per POLL_FREQ tick.
If on the last POLL_FREQ tick no button is pressed (-1),
mantis_query_rc() doesn't activate the POLL_FREQ tick
anymore, just informs via ir_input_nokey() that the remote control user
doesn't press any buttons.
So in this way the remote control works with Twinhan 2033 better than
ever (the hand experience is good also).
+ Initial key press is delivered instantly.
+ No CPU consumption while the remote control isn't used.
Could possibly be improved with a tasklet, if the instant response
experience would be that important.
Can be used from 1 to 4 key repeats per second (230ms remote control
limit is the lower bound, we must be safely above).
Interrupt handler on mantis_pci.c:
if (stat & MANTIS_INT_IRQ1) {
mantis->ir.ir_last_code = mmread(0xe8);
dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
schedule_delayed_work(&mantis->ir.rc_query_work, 0);
}
mantis_rc.c:
#define POLL_FREQ (HZ/4)
void mantis_query_rc(struct work_struct *work)
{
struct mantis_pci *mantis =
container_of(work, struct mantis_pci,
ir.rc_query_work.work);
struct ir_input_state *ir = &mantis->ir.ir;
u32 lastkey = mantis->ir.ir_last_code;
ir_input_nokey(mantis->ir.rc_dev, ir);
if (lastkey != -1) {
ir_input_keydown(mantis->ir.rc_dev, ir, lastkey, 0);
mantis->ir.ir_last_code = -1;
schedule_delayed_work(&mantis->ir.rc_query_work, POLL_FREQ);
}
}
int mantis_rc_init(struct mantis_pci *mantis):
mantis->ir.ir_last_code = -1; /* key presses disabled here. */
INIT_DELAYED_WORK(&mir->rc_query_work, mantis_query_rc);
int mantis_rc_exit(struct mantis_pci *mantis):
mmwrite(mmread(MANTIS_INT_MASK) & (~MANTIS_INT_IRQ1),
MANTIS_INT_MASK);
mantis->ir.ir_last_code = -1; /* key presses disabled here. */
cancel_delayed_work_sync(&mantis->ir.rc_query_work); /* not my
idea */
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next reply other threads:[~2008-06-24 19:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 19:50 Marko Ristola [this message]
2008-06-24 20:36 ` [linux-dvb] Ticlkess Mantis remote control implementation Roland Scheidegger
2008-06-25 12:08 ` Markus Rechberger
2008-06-25 20:35 ` Marko Ristola
[not found] ` <48615A7E.2030600@tungstengraphics.com>
2008-06-25 20:22 ` Marko Ristola
2008-06-25 22:05 ` Roland Scheidegger
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=4861501B.9050507@kolumbus.fi \
--to=marko.ristola@kolumbus.fi \
--cc=linux-dvb@linuxtv.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox