Lines Matching +full:tablet +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>
20 * v0.1 - Initial release
21 * v0.2 - Hack to get around fake event 28's. (Bryan W. Headley)
22 * v0.3 - Make URB dynamic (Bryan W. Headley, Jun-8-2002)
24 * v0.4 - Rewrote substantial portions of the code to deal with
26 * support of 6000U - 12000U, procfs, and macro key support
27 * (Jan-1-2003 - Feb-5-2003, Bryan W. Headley)
28 * v1.0 - Added support for diagnostic messages, count of messages
29 * received from URB - Mar-8-2003, Bryan W. Headley
30 * v1.1 - added support for tablet resolution, changed DV and proximity
31 * some corrections - Jun-22-2003, martin schneebacher
32 * - Added support for the sysfs interface, deprecating the
34 * Wheel command. Bryan W. Headley July-15-2003.
35 * v1.2 - Reworked jitter timer as a kernel thread.
36 * Bryan W. Headley November-28-2003/Jan-10-2004.
37 * v1.3 - Repaired issue of kernel thread going nuts on single-processor
40 * v1.4 - Re-wire jitter so it does not require a thread. Courtesy of
47 * v1.5 - Added previousJitterable, so we don't do jitter delay when the
52 * driver for your X server, as well as the Gaiptek GUI Front-end
53 * "Tablet Manager".
71 * (returned as Report 1 - relative coordinates from mouse and stylus)
79 * (returned as Report 2 - absolute coordinates from the stylus)
91 * (returned as Report 3 - absolute coordinates from the mouse)
103 * (returned as Report 4 - macrokeys from the stylus)
113 * (returned as Report 5 - macrokeys from the mouse)
126 * BS2 also referred to as Tablet Pick
147 * To initialize the tablet:
190 #define AIPTEK_TILT_MIN (-128)
192 #define AIPTEK_TILT_DISABLE (-10101)
198 #define AIPTEK_WHEEL_DISABLE (-10101)
226 /* Time to wait (in ms) in-between sending the tablet
228 * sequence from the tablet.
249 /* Length of incoming packet from the tablet
254 * whether the report came from the stylus, tablet mouse
255 * or "unknown" -- Unknown when the tablet is in relative
256 * mode, because we only get report 1's.
266 int odmCode; /* Tablet manufacturer code */
267 int modelCode; /* Tablet model code (not unique) */
273 int pointerMode; /* stylus-, mouse-only or either */
284 int programmableDelay; /* delay for tablet programming */
293 struct aiptek_features features; /* tablet's array of features */
294 struct aiptek_settings curSetting; /* tablet's current programmable */
297 int diagnostic; /* tablet diagnostic codes */
330 * the bitmap which comes from the tablet. This hides the
346 #define AIPTEK_INVALID_VALUE -1
357 if (str[count - 1] == '\n') in map_str_to_val()
358 count--; in map_str_to_val()
360 for (p = map; p->string; p++) in map_str_to_val()
361 if (!strncmp(str, p->string, count)) in map_str_to_val()
362 return p->value; in map_str_to_val()
371 for (p = map; p->value != AIPTEK_INVALID_VALUE; p++) in map_val_to_str()
372 if (val == p->value) in map_val_to_str()
373 return p->string; in map_val_to_str()
382 * The tablet reports on several attributes per invocation of
386 * a complete tablet report. Further, the number of Input Event reports
388 * To deal with this, EV_MSC is used to indicate an 'end-of-report'
390 * tablet driver and clients such as gpm and XFree86's tablet drivers.
392 * Of the information received from the tablet, the one piece I
397 * Proximity event occurred while the tablet was in absolute or relative
398 * mode.
401 * can be set and re-set. Thus, only using ABS_MISC from now on.
414 struct aiptek *aiptek = urb->context; in aiptek_irq()
415 unsigned char *data = aiptek->data; in aiptek_irq()
416 struct input_dev *inputdev = aiptek->inputdev; in aiptek_irq()
417 struct usb_interface *intf = aiptek->intf; in aiptek_irq()
421 switch (urb->status) { in aiptek_irq()
426 case -ECONNRESET: in aiptek_irq()
427 case -ENOENT: in aiptek_irq()
428 case -ESHUTDOWN: in aiptek_irq()
430 dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", in aiptek_irq()
431 __func__, urb->status); in aiptek_irq()
435 dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", in aiptek_irq()
436 __func__, urb->status); in aiptek_irq()
440 /* See if we are in a delay loop -- throw out report if true. in aiptek_irq()
442 if (aiptek->inDelay == 1 && time_after(aiptek->endDelay, jiffies)) { in aiptek_irq()
446 aiptek->inDelay = 0; in aiptek_irq()
447 aiptek->eventCount++; in aiptek_irq()
454 if (aiptek->curSetting.coordinateMode == in aiptek_irq()
456 aiptek->diagnostic = in aiptek_irq()
464 * to pseudo-settings. (We don't specifically care about it's in aiptek_irq()
466 * that a non-zero value indicates that one or more in aiptek_irq()
471 left = (data[1] & aiptek->curSetting.mouseButtonLeft >> 2) != 0 ? 1 : 0; in aiptek_irq()
472 right = (data[1] & aiptek->curSetting.mouseButtonRight >> 2) != 0 ? 1 : 0; in aiptek_irq()
473 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle >> 2) != 0 ? 1 : 0; in aiptek_irq()
484 /* Wheel support is in the form of a single-event in aiptek_irq()
487 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) { in aiptek_irq()
489 aiptek->curSetting.wheel); in aiptek_irq()
490 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; in aiptek_irq()
492 if (aiptek->lastMacro != -1) { in aiptek_irq()
494 macroKeyEvents[aiptek->lastMacro], 0); in aiptek_irq()
495 aiptek->lastMacro = -1; in aiptek_irq()
504 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) { in aiptek_irq()
505 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE; in aiptek_irq()
507 (aiptek->curSetting.pointerMode)) { in aiptek_irq()
508 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; in aiptek_irq()
518 /* Use jitterable to re-arrange button masks in aiptek_irq()
522 bs = (data[5] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0; in aiptek_irq()
523 pck = (data[5] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0; in aiptek_irq()
525 /* dv indicates 'data valid' (e.g., the tablet is in sync in aiptek_irq()
533 if (aiptek->previousToolMode != in aiptek_irq()
534 aiptek->curSetting.toolMode) { in aiptek_irq()
536 aiptek->previousToolMode, 0); in aiptek_irq()
538 aiptek->curSetting.toolMode, in aiptek_irq()
540 aiptek->previousToolMode = in aiptek_irq()
541 aiptek->curSetting.toolMode; in aiptek_irq()
553 if (aiptek->curSetting.xTilt != in aiptek_irq()
557 aiptek->curSetting.xTilt); in aiptek_irq()
559 if (aiptek->curSetting.yTilt != AIPTEK_TILT_DISABLE) { in aiptek_irq()
562 aiptek->curSetting.yTilt); in aiptek_irq()
565 /* Wheel support is in the form of a single-event in aiptek_irq()
568 if (aiptek->curSetting.wheel != in aiptek_irq()
572 aiptek->curSetting.wheel); in aiptek_irq()
573 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; in aiptek_irq()
577 if (aiptek->lastMacro != -1) { in aiptek_irq()
579 macroKeyEvents[aiptek->lastMacro], 0); in aiptek_irq()
580 aiptek->lastMacro = -1; in aiptek_irq()
586 /* Report 3's come from the mouse in absolute mode. in aiptek_irq()
589 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) { in aiptek_irq()
590 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE; in aiptek_irq()
592 (aiptek->curSetting.pointerMode)) { in aiptek_irq()
593 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; in aiptek_irq()
602 left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0; in aiptek_irq()
603 right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0; in aiptek_irq()
604 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0; in aiptek_irq()
610 if (aiptek->previousToolMode != in aiptek_irq()
611 aiptek->curSetting.toolMode) { in aiptek_irq()
613 aiptek->previousToolMode, 0); in aiptek_irq()
615 aiptek->curSetting.toolMode, in aiptek_irq()
617 aiptek->previousToolMode = in aiptek_irq()
618 aiptek->curSetting.toolMode; in aiptek_irq()
629 /* Wheel support is in the form of a single-event in aiptek_irq()
632 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) { in aiptek_irq()
635 aiptek->curSetting.wheel); in aiptek_irq()
636 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; in aiptek_irq()
640 if (aiptek->lastMacro != -1) { in aiptek_irq()
642 macroKeyEvents[aiptek->lastMacro], 0); in aiptek_irq()
643 aiptek->lastMacro = -1; in aiptek_irq()
657 bs = (data[1] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0; in aiptek_irq()
658 pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0; in aiptek_irq()
660 macro = dv && p && tip && !(data[3] & 1) ? (data[3] >> 1) : -1; in aiptek_irq()
667 if (aiptek->previousToolMode != in aiptek_irq()
668 aiptek->curSetting.toolMode) { in aiptek_irq()
670 aiptek->previousToolMode, 0); in aiptek_irq()
672 aiptek->curSetting.toolMode, in aiptek_irq()
674 aiptek->previousToolMode = in aiptek_irq()
675 aiptek->curSetting.toolMode; in aiptek_irq()
679 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) { in aiptek_irq()
680 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0); in aiptek_irq()
681 aiptek->lastMacro = -1; in aiptek_irq()
684 if (macro != -1 && macro != aiptek->lastMacro) { in aiptek_irq()
686 aiptek->lastMacro = macro; in aiptek_irq()
699 left = (data[1]& aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0; in aiptek_irq()
700 right = (data[1] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0; in aiptek_irq()
701 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0; in aiptek_irq()
708 if (aiptek->previousToolMode != in aiptek_irq()
709 aiptek->curSetting.toolMode) { in aiptek_irq()
711 aiptek->previousToolMode, 0); in aiptek_irq()
713 aiptek->curSetting.toolMode, 1); in aiptek_irq()
714 aiptek->previousToolMode = aiptek->curSetting.toolMode; in aiptek_irq()
718 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) { in aiptek_irq()
719 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0); in aiptek_irq()
720 aiptek->lastMacro = -1; in aiptek_irq()
723 if (macro != -1 && macro != aiptek->lastMacro) { in aiptek_irq()
725 aiptek->lastMacro = macro; in aiptek_irq()
734 * However, report 6 is the 'official-looking' report for macroKeys; in aiptek_irq()
741 input_report_key(inputdev, macroKeyEvents[macro - 1], in aiptek_irq()
752 if (aiptek->previousToolMode != in aiptek_irq()
753 aiptek->curSetting.toolMode) { in aiptek_irq()
755 aiptek->previousToolMode, 0); in aiptek_irq()
757 aiptek->curSetting.toolMode, in aiptek_irq()
759 aiptek->previousToolMode = in aiptek_irq()
760 aiptek->curSetting.toolMode; in aiptek_irq()
768 dev_dbg(&intf->dev, "Unknown report %d\n", data[0]); in aiptek_irq()
776 * We just introduced aiptek->previousJitterable to carry forth the in aiptek_irq()
783 if (aiptek->previousJitterable != jitterable && in aiptek_irq()
784 aiptek->curSetting.jitterDelay != 0 && aiptek->inDelay != 1) { in aiptek_irq()
785 aiptek->endDelay = jiffies + in aiptek_irq()
786 ((aiptek->curSetting.jitterDelay * HZ) / 1000); in aiptek_irq()
787 aiptek->inDelay = 1; in aiptek_irq()
789 aiptek->previousJitterable = jitterable; in aiptek_irq()
794 dev_err(&intf->dev, in aiptek_irq()
795 "%s - usb_submit_urb failed with result %d\n", in aiptek_irq()
806 * IDs to not be model-specific nor unique.
823 * Open an instance of the tablet driver.
829 aiptek->urb->dev = interface_to_usbdev(aiptek->intf); in aiptek_open()
830 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) in aiptek_open()
831 return -EIO; in aiptek_open()
837 * Close an instance of the tablet driver.
843 usb_kill_urb(aiptek->urb); in aiptek_close()
855 struct usb_device *udev = interface_to_usbdev(aiptek->intf); in aiptek_set_report()
862 aiptek->ifnum, buffer, size, 5000); in aiptek_set_report()
870 struct usb_device *udev = interface_to_usbdev(aiptek->intf); in aiptek_get_report()
877 aiptek->ifnum, buffer, size, 5000); in aiptek_get_report()
881 * Send a command to the tablet.
892 return -ENOMEM; in aiptek_command()
900 dev_dbg(&aiptek->intf->dev, in aiptek_command()
909 * Retrieve information from the tablet. Querying info is defined as first
922 return -ENOMEM; in aiptek_query()
930 return -EIO; in aiptek_query()
932 msleep(aiptek->curSetting.programmableDelay); in aiptek_query()
935 dev_dbg(&aiptek->intf->dev, in aiptek_query()
938 ret = -EIO; in aiptek_query()
947 * Program the tablet into either absolute or relative mode.
948 * We also get information about the tablet's size.
960 aiptek->features.modelCode = ret & 0xff; in aiptek_program_tablet()
965 aiptek->features.odmCode = ret; in aiptek_program_tablet()
970 aiptek->features.firmwareCode = ret; in aiptek_program_tablet()
975 input_set_abs_params(aiptek->inputdev, ABS_X, 0, ret - 1, 0, 0); in aiptek_program_tablet()
980 input_set_abs_params(aiptek->inputdev, ABS_Y, 0, ret - 1, 0, 0); in aiptek_program_tablet()
985 input_set_abs_params(aiptek->inputdev, ABS_PRESSURE, 0, ret - 1, 0, 0); in aiptek_program_tablet()
987 /* Depending on whether we are in absolute or relative mode, we will in aiptek_program_tablet()
990 if (aiptek->curSetting.coordinateMode == in aiptek_program_tablet()
1018 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_NA; in aiptek_program_tablet()
1019 aiptek->eventCount = 0; in aiptek_program_tablet()
1025 * Sysfs functions. Sysfs prefers that individually-tunable parameters
1026 * exist in their separate pseudo-files. Summary data that is immutable
1032 * support the 'size' file -- display support
1039 input_abs_get_max(aiptek->inputdev, ABS_X) + 1, in show_tabletSize()
1040 input_abs_get_max(aiptek->inputdev, ABS_Y) + 1); in show_tabletSize()
1046 * permitted -- it only means can't either 'cat' the file, or send data
1067 aiptek->curSetting.pointerMode)); in show_tabletPointerMode()
1077 return -EINVAL; in store_tabletPointerMode()
1079 aiptek->newSetting.pointerMode = new_mode; in store_tabletPointerMode()
1103 aiptek->curSetting.coordinateMode)); in show_tabletCoordinateMode()
1113 return -EINVAL; in store_tabletCoordinateMode()
1115 aiptek->newSetting.coordinateMode = new_mode; in store_tabletCoordinateMode()
1144 aiptek->curSetting.toolMode)); in show_tabletToolMode()
1154 return -EINVAL; in store_tabletToolMode()
1156 aiptek->newSetting.toolMode = new_mode; in store_tabletToolMode()
1172 if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) { in show_tabletXtilt()
1175 return sysfs_emit(buf, "%d\n", aiptek->curSetting.xTilt); in show_tabletXtilt()
1186 size_t len = buf[count - 1] == '\n' ? count - 1 : count; in store_tabletXtilt()
1189 return -EINVAL; in store_tabletXtilt()
1191 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE; in store_tabletXtilt()
1194 return -EINVAL; in store_tabletXtilt()
1196 aiptek->newSetting.xTilt = x; in store_tabletXtilt()
1213 if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) { in show_tabletYtilt()
1216 return sysfs_emit(buf, "%d\n", aiptek->curSetting.yTilt); in show_tabletYtilt()
1227 size_t len = buf[count - 1] == '\n' ? count - 1 : count; in store_tabletYtilt()
1230 return -EINVAL; in store_tabletYtilt()
1232 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE; in store_tabletYtilt()
1235 return -EINVAL; in store_tabletYtilt()
1237 aiptek->newSetting.yTilt = y; in store_tabletYtilt()
1254 return sysfs_emit(buf, "%d\n", aiptek->curSetting.jitterDelay); in show_tabletJitterDelay()
1267 aiptek->newSetting.jitterDelay = j; in store_tabletJitterDelay()
1283 return sysfs_emit(buf, "%d\n", aiptek->curSetting.programmableDelay); in show_tabletProgrammableDelay()
1296 aiptek->newSetting.programmableDelay = d; in store_tabletProgrammableDelay()
1312 return sysfs_emit(buf, "%ld\n", aiptek->eventCount); in show_tabletEventsReceived()
1326 switch (aiptek->diagnostic) { in show_tabletDiagnosticMessage()
1340 if (aiptek->curSetting.pointerMode == in show_tabletDiagnosticMessage()
1372 aiptek->curSetting.stylusButtonUpper)); in show_tabletStylusUpper()
1382 return -EINVAL; in store_tabletStylusUpper()
1384 aiptek->newSetting.stylusButtonUpper = new_button; in store_tabletStylusUpper()
1402 aiptek->curSetting.stylusButtonLower)); in show_tabletStylusLower()
1412 return -EINVAL; in store_tabletStylusLower()
1414 aiptek->newSetting.stylusButtonLower = new_button; in store_tabletStylusLower()
1439 aiptek->curSetting.mouseButtonLeft)); in show_tabletMouseLeft()
1449 return -EINVAL; in store_tabletMouseLeft()
1451 aiptek->newSetting.mouseButtonLeft = new_button; in store_tabletMouseLeft()
1468 aiptek->curSetting.mouseButtonMiddle)); in show_tabletMouseMiddle()
1478 return -EINVAL; in store_tabletMouseMiddle()
1480 aiptek->newSetting.mouseButtonMiddle = new_button; in store_tabletMouseMiddle()
1497 aiptek->curSetting.mouseButtonRight)); in show_tabletMouseRight()
1507 return -EINVAL; in store_tabletMouseRight()
1509 aiptek->newSetting.mouseButtonRight = new_button; in store_tabletMouseRight()
1525 if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) { in show_tabletWheel()
1528 return sysfs_emit(buf, "%d\n", aiptek->curSetting.wheel); in show_tabletWheel()
1542 aiptek->newSetting.wheel = w; in store_tabletWheel()
1555 /* There is nothing useful to display, so a one-line manual in show_tabletExecute()
1558 return sysfs_emit(buf, "Write anything to this file to program your tablet.\n"); in show_tabletExecute()
1567 * of writing to this file triggers a tablet reprogramming. in store_tabletExecute()
1569 memcpy(&aiptek->curSetting, &aiptek->newSetting, in store_tabletExecute()
1573 return -EIO; in store_tabletExecute()
1589 return sysfs_emit(buf, "0x%04x\n", aiptek->features.odmCode); in show_tabletODMCode()
1602 return sysfs_emit(buf, "0x%04x\n", aiptek->features.modelCode); in show_tabletModelCode()
1615 return sysfs_emit(buf, "%04x\n", aiptek->features.firmwareCode); in show_firmwareCode()
1647 * This routine is called when a tablet has been identified. It basically
1648 * sets up the tablet and the driver's internal structures.
1666 int err = -ENOMEM; in aiptek_probe()
1668 /* programmableDelay is where the command-line specified in aiptek_probe()
1679 dev_warn(&intf->dev, in aiptek_probe()
1684 aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH, in aiptek_probe()
1685 GFP_KERNEL, &aiptek->data_dma); in aiptek_probe()
1686 if (!aiptek->data) { in aiptek_probe()
1687 dev_warn(&intf->dev, "cannot allocate usb buffer\n"); in aiptek_probe()
1691 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); in aiptek_probe()
1692 if (!aiptek->urb) { in aiptek_probe()
1693 dev_warn(&intf->dev, "cannot allocate urb\n"); in aiptek_probe()
1697 aiptek->inputdev = inputdev; in aiptek_probe()
1698 aiptek->intf = intf; in aiptek_probe()
1699 aiptek->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; in aiptek_probe()
1700 aiptek->inDelay = 0; in aiptek_probe()
1701 aiptek->endDelay = 0; in aiptek_probe()
1702 aiptek->previousJitterable = 0; in aiptek_probe()
1703 aiptek->lastMacro = -1; in aiptek_probe()
1711 aiptek->curSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE; in aiptek_probe()
1712 aiptek->curSetting.coordinateMode = AIPTEK_COORDINATE_ABSOLUTE_MODE; in aiptek_probe()
1713 aiptek->curSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE; in aiptek_probe()
1714 aiptek->curSetting.xTilt = AIPTEK_TILT_DISABLE; in aiptek_probe()
1715 aiptek->curSetting.yTilt = AIPTEK_TILT_DISABLE; in aiptek_probe()
1716 aiptek->curSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON; in aiptek_probe()
1717 aiptek->curSetting.mouseButtonMiddle = AIPTEK_MOUSE_MIDDLE_BUTTON; in aiptek_probe()
1718 aiptek->curSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON; in aiptek_probe()
1719 aiptek->curSetting.stylusButtonUpper = AIPTEK_STYLUS_UPPER_BUTTON; in aiptek_probe()
1720 aiptek->curSetting.stylusButtonLower = AIPTEK_STYLUS_LOWER_BUTTON; in aiptek_probe()
1721 aiptek->curSetting.jitterDelay = jitterDelay; in aiptek_probe()
1722 aiptek->curSetting.programmableDelay = programmableDelay; in aiptek_probe()
1726 aiptek->newSetting = aiptek->curSetting; in aiptek_probe()
1732 * & a tablet, and the inputX number actually will tell in aiptek_probe()
1735 usb_make_path(usbdev, aiptek->features.usbPath, in aiptek_probe()
1736 sizeof(aiptek->features.usbPath)); in aiptek_probe()
1737 strlcat(aiptek->features.usbPath, "/input0", in aiptek_probe()
1738 sizeof(aiptek->features.usbPath)); in aiptek_probe()
1743 inputdev->name = "Aiptek"; in aiptek_probe()
1744 inputdev->phys = aiptek->features.usbPath; in aiptek_probe()
1745 usb_to_input_id(usbdev, &inputdev->id); in aiptek_probe()
1746 inputdev->dev.parent = &intf->dev; in aiptek_probe()
1750 inputdev->open = aiptek_open; in aiptek_probe()
1751 inputdev->close = aiptek_close; in aiptek_probe()
1753 /* Now program the capacities of the tablet, in terms of being in aiptek_probe()
1757 __set_bit(eventTypes[i], inputdev->evbit); in aiptek_probe()
1760 __set_bit(absEvents[i], inputdev->absbit); in aiptek_probe()
1763 __set_bit(relEvents[i], inputdev->relbit); in aiptek_probe()
1765 __set_bit(MSC_SERIAL, inputdev->mscbit); in aiptek_probe()
1769 __set_bit(buttonEvents[i], inputdev->keybit); in aiptek_probe()
1772 __set_bit(macroKeyEvents[i], inputdev->keybit); in aiptek_probe()
1777 * values in. Later, we'll ask the tablet to put in the correct in aiptek_probe()
1785 input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); in aiptek_probe()
1787 err = usb_find_common_endpoints(intf->cur_altsetting, in aiptek_probe()
1790 dev_err(&intf->dev, in aiptek_probe()
1795 /* Go set up our URB, which is called when the tablet receives in aiptek_probe()
1798 usb_fill_int_urb(aiptek->urb, in aiptek_probe()
1801 endpoint->bEndpointAddress), in aiptek_probe()
1802 aiptek->data, 8, aiptek_irq, aiptek, in aiptek_probe()
1803 endpoint->bInterval); in aiptek_probe()
1805 aiptek->urb->transfer_dma = aiptek->data_dma; in aiptek_probe()
1806 aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in aiptek_probe()
1808 /* Program the tablet. This sets the tablet up in the mode in aiptek_probe()
1809 * specified in newSetting, and also queries the tablet's in aiptek_probe()
1812 * Sanity check: if a tablet doesn't like the slow programmatic in aiptek_probe()
1815 * have to explain to us how your tablet thinks it's 0x0, and yet that's in aiptek_probe()
1816 * not an error :-) in aiptek_probe()
1820 aiptek->curSetting.programmableDelay = speeds[i]; in aiptek_probe()
1822 if (input_abs_get_max(aiptek->inputdev, ABS_X) > 0) { in aiptek_probe()
1823 dev_info(&intf->dev, in aiptek_probe()
1825 aiptek->curSetting.programmableDelay); in aiptek_probe()
1830 /* Murphy says that some day someone will have a tablet that fails the in aiptek_probe()
1833 dev_info(&intf->dev, in aiptek_probe()
1835 err = -EINVAL; in aiptek_probe()
1843 /* Register the tablet as an Input Device in aiptek_probe()
1845 err = input_register_device(aiptek->inputdev); in aiptek_probe()
1847 dev_warn(&intf->dev, in aiptek_probe()
1853 fail3: usb_free_urb(aiptek->urb); in aiptek_probe()
1854 fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, in aiptek_probe()
1855 aiptek->data_dma); in aiptek_probe()
1863 * Deal with tablet disconnecting from the system.
1875 usb_kill_urb(aiptek->urb); in aiptek_disconnect()
1876 input_unregister_device(aiptek->inputdev); in aiptek_disconnect()
1877 usb_free_urb(aiptek->urb); in aiptek_disconnect()
1880 aiptek->data, aiptek->data_dma); in aiptek_disconnect()
1896 MODULE_DESCRIPTION("Aiptek HyperPen USB Tablet Driver");
1900 MODULE_PARM_DESC(programmableDelay, "delay used during tablet programming");