From 1338c925a95cf2b95909d7967b4ebddefa255c02 Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Wed, 17 Nov 2010 12:25:45 -0300 Subject: [media] streamzap: merge timeout space with trailing space There are cases where we get an ending space, and our trailing timeout space then gets sent right after it, which breaks repeat, at least for lirc userspace decoding. Merge the two spaces by way of using ir_raw_event_store_filter, set a timeout value, and we're back to good. Successfully tested with streamzap and windows mce remotes. Signed-off-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/streamzap.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers/media/IR/streamzap.c') diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index 548381c35bfd..c6157ee73ffa 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c @@ -140,7 +140,9 @@ static struct usb_driver streamzap_driver = { static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) { - ir_raw_event_store(sz->idev, &rawir); + dev_dbg(sz->dev, "Storing %s with duration %u us\n", + (rawir.pulse ? "pulse" : "space"), rawir.duration); + ir_raw_event_store_with_filter(sz->idev, &rawir); } static void sz_push_full_pulse(struct streamzap_ir *sz, @@ -167,7 +169,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, rawir.duration *= 1000; rawir.duration &= IR_MAX_DURATION; } - dev_dbg(sz->dev, "ls %u\n", rawir.duration); sz_push(sz, rawir); sz->idle = false; @@ -180,7 +181,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, sz->sum += rawir.duration; rawir.duration *= 1000; rawir.duration &= IR_MAX_DURATION; - dev_dbg(sz->dev, "p %u\n", rawir.duration); sz_push(sz, rawir); } @@ -200,7 +200,6 @@ static void sz_push_full_space(struct streamzap_ir *sz, rawir.duration += SZ_RESOLUTION / 2; sz->sum += rawir.duration; rawir.duration *= 1000; - dev_dbg(sz->dev, "s %u\n", rawir.duration); sz_push(sz, rawir); } @@ -221,8 +220,6 @@ static void streamzap_callback(struct urb *urb) struct streamzap_ir *sz; unsigned int i; int len; - static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & - IR_MAX_DURATION) | 0x03000000); if (!urb) return; @@ -246,7 +243,7 @@ static void streamzap_callback(struct urb *urb) dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); for (i = 0; i < len; i++) { - dev_dbg(sz->dev, "sz idx %d: %x\n", + dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", i, (unsigned char)sz->buf_in[i]); switch (sz->decoder_state) { case PulseSpace: @@ -273,7 +270,7 @@ static void streamzap_callback(struct urb *urb) DEFINE_IR_RAW_EVENT(rawir); rawir.pulse = false; - rawir.duration = timeout; + rawir.duration = sz->props->timeout; sz->idle = true; if (sz->timeout_enabled) sz_push(sz, rawir); @@ -444,6 +441,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf, sz->decoder_state = PulseSpace; /* FIXME: don't yet have a way to set this */ sz->timeout_enabled = true; + sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & + IR_MAX_DURATION) | 0x03000000); #if 0 /* not yet supported, depends on patches from maxim */ /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ -- cgit v1.2.2 From 635f76b2aa8ef3e8436dedddc8baa6f7f438dc40 Mon Sep 17 00:00:00 2001 From: Paul Bender Date: Thu, 16 Dec 2010 13:23:07 -0300 Subject: [media] rc: fix sysfs entry for mceusb and streamzap When trying to create persistent device names for mceusb and streamzap devices, I noticed that their respective drivers are not creating the rc device as a child of the USB device. Rather it creates it as virtual device. As a result, udev cannot use the USB device information to create persistent device names for event and lirc devices associated with the rc device. Not having persistent device names makes it more difficult to make use of the devices in userspace as their names can change. Signed-off-by: Paul Bender Signed-off-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- drivers/media/IR/streamzap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/media/IR/streamzap.c') diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index c6157ee73ffa..3a20aef67d08 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c @@ -34,8 +34,9 @@ #include #include #include -#include #include +#include +#include #include #define DRIVER_VERSION "1.61" @@ -332,6 +333,9 @@ static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz) sz->props = props; + usb_to_input_id(sz->usbdev, &idev->id); + idev->dev.parent = sz->dev; + ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); if (ret < 0) { dev_err(dev, "remote input device register failed\n"); -- cgit v1.2.2