aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Kondrashov <spbnick@gmail.com>2010-08-23 07:09:01 -0400
committerJiri Kosina <jkosina@suse.cz>2010-08-23 09:08:42 -0400
commit41fa92302be7fa37c5c38e17e2097d3e5e9da13a (patch)
tree06d928a10d8b041698c7f6821758fcab772e4a53
parentbd9033ebc15acd05c8df92b5fc7ecc9171d1087e (diff)
HID: uclogic: add proper support for PF1209
This removes extra event device and fixes reported button codes of UC-Logic Tablet PF1209. This tablet is also sold as Genius PenSketch 12x9 (or 9x12) and possibly under other names. Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-uclogic.c222
2 files changed, 223 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 7eb3b163406c..7f26ffebfaf0 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1383,6 +1383,7 @@ static const struct hid_device_id hid_blacklist[] = {
1383 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, 1383 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1384 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, 1384 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
1385 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, 1385 { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) },
1386 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
1386 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, 1387 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
1387 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, 1388 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },
1388 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, 1389 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) },
diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c
index fe36303dfd95..05fdc85a76e5 100644
--- a/drivers/hid/hid-uclogic.c
+++ b/drivers/hid/hid-uclogic.c
@@ -342,10 +342,230 @@ static __u8 wp8060u_rdesc_fixed[] = {
342 0xC0 /* End Collection */ 342 0xC0 /* End Collection */
343}; 343};
344 344
345/*
346 * Original PF1209 report descriptor.
347 *
348 * The descriptor is similar to WPXXXXU descriptors, with an addition of a
349 * feature report (ID 4) of unknown purpose.
350 *
351 * Although the advertised resolution is 4000 LPI the unused report ID
352 * (taken from WPXXXXU, it seems) states 2000 LPI, but it is probably
353 * incorrect and is a result of blind copying without understanding. Anyway
354 * the real logical extents are always scaled to 0..32767, which IMHO spoils
355 * the precision.
356 *
357 * Usage Page (Digitizer), ; Digitizer (0Dh)
358 * Usage (Pen), ; Pen (02h, application collection)
359 * Collection (Application),
360 * Report ID (7),
361 * Usage (Stylus), ; Stylus (20h, logical collection)
362 * Collection (Physical),
363 * Usage (Tip Switch), ; Tip switch (42h, momentary control)
364 * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
365 * Usage (Eraser), ; Eraser (45h, momentary control)
366 * Logical Minimum (0),
367 * Logical Maximum (1),
368 * Report Size (1),
369 * Report Count (3),
370 * Input (Variable),
371 * Report Count (3),
372 * Input (Constant, Variable),
373 * Usage (In Range), ; In range (32h, momentary control)
374 * Report Count (1),
375 * Input (Variable),
376 * Report Count (1),
377 * Input (Constant, Variable),
378 * Usage Page (Desktop), ; Generic desktop controls (01h)
379 * Usage (X), ; X (30h, dynamic value)
380 * Report Size (16),
381 * Report Count (1),
382 * Push,
383 * Unit Exponent (13),
384 * Unit (Inch^3),
385 * Physical Minimum (0),
386 * Physical Maximum (12000),
387 * Logical Maximum (24000),
388 * Input (Variable),
389 * Usage (Y), ; Y (31h, dynamic value)
390 * Physical Maximum (9000),
391 * Logical Maximum (18000),
392 * Input (Variable),
393 * Pop,
394 * Usage Page (Digitizer), ; Digitizer (0Dh)
395 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
396 * Logical Maximum (1023),
397 * Input (Variable),
398 * Report Size (16),
399 * End Collection,
400 * End Collection,
401 * Usage Page (Desktop), ; Generic desktop controls (01h)
402 * Usage (Mouse), ; Mouse (02h, application collection)
403 * Collection (Application),
404 * Report ID (8),
405 * Usage (Pointer), ; Pointer (01h, physical collection)
406 * Collection (Physical),
407 * Usage Page (Button), ; Button (09h)
408 * Usage Minimum (01h),
409 * Usage Maximum (03h),
410 * Logical Minimum (0),
411 * Logical Maximum (1),
412 * Report Count (3),
413 * Report Size (1),
414 * Input (Variable),
415 * Report Count (5),
416 * Input (Constant),
417 * Usage Page (Desktop), ; Generic desktop controls (01h)
418 * Usage (X), ; X (30h, dynamic value)
419 * Usage (Y), ; Y (31h, dynamic value)
420 * Usage (Wheel), ; Wheel (38h, dynamic value)
421 * Usage (00h),
422 * Logical Minimum (-127),
423 * Logical Maximum (127),
424 * Report Size (8),
425 * Report Count (4),
426 * Input (Variable, Relative),
427 * End Collection,
428 * End Collection,
429 * Usage Page (Desktop), ; Generic desktop controls (01h)
430 * Usage (Mouse), ; Mouse (02h, application collection)
431 * Collection (Application),
432 * Report ID (9),
433 * Usage (Pointer), ; Pointer (01h, physical collection)
434 * Collection (Physical),
435 * Usage Page (Button), ; Button (09h)
436 * Usage Minimum (01h),
437 * Usage Maximum (03h),
438 * Logical Minimum (0),
439 * Logical Maximum (1),
440 * Report Count (3),
441 * Report Size (1),
442 * Input (Variable),
443 * Report Count (5),
444 * Input (Constant),
445 * Usage Page (Desktop), ; Generic desktop controls (01h)
446 * Usage (X), ; X (30h, dynamic value)
447 * Usage (Y), ; Y (31h, dynamic value)
448 * Logical Minimum (0),
449 * Logical Maximum (32767),
450 * Physical Minimum (0),
451 * Physical Maximum (32767),
452 * Report Count (2),
453 * Report Size (16),
454 * Input (Variable),
455 * Usage Page (Digitizer), ; Digitizer (0Dh)
456 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
457 * Logical Maximum (1023),
458 * Report Count (1),
459 * Report Size (16),
460 * Input (Variable),
461 * End Collection,
462 * End Collection,
463 * Usage Page (Desktop), ; Generic desktop controls (01h)
464 * Usage (00h),
465 * Collection (Application),
466 * Report ID (4),
467 * Logical Minimum (0),
468 * Logical Maximum (255),
469 * Usage (00h),
470 * Report Size (8),
471 * Report Count (3),
472 * Feature (Variable),
473 * End Collection
474 */
475
476/* Size of the original descriptor of PF1209 tablet */
477#define PF1209_RDESC_ORIG_SIZE 234
478
479/*
480 * Fixed PF1209 report descriptor
481 *
482 * The descriptor is fixed similarly to WP5540U and WP8060U, plus the
483 * feature report is removed, because its purpose is unknown and it is of no
484 * use to the generic HID driver anyway for now.
485 */
486static __u8 pf1209_rdesc_fixed[] = {
487 0x05, 0x0D, /* Usage Page (Digitizer), */
488 0x09, 0x02, /* Usage (Pen), */
489 0xA1, 0x01, /* Collection (Application), */
490 0x85, 0x09, /* Report ID (9), */
491 0x09, 0x20, /* Usage (Stylus), */
492 0xA0, /* Collection (Physical), */
493 0x75, 0x01, /* Report Size (1), */
494 0x09, 0x42, /* Usage (Tip Switch), */
495 0x09, 0x44, /* Usage (Barrel Switch), */
496 0x09, 0x46, /* Usage (Tablet Pick), */
497 0x14, /* Logical Minimum (0), */
498 0x25, 0x01, /* Logical Maximum (1), */
499 0x95, 0x03, /* Report Count (3), */
500 0x81, 0x02, /* Input (Variable), */
501 0x95, 0x05, /* Report Count (5), */
502 0x81, 0x01, /* Input (Constant), */
503 0x75, 0x10, /* Report Size (16), */
504 0x95, 0x01, /* Report Count (1), */
505 0x14, /* Logical Minimum (0), */
506 0xA4, /* Push, */
507 0x05, 0x01, /* Usage Page (Desktop), */
508 0x55, 0xFD, /* Unit Exponent (-3), */
509 0x65, 0x13, /* Unit (Inch), */
510 0x34, /* Physical Minimum (0), */
511 0x09, 0x30, /* Usage (X), */
512 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
513 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
514 0x81, 0x02, /* Input (Variable), */
515 0x09, 0x31, /* Usage (Y), */
516 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
517 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */
518 0x81, 0x02, /* Input (Variable), */
519 0xB4, /* Pop, */
520 0x09, 0x30, /* Usage (Tip Pressure), */
521 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
522 0x81, 0x02, /* Input (Variable), */
523 0xC0, /* End Collection, */
524 0xC0, /* End Collection, */
525 0x05, 0x01, /* Usage Page (Desktop), */
526 0x09, 0x02, /* Usage (Mouse), */
527 0xA1, 0x01, /* Collection (Application), */
528 0x85, 0x08, /* Report ID (8), */
529 0x09, 0x01, /* Usage (Pointer), */
530 0xA0, /* Collection (Physical), */
531 0x75, 0x01, /* Report Size (1), */
532 0x05, 0x09, /* Usage Page (Button), */
533 0x19, 0x01, /* Usage Minimum (01h), */
534 0x29, 0x03, /* Usage Maximum (03h), */
535 0x14, /* Logical Minimum (0), */
536 0x25, 0x01, /* Logical Maximum (1), */
537 0x95, 0x03, /* Report Count (3), */
538 0x81, 0x02, /* Input (Variable), */
539 0x95, 0x05, /* Report Count (5), */
540 0x81, 0x01, /* Input (Constant), */
541 0x05, 0x01, /* Usage Page (Desktop), */
542 0x75, 0x08, /* Report Size (8), */
543 0x09, 0x30, /* Usage (X), */
544 0x09, 0x31, /* Usage (Y), */
545 0x15, 0x81, /* Logical Minimum (-127), */
546 0x25, 0x7F, /* Logical Maximum (127), */
547 0x95, 0x02, /* Report Count (2), */
548 0x81, 0x06, /* Input (Variable, Relative), */
549 0x09, 0x38, /* Usage (Wheel), */
550 0x15, 0xFF, /* Logical Minimum (-1), */
551 0x25, 0x01, /* Logical Maximum (1), */
552 0x95, 0x01, /* Report Count (1), */
553 0x81, 0x06, /* Input (Variable, Relative), */
554 0x81, 0x01, /* Input (Constant), */
555 0xC0, /* End Collection, */
556 0xC0 /* End Collection */
557};
558
345static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, 559static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
346 unsigned int *rsize) 560 unsigned int *rsize)
347{ 561{
348 switch (hdev->product) { 562 switch (hdev->product) {
563 case USB_DEVICE_ID_UCLOGIC_TABLET_PF1209:
564 if (*rsize == PF1209_RDESC_ORIG_SIZE) {
565 rdesc = pf1209_rdesc_fixed;
566 *rsize = sizeof(pf1209_rdesc_fixed);
567 }
568 break;
349 case USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U: 569 case USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U:
350 if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) { 570 if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) {
351 rdesc = wp4030u_rdesc_fixed; 571 rdesc = wp4030u_rdesc_fixed;
@@ -371,6 +591,8 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc,
371 591
372static const struct hid_device_id uclogic_devices[] = { 592static const struct hid_device_id uclogic_devices[] = {
373 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, 593 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
594 USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) },
595 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
374 USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, 596 USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) },
375 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, 597 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
376 USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, 598 USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) },