diff options
Diffstat (limited to 'drivers/media/IR/streamzap.c')
-rw-r--r-- | drivers/media/IR/streamzap.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c index 548381c35bfd..3a20aef67d08 100644 --- a/drivers/media/IR/streamzap.c +++ b/drivers/media/IR/streamzap.c | |||
@@ -34,8 +34,9 @@ | |||
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/usb.h> | ||
38 | #include <linux/input.h> | 37 | #include <linux/input.h> |
38 | #include <linux/usb.h> | ||
39 | #include <linux/usb/input.h> | ||
39 | #include <media/ir-core.h> | 40 | #include <media/ir-core.h> |
40 | 41 | ||
41 | #define DRIVER_VERSION "1.61" | 42 | #define DRIVER_VERSION "1.61" |
@@ -140,7 +141,9 @@ static struct usb_driver streamzap_driver = { | |||
140 | 141 | ||
141 | static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) | 142 | static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) |
142 | { | 143 | { |
143 | ir_raw_event_store(sz->idev, &rawir); | 144 | dev_dbg(sz->dev, "Storing %s with duration %u us\n", |
145 | (rawir.pulse ? "pulse" : "space"), rawir.duration); | ||
146 | ir_raw_event_store_with_filter(sz->idev, &rawir); | ||
144 | } | 147 | } |
145 | 148 | ||
146 | static void sz_push_full_pulse(struct streamzap_ir *sz, | 149 | static void sz_push_full_pulse(struct streamzap_ir *sz, |
@@ -167,7 +170,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
167 | rawir.duration *= 1000; | 170 | rawir.duration *= 1000; |
168 | rawir.duration &= IR_MAX_DURATION; | 171 | rawir.duration &= IR_MAX_DURATION; |
169 | } | 172 | } |
170 | dev_dbg(sz->dev, "ls %u\n", rawir.duration); | ||
171 | sz_push(sz, rawir); | 173 | sz_push(sz, rawir); |
172 | 174 | ||
173 | sz->idle = false; | 175 | sz->idle = false; |
@@ -180,7 +182,6 @@ static void sz_push_full_pulse(struct streamzap_ir *sz, | |||
180 | sz->sum += rawir.duration; | 182 | sz->sum += rawir.duration; |
181 | rawir.duration *= 1000; | 183 | rawir.duration *= 1000; |
182 | rawir.duration &= IR_MAX_DURATION; | 184 | rawir.duration &= IR_MAX_DURATION; |
183 | dev_dbg(sz->dev, "p %u\n", rawir.duration); | ||
184 | sz_push(sz, rawir); | 185 | sz_push(sz, rawir); |
185 | } | 186 | } |
186 | 187 | ||
@@ -200,7 +201,6 @@ static void sz_push_full_space(struct streamzap_ir *sz, | |||
200 | rawir.duration += SZ_RESOLUTION / 2; | 201 | rawir.duration += SZ_RESOLUTION / 2; |
201 | sz->sum += rawir.duration; | 202 | sz->sum += rawir.duration; |
202 | rawir.duration *= 1000; | 203 | rawir.duration *= 1000; |
203 | dev_dbg(sz->dev, "s %u\n", rawir.duration); | ||
204 | sz_push(sz, rawir); | 204 | sz_push(sz, rawir); |
205 | } | 205 | } |
206 | 206 | ||
@@ -221,8 +221,6 @@ static void streamzap_callback(struct urb *urb) | |||
221 | struct streamzap_ir *sz; | 221 | struct streamzap_ir *sz; |
222 | unsigned int i; | 222 | unsigned int i; |
223 | int len; | 223 | int len; |
224 | static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | ||
225 | IR_MAX_DURATION) | 0x03000000); | ||
226 | 224 | ||
227 | if (!urb) | 225 | if (!urb) |
228 | return; | 226 | return; |
@@ -246,7 +244,7 @@ static void streamzap_callback(struct urb *urb) | |||
246 | 244 | ||
247 | dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); | 245 | dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); |
248 | for (i = 0; i < len; i++) { | 246 | for (i = 0; i < len; i++) { |
249 | dev_dbg(sz->dev, "sz idx %d: %x\n", | 247 | dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", |
250 | i, (unsigned char)sz->buf_in[i]); | 248 | i, (unsigned char)sz->buf_in[i]); |
251 | switch (sz->decoder_state) { | 249 | switch (sz->decoder_state) { |
252 | case PulseSpace: | 250 | case PulseSpace: |
@@ -273,7 +271,7 @@ static void streamzap_callback(struct urb *urb) | |||
273 | DEFINE_IR_RAW_EVENT(rawir); | 271 | DEFINE_IR_RAW_EVENT(rawir); |
274 | 272 | ||
275 | rawir.pulse = false; | 273 | rawir.pulse = false; |
276 | rawir.duration = timeout; | 274 | rawir.duration = sz->props->timeout; |
277 | sz->idle = true; | 275 | sz->idle = true; |
278 | if (sz->timeout_enabled) | 276 | if (sz->timeout_enabled) |
279 | sz_push(sz, rawir); | 277 | sz_push(sz, rawir); |
@@ -335,6 +333,9 @@ static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz) | |||
335 | 333 | ||
336 | sz->props = props; | 334 | sz->props = props; |
337 | 335 | ||
336 | usb_to_input_id(sz->usbdev, &idev->id); | ||
337 | idev->dev.parent = sz->dev; | ||
338 | |||
338 | ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); | 339 | ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); |
339 | if (ret < 0) { | 340 | if (ret < 0) { |
340 | dev_err(dev, "remote input device register failed\n"); | 341 | dev_err(dev, "remote input device register failed\n"); |
@@ -444,6 +445,8 @@ static int __devinit streamzap_probe(struct usb_interface *intf, | |||
444 | sz->decoder_state = PulseSpace; | 445 | sz->decoder_state = PulseSpace; |
445 | /* FIXME: don't yet have a way to set this */ | 446 | /* FIXME: don't yet have a way to set this */ |
446 | sz->timeout_enabled = true; | 447 | sz->timeout_enabled = true; |
448 | sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & | ||
449 | IR_MAX_DURATION) | 0x03000000); | ||
447 | #if 0 | 450 | #if 0 |
448 | /* not yet supported, depends on patches from maxim */ | 451 | /* not yet supported, depends on patches from maxim */ |
449 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ | 452 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ |