14 unsigned int keymap_size)
17 unsigned int scancode;
22 if (input_scancode_to_scalar(ke, &scancode))
26 for (index = 0; index < keymap_size; index++)
27 if (keymap[index].scancode == scancode)
31 if (index >= keymap_size) {
32 for (index = 0; index < keymap_size; index++) {
44 static int legacy_dvb_usb_getkeycode(
struct input_dev *
dev,
49 unsigned int keymap_size = d->
props.rc.legacy.rc_map_size;
52 index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size);
53 if (index >= keymap_size)
66 static int legacy_dvb_usb_setkeycode(
struct input_dev *dev,
68 unsigned int *old_keycode)
72 unsigned int keymap_size = d->
props.rc.legacy.rc_map_size;
75 index = legacy_dvb_usb_get_keymap_index(ke, keymap, keymap_size);
83 if (index >= keymap_size)
92 for (index = 0; index < keymap_size; index++) {
93 if (keymap[index].
keycode == *old_keycode) {
108 static void legacy_dvb_usb_read_remote_control(
struct work_struct *
work)
122 if (d->
props.rc.legacy.rc_query(d,&event,&state)) {
123 err(
"error while querying for an remote control event.");
186 int i,
err, rc_interval;
187 struct input_dev *input_dev;
189 input_dev = input_allocate_device();
194 input_dev->name =
"IR-receiver inside an USB DVB receiver";
196 usb_to_input_id(d->
udev, &input_dev->id);
197 input_dev->dev.parent = &d->
udev->dev;
201 input_dev->getkeycode = legacy_dvb_usb_getkeycode;
202 input_dev->setkeycode = legacy_dvb_usb_setkeycode;
205 deb_rc(
"key map size: %d\n", d->
props.rc.legacy.rc_map_size);
206 for (i = 0; i < d->
props.rc.legacy.rc_map_size; i++) {
207 deb_rc(
"setting bit for event %d item %d\n",
208 d->
props.rc.legacy.rc_map_table[i].keycode, i);
209 set_bit(d->
props.rc.legacy.rc_map_table[i].keycode, input_dev->keybit);
216 input_set_drvdata(input_dev, d);
218 err = input_register_device(input_dev);
220 input_free_device(input_dev);
222 rc_interval = d->
props.rc.legacy.rc_interval;
226 info(
"schedule remote query interval to %d msecs.", rc_interval);
240 static void dvb_usb_read_remote_control(
struct work_struct *work)
255 err = d->
props.rc.core.rc_query(d);
257 err(
"error %d while querying for an remote control event.", err);
265 int err, rc_interval;
278 dev->
input_name =
"IR-receiver inside an USB DVB receiver";
280 dev->
dev.parent = &d->
udev->dev;
292 if (!d->
props.rc.core.rc_query || d->
props.rc.core.bulk_mode)
298 rc_interval = d->
props.rc.core.rc_interval;
300 info(
"schedule remote query interval to %d msecs.", rc_interval);
314 if (d->
props.rc.legacy.rc_map_table && d->
props.rc.legacy.rc_query)
316 else if (d->
props.rc.core.rc_codes)
325 if (d->
props.rc.legacy.rc_interval < 40)
326 d->
props.rc.legacy.rc_interval = 100;
329 err = legacy_dvb_usb_remote_init(d);
331 err = rc_core_dvb_usb_remote_init(d);
353 #define DVB_USB_RC_NEC_EMPTY 0x00
354 #define DVB_USB_RC_NEC_KEY_PRESSED 0x01
355 #define DVB_USB_RC_NEC_KEY_REPEATED 0x02
357 u8 keybuf[5],
u32 *event,
int *state)
367 if ((
u8) ~keybuf[1] != keybuf[2] ||
368 (
u8) ~keybuf[3] != keybuf[4]) {
369 deb_err(
"remote control checksum failed.\n");
373 for (i = 0; i < d->
props.rc.legacy.rc_map_size; i++)
374 if (rc5_custom(&keymap[i]) == keybuf[1] &&
375 rc5_data(&keymap[i]) == keybuf[3]) {
380 deb_err(
"key mapping failed - no appropriate key found in keymapping\n");
386 deb_err(
"unknown type of remote status: %d\n",keybuf[0]);