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