H A D | aiptek.c | 308 struct aiptek { struct 435 struct aiptek *aiptek = urb->context; aiptek_irq() local 436 unsigned char *data = aiptek->data; aiptek_irq() 437 struct input_dev *inputdev = aiptek->inputdev; aiptek_irq() 438 struct usb_interface *intf = aiptek->intf; aiptek_irq() 463 if (aiptek->inDelay == 1 && time_after(aiptek->endDelay, jiffies)) { aiptek_irq() 467 aiptek->inDelay = 0; aiptek_irq() 468 aiptek->eventCount++; aiptek_irq() 475 if (aiptek->curSetting.coordinateMode == aiptek_irq() 477 aiptek->diagnostic = aiptek_irq() 492 left = (data[1] & aiptek->curSetting.mouseButtonLeft >> 2) != 0 ? 1 : 0; aiptek_irq() 493 right = (data[1] & aiptek->curSetting.mouseButtonRight >> 2) != 0 ? 1 : 0; aiptek_irq() 494 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle >> 2) != 0 ? 1 : 0; aiptek_irq() 508 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) { aiptek_irq() 510 aiptek->curSetting.wheel); aiptek_irq() 511 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; aiptek_irq() 513 if (aiptek->lastMacro != -1) { aiptek_irq() 515 macroKeyEvents[aiptek->lastMacro], 0); aiptek_irq() 516 aiptek->lastMacro = -1; aiptek_irq() 525 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) { aiptek_irq() 526 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE; aiptek_irq() 528 (aiptek->curSetting.pointerMode)) { aiptek_irq() 529 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; aiptek_irq() 543 bs = (data[5] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0; aiptek_irq() 544 pck = (data[5] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0; aiptek_irq() 554 if (aiptek->previousToolMode != aiptek_irq() 555 aiptek->curSetting.toolMode) { aiptek_irq() 557 aiptek->previousToolMode, 0); aiptek_irq() 559 aiptek->curSetting.toolMode, aiptek_irq() 561 aiptek->previousToolMode = aiptek_irq() 562 aiptek->curSetting.toolMode; aiptek_irq() 574 if (aiptek->curSetting.xTilt != aiptek_irq() 578 aiptek->curSetting.xTilt); aiptek_irq() 580 if (aiptek->curSetting.yTilt != AIPTEK_TILT_DISABLE) { aiptek_irq() 583 aiptek->curSetting.yTilt); aiptek_irq() 589 if (aiptek->curSetting.wheel != aiptek_irq() 593 aiptek->curSetting.wheel); aiptek_irq() 594 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; aiptek_irq() 598 if (aiptek->lastMacro != -1) { aiptek_irq() 600 macroKeyEvents[aiptek->lastMacro], 0); aiptek_irq() 601 aiptek->lastMacro = -1; aiptek_irq() 610 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) { aiptek_irq() 611 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE; aiptek_irq() 613 (aiptek->curSetting.pointerMode)) { aiptek_irq() 614 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED; aiptek_irq() 623 left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0; aiptek_irq() 624 right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0; aiptek_irq() 625 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0; aiptek_irq() 631 if (aiptek->previousToolMode != aiptek_irq() 632 aiptek->curSetting.toolMode) { aiptek_irq() 634 aiptek->previousToolMode, 0); aiptek_irq() 636 aiptek->curSetting.toolMode, aiptek_irq() 638 aiptek->previousToolMode = aiptek_irq() 639 aiptek->curSetting.toolMode; aiptek_irq() 653 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) { aiptek_irq() 656 aiptek->curSetting.wheel); aiptek_irq() 657 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE; aiptek_irq() 661 if (aiptek->lastMacro != -1) { aiptek_irq() 663 macroKeyEvents[aiptek->lastMacro], 0); aiptek_irq() 664 aiptek->lastMacro = -1; aiptek_irq() 678 bs = (data[1] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0; aiptek_irq() 679 pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0; aiptek_irq() 688 if (aiptek->previousToolMode != aiptek_irq() 689 aiptek->curSetting.toolMode) { aiptek_irq() 691 aiptek->previousToolMode, 0); aiptek_irq() 693 aiptek->curSetting.toolMode, aiptek_irq() 695 aiptek->previousToolMode = aiptek_irq() 696 aiptek->curSetting.toolMode; aiptek_irq() 700 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) { aiptek_irq() 701 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0); aiptek_irq() 702 aiptek->lastMacro = -1; aiptek_irq() 705 if (macro != -1 && macro != aiptek->lastMacro) { aiptek_irq() 707 aiptek->lastMacro = macro; aiptek_irq() 720 left = (data[1]& aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0; aiptek_irq() 721 right = (data[1] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0; aiptek_irq() 722 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0; aiptek_irq() 729 if (aiptek->previousToolMode != aiptek_irq() 730 aiptek->curSetting.toolMode) { aiptek_irq() 732 aiptek->previousToolMode, 0); aiptek_irq() 734 aiptek->curSetting.toolMode, 1); aiptek_irq() 735 aiptek->previousToolMode = aiptek->curSetting.toolMode; aiptek_irq() 739 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) { aiptek_irq() 740 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0); aiptek_irq() 741 aiptek->lastMacro = -1; aiptek_irq() 744 if (macro != -1 && macro != aiptek->lastMacro) { aiptek_irq() 746 aiptek->lastMacro = macro; aiptek_irq() 773 if (aiptek->previousToolMode != aiptek_irq() 774 aiptek->curSetting.toolMode) { aiptek_irq() 776 aiptek->previousToolMode, 0); aiptek_irq() 778 aiptek->curSetting.toolMode, aiptek_irq() 780 aiptek->previousToolMode = aiptek_irq() 781 aiptek->curSetting.toolMode; aiptek_irq() 797 * We just introduced aiptek->previousJitterable to carry forth the aiptek_irq() 804 if (aiptek->previousJitterable != jitterable && aiptek_irq() 805 aiptek->curSetting.jitterDelay != 0 && aiptek->inDelay != 1) { aiptek_irq() 806 aiptek->endDelay = jiffies + aiptek_irq() 807 ((aiptek->curSetting.jitterDelay * HZ) / 1000); aiptek_irq() 808 aiptek->inDelay = 1; aiptek_irq() 810 aiptek->previousJitterable = jitterable; aiptek_irq() 848 struct aiptek *aiptek = input_get_drvdata(inputdev); aiptek_open() local 850 aiptek->urb->dev = aiptek->usbdev; aiptek_open() 851 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) aiptek_open() 862 struct aiptek *aiptek = input_get_drvdata(inputdev); aiptek_close() local 864 usb_kill_urb(aiptek->urb); aiptek_close() 872 aiptek_set_report(struct aiptek *aiptek, aiptek_set_report() argument 876 return usb_control_msg(aiptek->usbdev, aiptek_set_report() 877 usb_sndctrlpipe(aiptek->usbdev, 0), aiptek_set_report() 881 aiptek->ifnum, buffer, size, 5000); aiptek_set_report() 885 aiptek_get_report(struct aiptek *aiptek, aiptek_get_report() argument 889 return usb_control_msg(aiptek->usbdev, aiptek_get_report() 890 usb_rcvctrlpipe(aiptek->usbdev, 0), aiptek_get_report() 894 aiptek->ifnum, buffer, size, 5000); aiptek_get_report() 901 aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data) aiptek_command() argument 916 aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { aiptek_command() 917 dev_dbg(&aiptek->intf->dev, aiptek_command() 931 aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) aiptek_query() argument 945 if (aiptek_command(aiptek, command, data) != 0) { aiptek_query() 949 msleep(aiptek->curSetting.programmableDelay); aiptek_query() 952 aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { aiptek_query() 953 dev_dbg(&aiptek->intf->dev, aiptek_query() 968 static int aiptek_program_tablet(struct aiptek *aiptek) aiptek_program_tablet() argument 972 if ((ret = aiptek_command(aiptek, 0x18, 0x04)) < 0) aiptek_program_tablet() 976 if ((ret = aiptek_query(aiptek, 0x02, 0x00)) < 0) aiptek_program_tablet() 978 aiptek->features.modelCode = ret & 0xff; aiptek_program_tablet() 981 if ((ret = aiptek_query(aiptek, 0x03, 0x00)) < 0) aiptek_program_tablet() 983 aiptek->features.odmCode = ret; aiptek_program_tablet() 986 if ((ret = aiptek_query(aiptek, 0x04, 0x00)) < 0) aiptek_program_tablet() 988 aiptek->features.firmwareCode = ret; aiptek_program_tablet() 991 if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0) aiptek_program_tablet() 993 input_set_abs_params(aiptek->inputdev, ABS_X, 0, ret - 1, 0, 0); aiptek_program_tablet() 996 if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0) aiptek_program_tablet() 998 input_set_abs_params(aiptek->inputdev, ABS_Y, 0, ret - 1, 0, 0); aiptek_program_tablet() 1001 if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0) aiptek_program_tablet() 1003 input_set_abs_params(aiptek->inputdev, ABS_PRESSURE, 0, ret - 1, 0, 0); aiptek_program_tablet() 1008 if (aiptek->curSetting.coordinateMode == aiptek_program_tablet() 1011 if ((ret = aiptek_command(aiptek, 0x10, 0x01)) < 0) { aiptek_program_tablet() 1016 if ((ret = aiptek_command(aiptek, 0x10, 0x00)) < 0) { aiptek_program_tablet() 1022 if ((ret = aiptek_command(aiptek, 0x11, 0x02)) < 0) aiptek_program_tablet() 1026 if ((ret = aiptek_command(aiptek, 0x17, 0x00)) < 0) aiptek_program_tablet() 1031 if ((ret = aiptek_command(aiptek, 0x12, 0xff)) < 0) aiptek_program_tablet() 1036 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_NA; aiptek_program_tablet() 1037 aiptek->eventCount = 0; aiptek_program_tablet() 1054 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletSize() local 1057 input_abs_get_max(aiptek->inputdev, ABS_X) + 1, show_tabletSize() 1058 input_abs_get_max(aiptek->inputdev, ABS_Y) + 1); show_tabletSize() 1082 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletPointerMode() local 1086 aiptek->curSetting.pointerMode)); show_tabletPointerMode() 1092 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletPointerMode() local 1098 aiptek->newSetting.pointerMode = new_mode; store_tabletPointerMode() 1119 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletCoordinateMode() local 1123 aiptek->curSetting.coordinateMode)); show_tabletCoordinateMode() 1129 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletCoordinateMode() local 1135 aiptek->newSetting.coordinateMode = new_mode; store_tabletCoordinateMode() 1161 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletToolMode() local 1165 aiptek->curSetting.toolMode)); show_tabletToolMode() 1171 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletToolMode() local 1177 aiptek->newSetting.toolMode = new_mode; store_tabletToolMode() 1191 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletXtilt() local 1193 if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) { show_tabletXtilt() 1197 aiptek->curSetting.xTilt); show_tabletXtilt() 1204 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletXtilt() local 1213 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE; store_tabletXtilt() 1218 aiptek->newSetting.xTilt = x; store_tabletXtilt() 1233 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletYtilt() local 1235 if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) { show_tabletYtilt() 1239 aiptek->curSetting.yTilt); show_tabletYtilt() 1246 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletYtilt() local 1255 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE; store_tabletYtilt() 1260 aiptek->newSetting.yTilt = y; store_tabletYtilt() 1275 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletJitterDelay() local 1277 return snprintf(buf, PAGE_SIZE, "%d\n", aiptek->curSetting.jitterDelay); show_tabletJitterDelay() 1283 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletJitterDelay() local 1290 aiptek->newSetting.jitterDelay = j; store_tabletJitterDelay() 1304 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletProgrammableDelay() local 1307 aiptek->curSetting.programmableDelay); show_tabletProgrammableDelay() 1313 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletProgrammableDelay() local 1320 aiptek->newSetting.programmableDelay = d; store_tabletProgrammableDelay() 1334 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletEventsReceived() local 1336 return snprintf(buf, PAGE_SIZE, "%ld\n", aiptek->eventCount); show_tabletEventsReceived() 1347 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletDiagnosticMessage() local 1350 switch (aiptek->diagnostic) { show_tabletDiagnosticMessage() 1364 if (aiptek->curSetting.pointerMode == show_tabletDiagnosticMessage() 1393 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletStylusUpper() local 1397 aiptek->curSetting.stylusButtonUpper)); show_tabletStylusUpper() 1403 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletStylusUpper() local 1409 aiptek->newSetting.stylusButtonUpper = new_button; store_tabletStylusUpper() 1424 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletStylusLower() local 1428 aiptek->curSetting.stylusButtonLower)); show_tabletStylusLower() 1434 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletStylusLower() local 1440 aiptek->newSetting.stylusButtonLower = new_button; store_tabletStylusLower() 1462 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletMouseLeft() local 1466 aiptek->curSetting.mouseButtonLeft)); show_tabletMouseLeft() 1472 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletMouseLeft() local 1478 aiptek->newSetting.mouseButtonLeft = new_button; store_tabletMouseLeft() 1492 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletMouseMiddle() local 1496 aiptek->curSetting.mouseButtonMiddle)); show_tabletMouseMiddle() 1502 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletMouseMiddle() local 1508 aiptek->newSetting.mouseButtonMiddle = new_button; store_tabletMouseMiddle() 1522 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletMouseRight() local 1526 aiptek->curSetting.mouseButtonRight)); show_tabletMouseRight() 1532 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletMouseRight() local 1538 aiptek->newSetting.mouseButtonRight = new_button; store_tabletMouseRight() 1552 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletWheel() local 1554 if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) { show_tabletWheel() 1558 aiptek->curSetting.wheel); show_tabletWheel() 1565 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletWheel() local 1572 aiptek->newSetting.wheel = w; store_tabletWheel() 1595 struct aiptek *aiptek = dev_get_drvdata(dev); store_tabletExecute() local 1600 memcpy(&aiptek->curSetting, &aiptek->newSetting, store_tabletExecute() 1603 if (aiptek_program_tablet(aiptek) < 0) store_tabletExecute() 1618 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletODMCode() local 1620 return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.odmCode); show_tabletODMCode() 1631 struct aiptek *aiptek = dev_get_drvdata(dev); show_tabletModelCode() local 1633 return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.modelCode); show_tabletModelCode() 1644 struct aiptek *aiptek = dev_get_drvdata(dev); show_firmwareCode() local 1647 aiptek->features.firmwareCode); show_firmwareCode() 1689 struct aiptek *aiptek; aiptek_probe() local 1710 aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL); aiptek_probe() 1712 if (!aiptek || !inputdev) { aiptek_probe() 1718 aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek_probe() 1719 GFP_ATOMIC, &aiptek->data_dma); aiptek_probe() 1720 if (!aiptek->data) { aiptek_probe() 1725 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); aiptek_probe() 1726 if (!aiptek->urb) { aiptek_probe() 1731 aiptek->inputdev = inputdev; aiptek_probe() 1732 aiptek->usbdev = usbdev; aiptek_probe() 1733 aiptek->intf = intf; aiptek_probe() 1734 aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; aiptek_probe() 1735 aiptek->inDelay = 0; aiptek_probe() 1736 aiptek->endDelay = 0; aiptek_probe() 1737 aiptek->previousJitterable = 0; aiptek_probe() 1738 aiptek->lastMacro = -1; aiptek_probe() 1746 aiptek->curSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE; aiptek_probe() 1747 aiptek->curSetting.coordinateMode = AIPTEK_COORDINATE_ABSOLUTE_MODE; aiptek_probe() 1748 aiptek->curSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE; aiptek_probe() 1749 aiptek->curSetting.xTilt = AIPTEK_TILT_DISABLE; aiptek_probe() 1750 aiptek->curSetting.yTilt = AIPTEK_TILT_DISABLE; aiptek_probe() 1751 aiptek->curSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON; aiptek_probe() 1752 aiptek->curSetting.mouseButtonMiddle = AIPTEK_MOUSE_MIDDLE_BUTTON; aiptek_probe() 1753 aiptek->curSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON; aiptek_probe() 1754 aiptek->curSetting.stylusButtonUpper = AIPTEK_STYLUS_UPPER_BUTTON; aiptek_probe() 1755 aiptek->curSetting.stylusButtonLower = AIPTEK_STYLUS_LOWER_BUTTON; aiptek_probe() 1756 aiptek->curSetting.jitterDelay = jitterDelay; aiptek_probe() 1757 aiptek->curSetting.programmableDelay = programmableDelay; aiptek_probe() 1761 aiptek->newSetting = aiptek->curSetting; aiptek_probe() 1770 usb_make_path(usbdev, aiptek->features.usbPath, aiptek_probe() 1771 sizeof(aiptek->features.usbPath)); aiptek_probe() 1772 strlcat(aiptek->features.usbPath, "/input0", aiptek_probe() 1773 sizeof(aiptek->features.usbPath)); aiptek_probe() 1779 inputdev->phys = aiptek->features.usbPath; aiptek_probe() 1783 input_set_drvdata(inputdev, aiptek); aiptek_probe() 1835 usb_fill_int_urb(aiptek->urb, aiptek_probe() 1836 aiptek->usbdev, aiptek_probe() 1837 usb_rcvintpipe(aiptek->usbdev, aiptek_probe() 1839 aiptek->data, 8, aiptek_irq, aiptek, aiptek_probe() 1842 aiptek->urb->transfer_dma = aiptek->data_dma; aiptek_probe() 1843 aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; aiptek_probe() 1857 aiptek->curSetting.programmableDelay = speeds[i]; aiptek_probe() 1858 (void)aiptek_program_tablet(aiptek); aiptek_probe() 1859 if (input_abs_get_max(aiptek->inputdev, ABS_X) > 0) { aiptek_probe() 1862 aiptek->curSetting.programmableDelay); aiptek_probe() 1878 usb_set_intfdata(intf, aiptek); aiptek_probe() 1891 err = input_register_device(aiptek->inputdev); aiptek_probe() 1900 fail3: usb_free_urb(aiptek->urb); aiptek_probe() 1901 fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, aiptek_probe() 1902 aiptek->data_dma); aiptek_probe() 1905 kfree(aiptek); aiptek_probe() 1914 struct aiptek *aiptek = usb_get_intfdata(intf); aiptek_disconnect() local 1919 if (aiptek != NULL) { aiptek_disconnect() 1922 usb_kill_urb(aiptek->urb); aiptek_disconnect() 1923 input_unregister_device(aiptek->inputdev); aiptek_disconnect() 1925 usb_free_urb(aiptek->urb); aiptek_disconnect() 1928 aiptek->data, aiptek->data_dma); aiptek_disconnect() 1929 kfree(aiptek); aiptek_disconnect() 1934 .name = "aiptek",
|