.. | .. |
---|
24 | 24 | #include <linux/delay.h> |
---|
25 | 25 | #include <linux/interrupt.h> |
---|
26 | 26 | #include <linux/usb.h> |
---|
| 27 | +#include <linux/usb/input.h> |
---|
27 | 28 | #include <linux/slab.h> |
---|
28 | 29 | #include <linux/bitrev.h> |
---|
29 | 30 | |
---|
.. | .. |
---|
58 | 59 | struct em28xx_IR { |
---|
59 | 60 | struct em28xx *dev; |
---|
60 | 61 | struct rc_dev *rc; |
---|
61 | | - char name[32]; |
---|
62 | 62 | char phys[32]; |
---|
63 | 63 | |
---|
64 | 64 | /* poll decoder */ |
---|
.. | .. |
---|
277 | 277 | break; |
---|
278 | 278 | |
---|
279 | 279 | case RC_PROTO_BIT_NEC: |
---|
280 | | - poll_result->scancode = msg[1] << 8 | msg[2]; |
---|
281 | | - if ((msg[3] ^ msg[4]) != 0xff) { /* 32 bits NEC */ |
---|
282 | | - poll_result->protocol = RC_PROTO_NEC32; |
---|
283 | | - poll_result->scancode = RC_SCANCODE_NEC32((msg[1] << 24) | |
---|
284 | | - (msg[2] << 16) | |
---|
285 | | - (msg[3] << 8) | |
---|
286 | | - (msg[4])); |
---|
287 | | - } else if ((msg[1] ^ msg[2]) != 0xff) { /* 24 bits NEC */ |
---|
288 | | - poll_result->protocol = RC_PROTO_NECX; |
---|
289 | | - poll_result->scancode = RC_SCANCODE_NECX(msg[1] << 8 | |
---|
290 | | - msg[2], msg[3]); |
---|
291 | | - } else { /* Normal NEC */ |
---|
292 | | - poll_result->protocol = RC_PROTO_NEC; |
---|
293 | | - poll_result->scancode = RC_SCANCODE_NEC(msg[1], msg[3]); |
---|
294 | | - } |
---|
| 280 | + poll_result->scancode = ir_nec_bytes_to_scancode(msg[1], msg[2], msg[3], msg[4], |
---|
| 281 | + &poll_result->protocol); |
---|
295 | 282 | break; |
---|
296 | 283 | |
---|
297 | 284 | case RC_PROTO_BIT_RC6_0: |
---|
.. | .. |
---|
499 | 486 | * at address 0x18, so if that address is needed for another board in |
---|
500 | 487 | * the future, please put it after 0x1f. |
---|
501 | 488 | */ |
---|
502 | | - const unsigned short addr_list[] = { |
---|
| 489 | + static const unsigned short addr_list[] = { |
---|
503 | 490 | 0x1f, 0x30, 0x47, I2C_CLIENT_END |
---|
504 | 491 | }; |
---|
505 | 492 | |
---|
.. | .. |
---|
617 | 604 | set_bit(EM28XX_SNAPSHOT_KEY, input_dev->keybit); |
---|
618 | 605 | input_dev->keycodesize = 0; |
---|
619 | 606 | input_dev->keycodemax = 0; |
---|
620 | | - input_dev->id.bustype = BUS_USB; |
---|
621 | | - input_dev->id.vendor = le16_to_cpu(udev->descriptor.idVendor); |
---|
622 | | - input_dev->id.product = le16_to_cpu(udev->descriptor.idProduct); |
---|
623 | | - input_dev->id.version = 1; |
---|
| 607 | + usb_to_input_id(udev, &input_dev->id); |
---|
624 | 608 | input_dev->dev.parent = &dev->intf->dev; |
---|
625 | 609 | |
---|
626 | 610 | err = input_register_device(input_dev); |
---|
.. | .. |
---|
833 | 817 | /* This is how often we ask the chip for IR information */ |
---|
834 | 818 | ir->polling = 100; /* ms */ |
---|
835 | 819 | |
---|
836 | | - /* init input device */ |
---|
837 | | - snprintf(ir->name, sizeof(ir->name), "%s IR", |
---|
838 | | - dev_name(&dev->intf->dev)); |
---|
839 | | - |
---|
840 | 820 | usb_make_path(udev, ir->phys, sizeof(ir->phys)); |
---|
841 | 821 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); |
---|
842 | 822 | |
---|
843 | | - rc->device_name = ir->name; |
---|
| 823 | + rc->device_name = em28xx_boards[dev->model].name; |
---|
844 | 824 | rc->input_phys = ir->phys; |
---|
845 | | - rc->input_id.bustype = BUS_USB; |
---|
846 | | - rc->input_id.version = 1; |
---|
847 | | - rc->input_id.vendor = le16_to_cpu(udev->descriptor.idVendor); |
---|
848 | | - rc->input_id.product = le16_to_cpu(udev->descriptor.idProduct); |
---|
| 825 | + usb_to_input_id(udev, &rc->input_id); |
---|
849 | 826 | rc->dev.parent = &dev->intf->dev; |
---|
850 | 827 | rc->driver_name = MODULE_NAME; |
---|
851 | 828 | |
---|