aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2010-11-17 10:25:45 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-20 11:11:11 -0500
commit1338c925a95cf2b95909d7967b4ebddefa255c02 (patch)
treebe76704f9df2350c927530b96d6b39533edd143d
parent2ee95db222137429407dfcd6801b0f1a8c689771 (diff)
[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 <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/IR/streamzap.c15
1 files changed, 7 insertions, 8 deletions
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 = {
140 140
141static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) 141static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir)
142{ 142{
143 ir_raw_event_store(sz->idev, &rawir); 143 dev_dbg(sz->dev, "Storing %s with duration %u us\n",
144 (rawir.pulse ? "pulse" : "space"), rawir.duration);
145 ir_raw_event_store_with_filter(sz->idev, &rawir);
144} 146}
145 147
146static void sz_push_full_pulse(struct streamzap_ir *sz, 148static void sz_push_full_pulse(struct streamzap_ir *sz,
@@ -167,7 +169,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
167 rawir.duration *= 1000; 169 rawir.duration *= 1000;
168 rawir.duration &= IR_MAX_DURATION; 170 rawir.duration &= IR_MAX_DURATION;
169 } 171 }
170 dev_dbg(sz->dev, "ls %u\n", rawir.duration);
171 sz_push(sz, rawir); 172 sz_push(sz, rawir);
172 173
173 sz->idle = false; 174 sz->idle = false;
@@ -180,7 +181,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz,
180 sz->sum += rawir.duration; 181 sz->sum += rawir.duration;
181 rawir.duration *= 1000; 182 rawir.duration *= 1000;
182 rawir.duration &= IR_MAX_DURATION; 183 rawir.duration &= IR_MAX_DURATION;
183 dev_dbg(sz->dev, "p %u\n", rawir.duration);
184 sz_push(sz, rawir); 184 sz_push(sz, rawir);
185} 185}
186 186
@@ -200,7 +200,6 @@ static void sz_push_full_space(struct streamzap_ir *sz,
200 rawir.duration += SZ_RESOLUTION / 2; 200 rawir.duration += SZ_RESOLUTION / 2;
201 sz->sum += rawir.duration; 201 sz->sum += rawir.duration;
202 rawir.duration *= 1000; 202 rawir.duration *= 1000;
203 dev_dbg(sz->dev, "s %u\n", rawir.duration);
204 sz_push(sz, rawir); 203 sz_push(sz, rawir);
205} 204}
206 205
@@ -221,8 +220,6 @@ static void streamzap_callback(struct urb *urb)
221 struct streamzap_ir *sz; 220 struct streamzap_ir *sz;
222 unsigned int i; 221 unsigned int i;
223 int len; 222 int len;
224 static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) &
225 IR_MAX_DURATION) | 0x03000000);
226 223
227 if (!urb) 224 if (!urb)
228 return; 225 return;
@@ -246,7 +243,7 @@ static void streamzap_callback(struct urb *urb)
246 243
247 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); 244 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len);
248 for (i = 0; i < len; i++) { 245 for (i = 0; i < len; i++) {
249 dev_dbg(sz->dev, "sz idx %d: %x\n", 246 dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n",
250 i, (unsigned char)sz->buf_in[i]); 247 i, (unsigned char)sz->buf_in[i]);
251 switch (sz->decoder_state) { 248 switch (sz->decoder_state) {
252 case PulseSpace: 249 case PulseSpace:
@@ -273,7 +270,7 @@ static void streamzap_callback(struct urb *urb)
273 DEFINE_IR_RAW_EVENT(rawir); 270 DEFINE_IR_RAW_EVENT(rawir);
274 271
275 rawir.pulse = false; 272 rawir.pulse = false;
276 rawir.duration = timeout; 273 rawir.duration = sz->props->timeout;
277 sz->idle = true; 274 sz->idle = true;
278 if (sz->timeout_enabled) 275 if (sz->timeout_enabled)
279 sz_push(sz, rawir); 276 sz_push(sz, rawir);
@@ -444,6 +441,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf,
444 sz->decoder_state = PulseSpace; 441 sz->decoder_state = PulseSpace;
445 /* FIXME: don't yet have a way to set this */ 442 /* FIXME: don't yet have a way to set this */
446 sz->timeout_enabled = true; 443 sz->timeout_enabled = true;
444 sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) &
445 IR_MAX_DURATION) | 0x03000000);
447 #if 0 446 #if 0
448 /* not yet supported, depends on patches from maxim */ 447 /* not yet supported, depends on patches from maxim */
449 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ 448 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */