Lines Matching refs:aiptek
310 struct aiptek {
436 struct aiptek *aiptek = urb->context;
437 unsigned char *data = aiptek->data;
438 struct input_dev *inputdev = aiptek->inputdev;
463 if (aiptek->inDelay == 1 && time_after(aiptek->endDelay, jiffies)) {
467 aiptek->inDelay = 0;
468 aiptek->eventCount++;
475 if (aiptek->curSetting.coordinateMode ==
477 aiptek->diagnostic =
492 left = (data[1] & aiptek->curSetting.mouseButtonLeft >> 2) != 0 ? 1 : 0;
493 right = (data[1] & aiptek->curSetting.mouseButtonRight >> 2) != 0 ? 1 : 0;
494 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle >> 2) != 0 ? 1 : 0;
508 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
510 aiptek->curSetting.wheel);
511 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
513 if (aiptek->lastMacro != -1) {
515 macroKeyEvents[aiptek->lastMacro], 0);
516 aiptek->lastMacro = -1;
525 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
526 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
528 (aiptek->curSetting.pointerMode)) {
529 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
543 bs = (data[5] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
544 pck = (data[5] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
554 if (aiptek->previousToolMode !=
555 aiptek->curSetting.toolMode) {
557 aiptek->previousToolMode, 0);
559 aiptek->curSetting.toolMode,
561 aiptek->previousToolMode =
562 aiptek->curSetting.toolMode;
574 if (aiptek->curSetting.xTilt !=
578 aiptek->curSetting.xTilt);
580 if (aiptek->curSetting.yTilt != AIPTEK_TILT_DISABLE) {
583 aiptek->curSetting.yTilt);
589 if (aiptek->curSetting.wheel !=
593 aiptek->curSetting.wheel);
594 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
598 if (aiptek->lastMacro != -1) {
600 macroKeyEvents[aiptek->lastMacro], 0);
601 aiptek->lastMacro = -1;
610 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
611 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
613 (aiptek->curSetting.pointerMode)) {
614 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
623 left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
624 right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
625 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
631 if (aiptek->previousToolMode !=
632 aiptek->curSetting.toolMode) {
634 aiptek->previousToolMode, 0);
636 aiptek->curSetting.toolMode,
638 aiptek->previousToolMode =
639 aiptek->curSetting.toolMode;
653 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
656 aiptek->curSetting.wheel);
657 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
661 if (aiptek->lastMacro != -1) {
663 macroKeyEvents[aiptek->lastMacro], 0);
664 aiptek->lastMacro = -1;
678 bs = (data[1] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
679 pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
688 if (aiptek->previousToolMode !=
689 aiptek->curSetting.toolMode) {
691 aiptek->previousToolMode, 0);
693 aiptek->curSetting.toolMode,
695 aiptek->previousToolMode =
696 aiptek->curSetting.toolMode;
700 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
701 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
702 aiptek->lastMacro = -1;
705 if (macro != -1 && macro != aiptek->lastMacro) {
707 aiptek->lastMacro = macro;
720 left = (data[1]& aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
721 right = (data[1] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
722 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
729 if (aiptek->previousToolMode !=
730 aiptek->curSetting.toolMode) {
732 aiptek->previousToolMode, 0);
734 aiptek->curSetting.toolMode, 1);
735 aiptek->previousToolMode = aiptek->curSetting.toolMode;
739 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
740 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
741 aiptek->lastMacro = -1;
744 if (macro != -1 && macro != aiptek->lastMacro) {
746 aiptek->lastMacro = macro;
773 if (aiptek->previousToolMode !=
774 aiptek->curSetting.toolMode) {
776 aiptek->previousToolMode, 0);
778 aiptek->curSetting.toolMode,
780 aiptek->previousToolMode =
781 aiptek->curSetting.toolMode;
797 * We just introduced aiptek->previousJitterable to carry forth the
804 if (aiptek->previousJitterable != jitterable &&
805 aiptek->curSetting.jitterDelay != 0 && aiptek->inDelay != 1) {
806 aiptek->endDelay = jiffies +
807 ((aiptek->curSetting.jitterDelay * HZ) / 1000);
808 aiptek->inDelay = 1;
810 aiptek->previousJitterable = jitterable;
847 struct aiptek *aiptek = input_get_drvdata(inputdev);
849 aiptek->urb->dev = aiptek->usbdev;
850 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
861 struct aiptek *aiptek = input_get_drvdata(inputdev);
863 usb_kill_urb(aiptek->urb);
871 aiptek_set_report(struct aiptek *aiptek,
875 return usb_control_msg(aiptek->usbdev,
876 usb_sndctrlpipe(aiptek->usbdev, 0),
880 aiptek->ifnum, buffer, size, 5000);
884 aiptek_get_report(struct aiptek *aiptek,
888 return usb_control_msg(aiptek->usbdev,
889 usb_rcvctrlpipe(aiptek->usbdev, 0),
893 aiptek->ifnum, buffer, size, 5000);
900 aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data)
915 aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
929 aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
943 if (aiptek_command(aiptek, command, data) != 0) {
947 msleep(aiptek->curSetting.programmableDelay);
950 aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
965 static int aiptek_program_tablet(struct aiptek *aiptek)
969 if ((ret = aiptek_command(aiptek, 0x18, 0x04)) < 0)
973 if ((ret = aiptek_query(aiptek, 0x02, 0x00)) < 0)
975 aiptek->features.modelCode = ret & 0xff;
978 if ((ret = aiptek_query(aiptek, 0x03, 0x00)) < 0)
980 aiptek->features.odmCode = ret;
983 if ((ret = aiptek_query(aiptek, 0x04, 0x00)) < 0)
985 aiptek->features.firmwareCode = ret;
988 if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0)
990 input_set_abs_params(aiptek->inputdev, ABS_X, 0, ret - 1, 0, 0);
993 if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0)
995 input_set_abs_params(aiptek->inputdev, ABS_Y, 0, ret - 1, 0, 0);
998 if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0)
1000 input_set_abs_params(aiptek->inputdev, ABS_PRESSURE, 0, ret - 1, 0, 0);
1005 if (aiptek->curSetting.coordinateMode ==
1008 if ((ret = aiptek_command(aiptek, 0x10, 0x01)) < 0) {
1013 if ((ret = aiptek_command(aiptek, 0x10, 0x00)) < 0) {
1019 if ((ret = aiptek_command(aiptek, 0x11, 0x02)) < 0)
1023 if ((ret = aiptek_command(aiptek, 0x12, 0xff)) < 0)
1028 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_NA;
1029 aiptek->eventCount = 0;
1046 struct aiptek *aiptek = dev_get_drvdata(dev);
1049 input_abs_get_max(aiptek->inputdev, ABS_X) + 1,
1050 input_abs_get_max(aiptek->inputdev, ABS_Y) + 1);
1074 struct aiptek *aiptek = dev_get_drvdata(dev);
1078 aiptek->curSetting.pointerMode));
1084 struct aiptek *aiptek = dev_get_drvdata(dev);
1090 aiptek->newSetting.pointerMode = new_mode;
1111 struct aiptek *aiptek = dev_get_drvdata(dev);
1115 aiptek->curSetting.coordinateMode));
1121 struct aiptek *aiptek = dev_get_drvdata(dev);
1127 aiptek->newSetting.coordinateMode = new_mode;
1153 struct aiptek *aiptek = dev_get_drvdata(dev);
1157 aiptek->curSetting.toolMode));
1163 struct aiptek *aiptek = dev_get_drvdata(dev);
1169 aiptek->newSetting.toolMode = new_mode;
1183 struct aiptek *aiptek = dev_get_drvdata(dev);
1185 if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) {
1189 aiptek->curSetting.xTilt);
1196 struct aiptek *aiptek = dev_get_drvdata(dev);
1205 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE;
1210 aiptek->newSetting.xTilt = x;
1225 struct aiptek *aiptek = dev_get_drvdata(dev);
1227 if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) {
1231 aiptek->curSetting.yTilt);
1238 struct aiptek *aiptek = dev_get_drvdata(dev);
1247 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE;
1252 aiptek->newSetting.yTilt = y;
1267 struct aiptek *aiptek = dev_get_drvdata(dev);
1269 return snprintf(buf, PAGE_SIZE, "%d\n", aiptek->curSetting.jitterDelay);
1275 struct aiptek *aiptek = dev_get_drvdata(dev);
1281 aiptek->newSetting.jitterDelay = (int)j;
1295 struct aiptek *aiptek = dev_get_drvdata(dev);
1298 aiptek->curSetting.programmableDelay);
1304 struct aiptek *aiptek = dev_get_drvdata(dev);
1310 aiptek->newSetting.programmableDelay = (int)d;
1324 struct aiptek *aiptek = dev_get_drvdata(dev);
1326 return snprintf(buf, PAGE_SIZE, "%ld\n", aiptek->eventCount);
1337 struct aiptek *aiptek = dev_get_drvdata(dev);
1340 switch (aiptek->diagnostic) {
1354 if (aiptek->curSetting.pointerMode ==
1383 struct aiptek *aiptek = dev_get_drvdata(dev);
1387 aiptek->curSetting.stylusButtonUpper));
1393 struct aiptek *aiptek = dev_get_drvdata(dev);
1399 aiptek->newSetting.stylusButtonUpper = new_button;
1414 struct aiptek *aiptek = dev_get_drvdata(dev);
1418 aiptek->curSetting.stylusButtonLower));
1424 struct aiptek *aiptek = dev_get_drvdata(dev);
1430 aiptek->newSetting.stylusButtonLower = new_button;
1452 struct aiptek *aiptek = dev_get_drvdata(dev);
1456 aiptek->curSetting.mouseButtonLeft));
1462 struct aiptek *aiptek = dev_get_drvdata(dev);
1468 aiptek->newSetting.mouseButtonLeft = new_button;
1482 struct aiptek *aiptek = dev_get_drvdata(dev);
1486 aiptek->curSetting.mouseButtonMiddle));
1492 struct aiptek *aiptek = dev_get_drvdata(dev);
1498 aiptek->newSetting.mouseButtonMiddle = new_button;
1512 struct aiptek *aiptek = dev_get_drvdata(dev);
1516 aiptek->curSetting.mouseButtonRight));
1522 struct aiptek *aiptek = dev_get_drvdata(dev);
1528 aiptek->newSetting.mouseButtonRight = new_button;
1542 struct aiptek *aiptek = dev_get_drvdata(dev);
1544 if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) {
1548 aiptek->curSetting.wheel);
1555 struct aiptek *aiptek = dev_get_drvdata(dev);
1560 aiptek->newSetting.wheel = (int)w;
1583 struct aiptek *aiptek = dev_get_drvdata(dev);
1588 memcpy(&aiptek->curSetting, &aiptek->newSetting,
1591 if (aiptek_program_tablet(aiptek) < 0)
1606 struct aiptek *aiptek = dev_get_drvdata(dev);
1608 return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.odmCode);
1619 struct aiptek *aiptek = dev_get_drvdata(dev);
1621 return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->features.modelCode);
1632 struct aiptek *aiptek = dev_get_drvdata(dev);
1635 aiptek->features.firmwareCode);
1677 struct aiptek *aiptek;
1698 aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL);
1700 if (!aiptek || !inputdev) {
1706 aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH,
1707 GFP_ATOMIC, &aiptek->data_dma);
1708 if (!aiptek->data) {
1713 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL);
1714 if (!aiptek->urb) {
1719 aiptek->inputdev = inputdev;
1720 aiptek->usbdev = usbdev;
1721 aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber;
1722 aiptek->inDelay = 0;
1723 aiptek->endDelay = 0;
1724 aiptek->previousJitterable = 0;
1725 aiptek->lastMacro = -1;
1733 aiptek->curSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE;
1734 aiptek->curSetting.coordinateMode = AIPTEK_COORDINATE_ABSOLUTE_MODE;
1735 aiptek->curSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE;
1736 aiptek->curSetting.xTilt = AIPTEK_TILT_DISABLE;
1737 aiptek->curSetting.yTilt = AIPTEK_TILT_DISABLE;
1738 aiptek->curSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON;
1739 aiptek->curSetting.mouseButtonMiddle = AIPTEK_MOUSE_MIDDLE_BUTTON;
1740 aiptek->curSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON;
1741 aiptek->curSetting.stylusButtonUpper = AIPTEK_STYLUS_UPPER_BUTTON;
1742 aiptek->curSetting.stylusButtonLower = AIPTEK_STYLUS_LOWER_BUTTON;
1743 aiptek->curSetting.jitterDelay = jitterDelay;
1744 aiptek->curSetting.programmableDelay = programmableDelay;
1748 aiptek->newSetting = aiptek->curSetting;
1757 usb_make_path(usbdev, aiptek->features.usbPath,
1758 sizeof(aiptek->features.usbPath));
1759 strlcat(aiptek->features.usbPath, "/input0",
1760 sizeof(aiptek->features.usbPath));
1766 inputdev->phys = aiptek->features.usbPath;
1770 input_set_drvdata(inputdev, aiptek);
1814 usb_fill_int_urb(aiptek->urb,
1815 aiptek->usbdev,
1816 usb_rcvintpipe(aiptek->usbdev,
1818 aiptek->data, 8, aiptek_irq, aiptek,
1821 aiptek->urb->transfer_dma = aiptek->data_dma;
1822 aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1836 aiptek->curSetting.programmableDelay = speeds[i];
1837 (void)aiptek_program_tablet(aiptek);
1838 if (input_abs_get_max(aiptek->inputdev, ABS_X) > 0) {
1841 aiptek->curSetting.programmableDelay);
1856 usb_set_intfdata(intf, aiptek);
1869 err = input_register_device(aiptek->inputdev);
1878 fail3: usb_free_urb(aiptek->urb);
1879 fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data,
1880 aiptek->data_dma);
1883 kfree(aiptek);
1892 struct aiptek *aiptek = usb_get_intfdata(intf);
1897 if (aiptek != NULL) {
1900 usb_kill_urb(aiptek->urb);
1901 input_unregister_device(aiptek->inputdev);
1903 usb_free_urb(aiptek->urb);
1906 aiptek->data, aiptek->data_dma);
1907 kfree(aiptek);
1912 .name = "aiptek",