All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mceusb: Timeout unit corrections
@ 2011-07-03 20:13 Rafi Rubin
  2011-07-03 20:13 ` [PATCH 2/2] mceusb: increase default timeout to 100ms Rafi Rubin
  0 siblings, 1 reply; 2+ messages in thread
From: Rafi Rubin @ 2011-07-03 20:13 UTC (permalink / raw)
  To: linux-media, linux-input, jarod; +Cc: Rafi Rubin

Unit missmatch in mceusb_handle_command.  It should be converting to us,
not 1/10th of ms.

mceusb_dev_printdata 100us/ms -> 1000us/ms

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>

---

Fixing the interpretation of the timeout corrects buggy behavior,
particularly when using a mceusb reciever in lirc mode for arbitrary
remote controls (the mce remotes actually worked, don't know why).
---
 drivers/media/rc/mceusb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index ad927fc..377f826 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -551,7 +551,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
 		case MCE_CMD_S_TIMEOUT:
 			/* value is in units of 50us, so x*50/100 or x/2 ms */
 			dev_info(dev, "%s receive timeout of %d ms\n",
-				 inout, ((data1 << 8) | data2) / 2);
+				 inout, ((data1 << 8) | data2) / 20);
 			break;
 		case MCE_CMD_G_TIMEOUT:
 			dev_info(dev, "Get receive timeout\n");
@@ -835,7 +835,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, int index)
 	switch (ir->buf_in[index]) {
 	/* 2-byte return value commands */
 	case MCE_CMD_S_TIMEOUT:
-		ir->rc->timeout = US_TO_NS((hi << 8 | lo) / 2);
+		ir->rc->timeout = US_TO_NS((hi << 8 | lo) * MCE_TIME_UNIT);
 		break;
 
 	/* 1-byte return value commands */
-- 
1.7.5.4


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

* [PATCH 2/2] mceusb: increase default timeout to 100ms
  2011-07-03 20:13 [PATCH 1/2] mceusb: Timeout unit corrections Rafi Rubin
@ 2011-07-03 20:13 ` Rafi Rubin
  0 siblings, 0 replies; 2+ messages in thread
From: Rafi Rubin @ 2011-07-03 20:13 UTC (permalink / raw)
  To: linux-media, linux-input, jarod; +Cc: Rafi Rubin

Signed-off-by: Rafi Rubin <rafi@seas.upenn.edu>
---
This changes the default to something a little more sane.  I have one
mceusb device that currently does not respond properly to the initial
polling and is left using the default timeout.  1ms does not work well.

I propose changing the default to 100ms to match the timeout reported by
my other mceusb device and works fine for me.
---
 drivers/media/rc/mceusb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 377f826..956d296 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1082,7 +1082,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
 	rc->priv = ir;
 	rc->driver_type = RC_DRIVER_IR_RAW;
 	rc->allowed_protos = RC_TYPE_ALL;
-	rc->timeout = US_TO_NS(1000);
+	rc->timeout = MS_TO_NS(100);
 	if (!ir->flags.no_tx) {
 		rc->s_tx_mask = mceusb_set_tx_mask;
 		rc->s_tx_carrier = mceusb_set_tx_carrier;
-- 
1.7.5.4


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

end of thread, other threads:[~2011-07-03 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03 20:13 [PATCH 1/2] mceusb: Timeout unit corrections Rafi Rubin
2011-07-03 20:13 ` [PATCH 2/2] mceusb: increase default timeout to 100ms Rafi Rubin

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.