diff options
author | Ulrich Eckhardt <uli-lirc@uli-eckhardt.de> | 2014-07-26 13:56:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-08-21 16:25:34 -0400 |
commit | 0d8053f2ace52c816800193d705ea82a2ffd6dc8 (patch) | |
tree | 00e99ea7dafc293a3b133a76be340cee37e2474f | |
parent | d4b32646468088323f27a7788ce3b07191015142 (diff) |
[media] imon: Define keytables per USB Device Id
This patch defines the keytables per USB Device ID.
Signed-off-by: Ulrich Eckhardt <uli@uli-eckhardt.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r-- | drivers/media/rc/imon.c | 266 |
1 files changed, 173 insertions, 93 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 7115e68ba697..3fc759537cc6 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -87,6 +87,18 @@ static ssize_t lcd_write(struct file *file, const char __user *buf, | |||
87 | 87 | ||
88 | /*** G L O B A L S ***/ | 88 | /*** G L O B A L S ***/ |
89 | 89 | ||
90 | struct imon_panel_key_table { | ||
91 | u64 hw_code; | ||
92 | u32 keycode; | ||
93 | }; | ||
94 | |||
95 | struct imon_usb_dev_descr { | ||
96 | __u16 flags; | ||
97 | #define IMON_NO_FLAGS 0 | ||
98 | #define IMON_NEED_20MS_PKT_DELAY 1 | ||
99 | struct imon_panel_key_table key_table[]; | ||
100 | }; | ||
101 | |||
90 | struct imon_context { | 102 | struct imon_context { |
91 | struct device *dev; | 103 | struct device *dev; |
92 | /* Newer devices have two interfaces */ | 104 | /* Newer devices have two interfaces */ |
@@ -150,6 +162,8 @@ struct imon_context { | |||
150 | struct timer_list ttimer; /* touch screen timer */ | 162 | struct timer_list ttimer; /* touch screen timer */ |
151 | int touch_x; /* x coordinate on touchscreen */ | 163 | int touch_x; /* x coordinate on touchscreen */ |
152 | int touch_y; /* y coordinate on touchscreen */ | 164 | int touch_y; /* y coordinate on touchscreen */ |
165 | struct imon_usb_dev_descr *dev_descr; /* device description with key | ||
166 | table for front panels */ | ||
153 | }; | 167 | }; |
154 | 168 | ||
155 | #define TOUCH_TIMEOUT (HZ/30) | 169 | #define TOUCH_TIMEOUT (HZ/30) |
@@ -186,8 +200,111 @@ enum { | |||
186 | IMON_KEY_PANEL = 2, | 200 | IMON_KEY_PANEL = 2, |
187 | }; | 201 | }; |
188 | 202 | ||
189 | enum { | 203 | static struct usb_class_driver imon_vfd_class = { |
190 | IMON_NEED_20MS_PKT_DELAY = 1 | 204 | .name = DEVICE_NAME, |
205 | .fops = &vfd_fops, | ||
206 | .minor_base = DISPLAY_MINOR_BASE, | ||
207 | }; | ||
208 | |||
209 | static struct usb_class_driver imon_lcd_class = { | ||
210 | .name = DEVICE_NAME, | ||
211 | .fops = &lcd_fops, | ||
212 | .minor_base = DISPLAY_MINOR_BASE, | ||
213 | }; | ||
214 | |||
215 | /* imon receiver front panel/knob key table */ | ||
216 | static const struct imon_usb_dev_descr imon_default_table = { | ||
217 | .flags = IMON_NO_FLAGS, | ||
218 | .key_table = { | ||
219 | { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */ | ||
220 | { 0x000000001200ffeell, KEY_UP }, | ||
221 | { 0x000000001300ffeell, KEY_DOWN }, | ||
222 | { 0x000000001400ffeell, KEY_LEFT }, | ||
223 | { 0x000000001500ffeell, KEY_RIGHT }, | ||
224 | { 0x000000001600ffeell, KEY_ENTER }, | ||
225 | { 0x000000001700ffeell, KEY_ESC }, | ||
226 | { 0x000000001f00ffeell, KEY_AUDIO }, | ||
227 | { 0x000000002000ffeell, KEY_VIDEO }, | ||
228 | { 0x000000002100ffeell, KEY_CAMERA }, | ||
229 | { 0x000000002700ffeell, KEY_DVD }, | ||
230 | { 0x000000002300ffeell, KEY_TV }, | ||
231 | { 0x000000002b00ffeell, KEY_EXIT }, | ||
232 | { 0x000000002c00ffeell, KEY_SELECT }, | ||
233 | { 0x000000002d00ffeell, KEY_MENU }, | ||
234 | { 0x000000000500ffeell, KEY_PREVIOUS }, | ||
235 | { 0x000000000700ffeell, KEY_REWIND }, | ||
236 | { 0x000000000400ffeell, KEY_STOP }, | ||
237 | { 0x000000003c00ffeell, KEY_PLAYPAUSE }, | ||
238 | { 0x000000000800ffeell, KEY_FASTFORWARD }, | ||
239 | { 0x000000000600ffeell, KEY_NEXT }, | ||
240 | { 0x000000010000ffeell, KEY_RIGHT }, | ||
241 | { 0x000001000000ffeell, KEY_LEFT }, | ||
242 | { 0x000000003d00ffeell, KEY_SELECT }, | ||
243 | { 0x000100000000ffeell, KEY_VOLUMEUP }, | ||
244 | { 0x010000000000ffeell, KEY_VOLUMEDOWN }, | ||
245 | { 0x000000000100ffeell, KEY_MUTE }, | ||
246 | /* 0xffdc iMON MCE VFD */ | ||
247 | { 0x00010000ffffffeell, KEY_VOLUMEUP }, | ||
248 | { 0x01000000ffffffeell, KEY_VOLUMEDOWN }, | ||
249 | { 0x00000001ffffffeell, KEY_MUTE }, | ||
250 | { 0x0000000fffffffeell, KEY_MEDIA }, | ||
251 | { 0x00000012ffffffeell, KEY_UP }, | ||
252 | { 0x00000013ffffffeell, KEY_DOWN }, | ||
253 | { 0x00000014ffffffeell, KEY_LEFT }, | ||
254 | { 0x00000015ffffffeell, KEY_RIGHT }, | ||
255 | { 0x00000016ffffffeell, KEY_ENTER }, | ||
256 | { 0x00000017ffffffeell, KEY_ESC }, | ||
257 | /* iMON Knob values */ | ||
258 | { 0x000100ffffffffeell, KEY_VOLUMEUP }, | ||
259 | { 0x010000ffffffffeell, KEY_VOLUMEDOWN }, | ||
260 | { 0x000008ffffffffeell, KEY_MUTE }, | ||
261 | { 0, KEY_RESERVED }, | ||
262 | } | ||
263 | }; | ||
264 | |||
265 | static const struct imon_usb_dev_descr imon_OEM_VFD = { | ||
266 | .flags = IMON_NEED_20MS_PKT_DELAY, | ||
267 | .key_table = { | ||
268 | { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */ | ||
269 | { 0x000000001200ffeell, KEY_UP }, | ||
270 | { 0x000000001300ffeell, KEY_DOWN }, | ||
271 | { 0x000000001400ffeell, KEY_LEFT }, | ||
272 | { 0x000000001500ffeell, KEY_RIGHT }, | ||
273 | { 0x000000001600ffeell, KEY_ENTER }, | ||
274 | { 0x000000001700ffeell, KEY_ESC }, | ||
275 | { 0x000000001f00ffeell, KEY_AUDIO }, | ||
276 | { 0x000000002b00ffeell, KEY_EXIT }, | ||
277 | { 0x000000002c00ffeell, KEY_SELECT }, | ||
278 | { 0x000000002d00ffeell, KEY_MENU }, | ||
279 | { 0x000000000500ffeell, KEY_PREVIOUS }, | ||
280 | { 0x000000000700ffeell, KEY_REWIND }, | ||
281 | { 0x000000000400ffeell, KEY_STOP }, | ||
282 | { 0x000000003c00ffeell, KEY_PLAYPAUSE }, | ||
283 | { 0x000000000800ffeell, KEY_FASTFORWARD }, | ||
284 | { 0x000000000600ffeell, KEY_NEXT }, | ||
285 | { 0x000000010000ffeell, KEY_RIGHT }, | ||
286 | { 0x000001000000ffeell, KEY_LEFT }, | ||
287 | { 0x000000003d00ffeell, KEY_SELECT }, | ||
288 | { 0x000100000000ffeell, KEY_VOLUMEUP }, | ||
289 | { 0x010000000000ffeell, KEY_VOLUMEDOWN }, | ||
290 | { 0x000000000100ffeell, KEY_MUTE }, | ||
291 | /* 0xffdc iMON MCE VFD */ | ||
292 | { 0x00010000ffffffeell, KEY_VOLUMEUP }, | ||
293 | { 0x01000000ffffffeell, KEY_VOLUMEDOWN }, | ||
294 | { 0x00000001ffffffeell, KEY_MUTE }, | ||
295 | { 0x0000000fffffffeell, KEY_MEDIA }, | ||
296 | { 0x00000012ffffffeell, KEY_UP }, | ||
297 | { 0x00000013ffffffeell, KEY_DOWN }, | ||
298 | { 0x00000014ffffffeell, KEY_LEFT }, | ||
299 | { 0x00000015ffffffeell, KEY_RIGHT }, | ||
300 | { 0x00000016ffffffeell, KEY_ENTER }, | ||
301 | { 0x00000017ffffffeell, KEY_ESC }, | ||
302 | /* iMON Knob values */ | ||
303 | { 0x000100ffffffffeell, KEY_VOLUMEUP }, | ||
304 | { 0x010000ffffffffeell, KEY_VOLUMEDOWN }, | ||
305 | { 0x000008ffffffffeell, KEY_MUTE }, | ||
306 | { 0, KEY_RESERVED }, | ||
307 | } | ||
191 | }; | 308 | }; |
192 | 309 | ||
193 | /* | 310 | /* |
@@ -208,7 +325,8 @@ static struct usb_device_id imon_usb_id_table[] = { | |||
208 | * SoundGraph iMON PAD (IR & LCD) | 325 | * SoundGraph iMON PAD (IR & LCD) |
209 | * SoundGraph iMON Knob (IR only) | 326 | * SoundGraph iMON Knob (IR only) |
210 | */ | 327 | */ |
211 | { USB_DEVICE(0x15c2, 0xffdc) }, | 328 | { USB_DEVICE(0x15c2, 0xffdc), |
329 | .driver_info = (unsigned long)&imon_default_table }, | ||
212 | 330 | ||
213 | /* | 331 | /* |
214 | * Newer devices, all driven by the latest iMON Windows driver, full | 332 | * Newer devices, all driven by the latest iMON Windows driver, full |
@@ -216,43 +334,62 @@ static struct usb_device_id imon_usb_id_table[] = { | |||
216 | * Need user input to fill in details on unknown devices. | 334 | * Need user input to fill in details on unknown devices. |
217 | */ | 335 | */ |
218 | /* SoundGraph iMON OEM Touch LCD (IR & 7" VGA LCD) */ | 336 | /* SoundGraph iMON OEM Touch LCD (IR & 7" VGA LCD) */ |
219 | { USB_DEVICE(0x15c2, 0x0034) }, | 337 | { USB_DEVICE(0x15c2, 0x0034), |
338 | .driver_info = (unsigned long)&imon_default_table }, | ||
220 | /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */ | 339 | /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */ |
221 | { USB_DEVICE(0x15c2, 0x0035) }, | 340 | { USB_DEVICE(0x15c2, 0x0035), |
341 | .driver_info = (unsigned long)&imon_default_table}, | ||
222 | /* SoundGraph iMON OEM VFD (IR & VFD) */ | 342 | /* SoundGraph iMON OEM VFD (IR & VFD) */ |
223 | { USB_DEVICE(0x15c2, 0x0036), .driver_info = IMON_NEED_20MS_PKT_DELAY }, | 343 | { USB_DEVICE(0x15c2, 0x0036), |
344 | .driver_info = (unsigned long)&imon_OEM_VFD }, | ||
224 | /* device specifics unknown */ | 345 | /* device specifics unknown */ |
225 | { USB_DEVICE(0x15c2, 0x0037) }, | 346 | { USB_DEVICE(0x15c2, 0x0037), |
347 | .driver_info = (unsigned long)&imon_default_table}, | ||
226 | /* SoundGraph iMON OEM LCD (IR & LCD) */ | 348 | /* SoundGraph iMON OEM LCD (IR & LCD) */ |
227 | { USB_DEVICE(0x15c2, 0x0038) }, | 349 | { USB_DEVICE(0x15c2, 0x0038), |
350 | .driver_info = (unsigned long)&imon_default_table}, | ||
228 | /* SoundGraph iMON UltraBay (IR & LCD) */ | 351 | /* SoundGraph iMON UltraBay (IR & LCD) */ |
229 | { USB_DEVICE(0x15c2, 0x0039) }, | 352 | { USB_DEVICE(0x15c2, 0x0039), |
353 | .driver_info = (unsigned long)&imon_default_table}, | ||
230 | /* device specifics unknown */ | 354 | /* device specifics unknown */ |
231 | { USB_DEVICE(0x15c2, 0x003a) }, | 355 | { USB_DEVICE(0x15c2, 0x003a), |
356 | .driver_info = (unsigned long)&imon_default_table}, | ||
232 | /* device specifics unknown */ | 357 | /* device specifics unknown */ |
233 | { USB_DEVICE(0x15c2, 0x003b) }, | 358 | { USB_DEVICE(0x15c2, 0x003b), |
359 | .driver_info = (unsigned long)&imon_default_table}, | ||
234 | /* SoundGraph iMON OEM Inside (IR only) */ | 360 | /* SoundGraph iMON OEM Inside (IR only) */ |
235 | { USB_DEVICE(0x15c2, 0x003c) }, | 361 | { USB_DEVICE(0x15c2, 0x003c), |
362 | .driver_info = (unsigned long)&imon_default_table}, | ||
236 | /* device specifics unknown */ | 363 | /* device specifics unknown */ |
237 | { USB_DEVICE(0x15c2, 0x003d) }, | 364 | { USB_DEVICE(0x15c2, 0x003d), |
365 | .driver_info = (unsigned long)&imon_default_table}, | ||
238 | /* device specifics unknown */ | 366 | /* device specifics unknown */ |
239 | { USB_DEVICE(0x15c2, 0x003e) }, | 367 | { USB_DEVICE(0x15c2, 0x003e), |
368 | .driver_info = (unsigned long)&imon_default_table}, | ||
240 | /* device specifics unknown */ | 369 | /* device specifics unknown */ |
241 | { USB_DEVICE(0x15c2, 0x003f) }, | 370 | { USB_DEVICE(0x15c2, 0x003f), |
371 | .driver_info = (unsigned long)&imon_default_table}, | ||
242 | /* device specifics unknown */ | 372 | /* device specifics unknown */ |
243 | { USB_DEVICE(0x15c2, 0x0040) }, | 373 | { USB_DEVICE(0x15c2, 0x0040), |
374 | .driver_info = (unsigned long)&imon_default_table}, | ||
244 | /* SoundGraph iMON MINI (IR only) */ | 375 | /* SoundGraph iMON MINI (IR only) */ |
245 | { USB_DEVICE(0x15c2, 0x0041) }, | 376 | { USB_DEVICE(0x15c2, 0x0041), |
377 | .driver_info = (unsigned long)&imon_default_table}, | ||
246 | /* Antec Veris Multimedia Station EZ External (IR only) */ | 378 | /* Antec Veris Multimedia Station EZ External (IR only) */ |
247 | { USB_DEVICE(0x15c2, 0x0042) }, | 379 | { USB_DEVICE(0x15c2, 0x0042), |
380 | .driver_info = (unsigned long)&imon_default_table}, | ||
248 | /* Antec Veris Multimedia Station Basic Internal (IR only) */ | 381 | /* Antec Veris Multimedia Station Basic Internal (IR only) */ |
249 | { USB_DEVICE(0x15c2, 0x0043) }, | 382 | { USB_DEVICE(0x15c2, 0x0043), |
383 | .driver_info = (unsigned long)&imon_default_table}, | ||
250 | /* Antec Veris Multimedia Station Elite (IR & VFD) */ | 384 | /* Antec Veris Multimedia Station Elite (IR & VFD) */ |
251 | { USB_DEVICE(0x15c2, 0x0044) }, | 385 | { USB_DEVICE(0x15c2, 0x0044), |
386 | .driver_info = (unsigned long)&imon_default_table}, | ||
252 | /* Antec Veris Multimedia Station Premiere (IR & LCD) */ | 387 | /* Antec Veris Multimedia Station Premiere (IR & LCD) */ |
253 | { USB_DEVICE(0x15c2, 0x0045) }, | 388 | { USB_DEVICE(0x15c2, 0x0045), |
389 | .driver_info = (unsigned long)&imon_default_table}, | ||
254 | /* device specifics unknown */ | 390 | /* device specifics unknown */ |
255 | { USB_DEVICE(0x15c2, 0x0046) }, | 391 | { USB_DEVICE(0x15c2, 0x0046), |
392 | .driver_info = (unsigned long)&imon_default_table}, | ||
256 | {} | 393 | {} |
257 | }; | 394 | }; |
258 | 395 | ||
@@ -266,67 +403,6 @@ static struct usb_driver imon_driver = { | |||
266 | .id_table = imon_usb_id_table, | 403 | .id_table = imon_usb_id_table, |
267 | }; | 404 | }; |
268 | 405 | ||
269 | static struct usb_class_driver imon_vfd_class = { | ||
270 | .name = DEVICE_NAME, | ||
271 | .fops = &vfd_fops, | ||
272 | .minor_base = DISPLAY_MINOR_BASE, | ||
273 | }; | ||
274 | |||
275 | static struct usb_class_driver imon_lcd_class = { | ||
276 | .name = DEVICE_NAME, | ||
277 | .fops = &lcd_fops, | ||
278 | .minor_base = DISPLAY_MINOR_BASE, | ||
279 | }; | ||
280 | |||
281 | /* imon receiver front panel/knob key table */ | ||
282 | static const struct { | ||
283 | u64 hw_code; | ||
284 | u32 keycode; | ||
285 | } imon_panel_key_table[] = { | ||
286 | { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */ | ||
287 | { 0x000000001200ffeell, KEY_UP }, | ||
288 | { 0x000000001300ffeell, KEY_DOWN }, | ||
289 | { 0x000000001400ffeell, KEY_LEFT }, | ||
290 | { 0x000000001500ffeell, KEY_RIGHT }, | ||
291 | { 0x000000001600ffeell, KEY_ENTER }, | ||
292 | { 0x000000001700ffeell, KEY_ESC }, | ||
293 | { 0x000000001f00ffeell, KEY_AUDIO }, | ||
294 | { 0x000000002000ffeell, KEY_VIDEO }, | ||
295 | { 0x000000002100ffeell, KEY_CAMERA }, | ||
296 | { 0x000000002700ffeell, KEY_DVD }, | ||
297 | { 0x000000002300ffeell, KEY_TV }, | ||
298 | { 0x000000002b00ffeell, KEY_EXIT }, | ||
299 | { 0x000000002c00ffeell, KEY_SELECT }, | ||
300 | { 0x000000002d00ffeell, KEY_MENU }, | ||
301 | { 0x000000000500ffeell, KEY_PREVIOUS }, | ||
302 | { 0x000000000700ffeell, KEY_REWIND }, | ||
303 | { 0x000000000400ffeell, KEY_STOP }, | ||
304 | { 0x000000003c00ffeell, KEY_PLAYPAUSE }, | ||
305 | { 0x000000000800ffeell, KEY_FASTFORWARD }, | ||
306 | { 0x000000000600ffeell, KEY_NEXT }, | ||
307 | { 0x000000010000ffeell, KEY_RIGHT }, | ||
308 | { 0x000001000000ffeell, KEY_LEFT }, | ||
309 | { 0x000000003d00ffeell, KEY_SELECT }, | ||
310 | { 0x000100000000ffeell, KEY_VOLUMEUP }, | ||
311 | { 0x010000000000ffeell, KEY_VOLUMEDOWN }, | ||
312 | { 0x000000000100ffeell, KEY_MUTE }, | ||
313 | /* 0xffdc iMON MCE VFD */ | ||
314 | { 0x00010000ffffffeell, KEY_VOLUMEUP }, | ||
315 | { 0x01000000ffffffeell, KEY_VOLUMEDOWN }, | ||
316 | { 0x00000001ffffffeell, KEY_MUTE }, | ||
317 | { 0x0000000fffffffeell, KEY_MEDIA }, | ||
318 | { 0x00000012ffffffeell, KEY_UP }, | ||
319 | { 0x00000013ffffffeell, KEY_DOWN }, | ||
320 | { 0x00000014ffffffeell, KEY_LEFT }, | ||
321 | { 0x00000015ffffffeell, KEY_RIGHT }, | ||
322 | { 0x00000016ffffffeell, KEY_ENTER }, | ||
323 | { 0x00000017ffffffeell, KEY_ESC }, | ||
324 | /* iMON Knob values */ | ||
325 | { 0x000100ffffffffeell, KEY_VOLUMEUP }, | ||
326 | { 0x010000ffffffffeell, KEY_VOLUMEDOWN }, | ||
327 | { 0x000008ffffffffeell, KEY_MUTE }, | ||
328 | }; | ||
329 | |||
330 | /* to prevent races between open() and disconnect(), probing, etc */ | 406 | /* to prevent races between open() and disconnect(), probing, etc */ |
331 | static DEFINE_MUTEX(driver_lock); | 407 | static DEFINE_MUTEX(driver_lock); |
332 | 408 | ||
@@ -1210,18 +1286,19 @@ static u32 imon_mce_key_lookup(struct imon_context *ictx, u32 scancode) | |||
1210 | return keycode; | 1286 | return keycode; |
1211 | } | 1287 | } |
1212 | 1288 | ||
1213 | static u32 imon_panel_key_lookup(u64 code) | 1289 | static u32 imon_panel_key_lookup(struct imon_context *ictx, u64 code) |
1214 | { | 1290 | { |
1215 | int i; | 1291 | int i; |
1216 | u32 keycode = KEY_RESERVED; | 1292 | u32 keycode = KEY_RESERVED; |
1293 | struct imon_panel_key_table *key_table = ictx->dev_descr->key_table; | ||
1217 | 1294 | ||
1218 | for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { | 1295 | for (i = 0; key_table[i].hw_code != 0; i++) { |
1219 | if (imon_panel_key_table[i].hw_code == (code | 0xffee)) { | 1296 | if (key_table[i].hw_code == (code | 0xffee)) { |
1220 | keycode = imon_panel_key_table[i].keycode; | 1297 | keycode = key_table[i].keycode; |
1221 | break; | 1298 | break; |
1222 | } | 1299 | } |
1223 | } | 1300 | } |
1224 | 1301 | ictx->release_code = false; | |
1225 | return keycode; | 1302 | return keycode; |
1226 | } | 1303 | } |
1227 | 1304 | ||
@@ -1511,7 +1588,7 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1511 | if (len == 8 && buf[7] == 0xee) { | 1588 | if (len == 8 && buf[7] == 0xee) { |
1512 | scancode = be64_to_cpu(*((u64 *)buf)); | 1589 | scancode = be64_to_cpu(*((u64 *)buf)); |
1513 | ktype = IMON_KEY_PANEL; | 1590 | ktype = IMON_KEY_PANEL; |
1514 | kc = imon_panel_key_lookup(scancode); | 1591 | kc = imon_panel_key_lookup(ictx, scancode); |
1515 | } else { | 1592 | } else { |
1516 | scancode = be32_to_cpu(*((u32 *)buf)); | 1593 | scancode = be32_to_cpu(*((u32 *)buf)); |
1517 | if (ictx->rc_type == RC_BIT_RC6_MCE) { | 1594 | if (ictx->rc_type == RC_BIT_RC6_MCE) { |
@@ -1908,6 +1985,7 @@ out: | |||
1908 | 1985 | ||
1909 | static struct input_dev *imon_init_idev(struct imon_context *ictx) | 1986 | static struct input_dev *imon_init_idev(struct imon_context *ictx) |
1910 | { | 1987 | { |
1988 | struct imon_panel_key_table *key_table = ictx->dev_descr->key_table; | ||
1911 | struct input_dev *idev; | 1989 | struct input_dev *idev; |
1912 | int ret, i; | 1990 | int ret, i; |
1913 | 1991 | ||
@@ -1933,8 +2011,8 @@ static struct input_dev *imon_init_idev(struct imon_context *ictx) | |||
1933 | BIT_MASK(REL_WHEEL); | 2011 | BIT_MASK(REL_WHEEL); |
1934 | 2012 | ||
1935 | /* panel and/or knob code support */ | 2013 | /* panel and/or knob code support */ |
1936 | for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { | 2014 | for (i = 0; key_table[i].hw_code != 0; i++) { |
1937 | u32 kc = imon_panel_key_table[i].keycode; | 2015 | u32 kc = key_table[i].keycode; |
1938 | __set_bit(kc, idev->keybit); | 2016 | __set_bit(kc, idev->keybit); |
1939 | } | 2017 | } |
1940 | 2018 | ||
@@ -2135,9 +2213,11 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf, | |||
2135 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); | 2213 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); |
2136 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); | 2214 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); |
2137 | 2215 | ||
2216 | /* save drive info for later accessing the panel/knob key table */ | ||
2217 | ictx->dev_descr = (struct imon_usb_dev_descr *)id->driver_info; | ||
2138 | /* default send_packet delay is 5ms but some devices need more */ | 2218 | /* default send_packet delay is 5ms but some devices need more */ |
2139 | ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ? | 2219 | ictx->send_packet_delay = ictx->dev_descr->flags & |
2140 | 20 : 5; | 2220 | IMON_NEED_20MS_PKT_DELAY ? 20 : 5; |
2141 | 2221 | ||
2142 | ret = -ENODEV; | 2222 | ret = -ENODEV; |
2143 | iface_desc = intf->cur_altsetting; | 2223 | iface_desc = intf->cur_altsetting; |