[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>

authored by Jarod Wilson and committed by Mauro Carvalho Chehab 1338c925 2ee95db2

+7 -8
+7 -8
drivers/media/IR/streamzap.c
··· 140 141 static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) 142 { 143 - ir_raw_event_store(sz->idev, &rawir); 144 } 145 146 static void sz_push_full_pulse(struct streamzap_ir *sz, ··· 169 rawir.duration *= 1000; 170 rawir.duration &= IR_MAX_DURATION; 171 } 172 - dev_dbg(sz->dev, "ls %u\n", rawir.duration); 173 sz_push(sz, rawir); 174 175 sz->idle = false; ··· 181 sz->sum += rawir.duration; 182 rawir.duration *= 1000; 183 rawir.duration &= IR_MAX_DURATION; 184 - dev_dbg(sz->dev, "p %u\n", rawir.duration); 185 sz_push(sz, rawir); 186 } 187 ··· 200 rawir.duration += SZ_RESOLUTION / 2; 201 sz->sum += rawir.duration; 202 rawir.duration *= 1000; 203 - dev_dbg(sz->dev, "s %u\n", rawir.duration); 204 sz_push(sz, rawir); 205 } 206 ··· 220 struct streamzap_ir *sz; 221 unsigned int i; 222 int len; 223 - static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & 224 - IR_MAX_DURATION) | 0x03000000); 225 226 if (!urb) 227 return; ··· 243 244 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); 245 for (i = 0; i < len; i++) { 246 - dev_dbg(sz->dev, "sz idx %d: %x\n", 247 i, (unsigned char)sz->buf_in[i]); 248 switch (sz->decoder_state) { 249 case PulseSpace: ··· 270 DEFINE_IR_RAW_EVENT(rawir); 271 272 rawir.pulse = false; 273 - rawir.duration = timeout; 274 sz->idle = true; 275 if (sz->timeout_enabled) 276 sz_push(sz, rawir); ··· 441 sz->decoder_state = PulseSpace; 442 /* FIXME: don't yet have a way to set this */ 443 sz->timeout_enabled = true; 444 #if 0 445 /* not yet supported, depends on patches from maxim */ 446 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */
··· 140 141 static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) 142 { 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); 146 } 147 148 static void sz_push_full_pulse(struct streamzap_ir *sz, ··· 167 rawir.duration *= 1000; 168 rawir.duration &= IR_MAX_DURATION; 169 } 170 sz_push(sz, rawir); 171 172 sz->idle = false; ··· 180 sz->sum += rawir.duration; 181 rawir.duration *= 1000; 182 rawir.duration &= IR_MAX_DURATION; 183 sz_push(sz, rawir); 184 } 185 ··· 200 rawir.duration += SZ_RESOLUTION / 2; 201 sz->sum += rawir.duration; 202 rawir.duration *= 1000; 203 sz_push(sz, rawir); 204 } 205 ··· 221 struct streamzap_ir *sz; 222 unsigned int i; 223 int len; 224 225 if (!urb) 226 return; ··· 246 247 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); 248 for (i = 0; i < len; i++) { 249 + dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", 250 i, (unsigned char)sz->buf_in[i]); 251 switch (sz->decoder_state) { 252 case PulseSpace: ··· 273 DEFINE_IR_RAW_EVENT(rawir); 274 275 rawir.pulse = false; 276 + rawir.duration = sz->props->timeout; 277 sz->idle = true; 278 if (sz->timeout_enabled) 279 sz_push(sz, rawir); ··· 444 sz->decoder_state = PulseSpace; 445 /* FIXME: don't yet have a way to set this */ 446 sz->timeout_enabled = true; 447 + sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & 448 + IR_MAX_DURATION) | 0x03000000); 449 #if 0 450 /* not yet supported, depends on patches from maxim */ 451 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */