Lines Matching refs:aiptek

288 struct aiptek {
414 struct aiptek *aiptek = urb->context;
415 unsigned char *data = aiptek->data;
416 struct input_dev *inputdev = aiptek->inputdev;
417 struct usb_interface *intf = aiptek->intf;
442 if (aiptek->inDelay == 1 && time_after(aiptek->endDelay, jiffies)) {
446 aiptek->inDelay = 0;
447 aiptek->eventCount++;
454 if (aiptek->curSetting.coordinateMode ==
456 aiptek->diagnostic =
471 left = (data[1] & aiptek->curSetting.mouseButtonLeft >> 2) != 0 ? 1 : 0;
472 right = (data[1] & aiptek->curSetting.mouseButtonRight >> 2) != 0 ? 1 : 0;
473 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle >> 2) != 0 ? 1 : 0;
487 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
489 aiptek->curSetting.wheel);
490 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
492 if (aiptek->lastMacro != -1) {
494 macroKeyEvents[aiptek->lastMacro], 0);
495 aiptek->lastMacro = -1;
504 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
505 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
507 (aiptek->curSetting.pointerMode)) {
508 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
522 bs = (data[5] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
523 pck = (data[5] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
533 if (aiptek->previousToolMode !=
534 aiptek->curSetting.toolMode) {
536 aiptek->previousToolMode, 0);
538 aiptek->curSetting.toolMode,
540 aiptek->previousToolMode =
541 aiptek->curSetting.toolMode;
553 if (aiptek->curSetting.xTilt !=
557 aiptek->curSetting.xTilt);
559 if (aiptek->curSetting.yTilt != AIPTEK_TILT_DISABLE) {
562 aiptek->curSetting.yTilt);
568 if (aiptek->curSetting.wheel !=
572 aiptek->curSetting.wheel);
573 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
577 if (aiptek->lastMacro != -1) {
579 macroKeyEvents[aiptek->lastMacro], 0);
580 aiptek->lastMacro = -1;
589 if (aiptek->curSetting.coordinateMode == AIPTEK_COORDINATE_RELATIVE_MODE) {
590 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE;
592 (aiptek->curSetting.pointerMode)) {
593 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED;
602 left = (data[5] & aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
603 right = (data[5] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
604 middle = (data[5] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
610 if (aiptek->previousToolMode !=
611 aiptek->curSetting.toolMode) {
613 aiptek->previousToolMode, 0);
615 aiptek->curSetting.toolMode,
617 aiptek->previousToolMode =
618 aiptek->curSetting.toolMode;
632 if (aiptek->curSetting.wheel != AIPTEK_WHEEL_DISABLE) {
635 aiptek->curSetting.wheel);
636 aiptek->curSetting.wheel = AIPTEK_WHEEL_DISABLE;
640 if (aiptek->lastMacro != -1) {
642 macroKeyEvents[aiptek->lastMacro], 0);
643 aiptek->lastMacro = -1;
657 bs = (data[1] & aiptek->curSetting.stylusButtonLower) != 0 ? 1 : 0;
658 pck = (data[1] & aiptek->curSetting.stylusButtonUpper) != 0 ? 1 : 0;
667 if (aiptek->previousToolMode !=
668 aiptek->curSetting.toolMode) {
670 aiptek->previousToolMode, 0);
672 aiptek->curSetting.toolMode,
674 aiptek->previousToolMode =
675 aiptek->curSetting.toolMode;
679 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
680 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
681 aiptek->lastMacro = -1;
684 if (macro != -1 && macro != aiptek->lastMacro) {
686 aiptek->lastMacro = macro;
699 left = (data[1]& aiptek->curSetting.mouseButtonLeft) != 0 ? 1 : 0;
700 right = (data[1] & aiptek->curSetting.mouseButtonRight) != 0 ? 1 : 0;
701 middle = (data[1] & aiptek->curSetting.mouseButtonMiddle) != 0 ? 1 : 0;
708 if (aiptek->previousToolMode !=
709 aiptek->curSetting.toolMode) {
711 aiptek->previousToolMode, 0);
713 aiptek->curSetting.toolMode, 1);
714 aiptek->previousToolMode = aiptek->curSetting.toolMode;
718 if (aiptek->lastMacro != -1 && aiptek->lastMacro != macro) {
719 input_report_key(inputdev, macroKeyEvents[aiptek->lastMacro], 0);
720 aiptek->lastMacro = -1;
723 if (macro != -1 && macro != aiptek->lastMacro) {
725 aiptek->lastMacro = macro;
752 if (aiptek->previousToolMode !=
753 aiptek->curSetting.toolMode) {
755 aiptek->previousToolMode, 0);
757 aiptek->curSetting.toolMode,
759 aiptek->previousToolMode =
760 aiptek->curSetting.toolMode;
776 * We just introduced aiptek->previousJitterable to carry forth the
783 if (aiptek->previousJitterable != jitterable &&
784 aiptek->curSetting.jitterDelay != 0 && aiptek->inDelay != 1) {
785 aiptek->endDelay = jiffies +
786 ((aiptek->curSetting.jitterDelay * HZ) / 1000);
787 aiptek->inDelay = 1;
789 aiptek->previousJitterable = jitterable;
827 struct aiptek *aiptek = input_get_drvdata(inputdev);
829 aiptek->urb->dev = interface_to_usbdev(aiptek->intf);
830 if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0)
841 struct aiptek *aiptek = input_get_drvdata(inputdev);
843 usb_kill_urb(aiptek->urb);
851 aiptek_set_report(struct aiptek *aiptek,
855 struct usb_device *udev = interface_to_usbdev(aiptek->intf);
862 aiptek->ifnum, buffer, size, 5000);
866 aiptek_get_report(struct aiptek *aiptek,
870 struct usb_device *udev = interface_to_usbdev(aiptek->intf);
877 aiptek->ifnum, buffer, size, 5000);
884 aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data)
899 aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) {
900 dev_dbg(&aiptek->intf->dev,
914 aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data)
928 if (aiptek_command(aiptek, command, data) != 0) {
932 msleep(aiptek->curSetting.programmableDelay);
934 if (aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf) != sizeof_buf) {
935 dev_dbg(&aiptek->intf->dev,
950 static int aiptek_program_tablet(struct aiptek *aiptek)
954 if ((ret = aiptek_command(aiptek, 0x18, 0x04)) < 0)
958 if ((ret = aiptek_query(aiptek, 0x02, 0x00)) < 0)
960 aiptek->features.modelCode = ret & 0xff;
963 if ((ret = aiptek_query(aiptek, 0x03, 0x00)) < 0)
965 aiptek->features.odmCode = ret;
968 if ((ret = aiptek_query(aiptek, 0x04, 0x00)) < 0)
970 aiptek->features.firmwareCode = ret;
973 if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0)
975 input_set_abs_params(aiptek->inputdev, ABS_X, 0, ret - 1, 0, 0);
978 if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0)
980 input_set_abs_params(aiptek->inputdev, ABS_Y, 0, ret - 1, 0, 0);
983 if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0)
985 input_set_abs_params(aiptek->inputdev, ABS_PRESSURE, 0, ret - 1, 0, 0);
990 if (aiptek->curSetting.coordinateMode ==
993 if ((ret = aiptek_command(aiptek, 0x10, 0x01)) < 0) {
998 if ((ret = aiptek_command(aiptek, 0x10, 0x00)) < 0) {
1004 if ((ret = aiptek_command(aiptek, 0x11, 0x02)) < 0)
1008 if ((ret = aiptek_command(aiptek, 0x17, 0x00)) < 0)
1013 if ((ret = aiptek_command(aiptek, 0x12, 0xff)) < 0)
1018 aiptek->diagnostic = AIPTEK_DIAGNOSTIC_NA;
1019 aiptek->eventCount = 0;
1036 struct aiptek *aiptek = dev_get_drvdata(dev);
1039 input_abs_get_max(aiptek->inputdev, ABS_X) + 1,
1040 input_abs_get_max(aiptek->inputdev, ABS_Y) + 1);
1064 struct aiptek *aiptek = dev_get_drvdata(dev);
1067 aiptek->curSetting.pointerMode));
1073 struct aiptek *aiptek = dev_get_drvdata(dev);
1079 aiptek->newSetting.pointerMode = new_mode;
1100 struct aiptek *aiptek = dev_get_drvdata(dev);
1103 aiptek->curSetting.coordinateMode));
1109 struct aiptek *aiptek = dev_get_drvdata(dev);
1115 aiptek->newSetting.coordinateMode = new_mode;
1141 struct aiptek *aiptek = dev_get_drvdata(dev);
1144 aiptek->curSetting.toolMode));
1150 struct aiptek *aiptek = dev_get_drvdata(dev);
1156 aiptek->newSetting.toolMode = new_mode;
1170 struct aiptek *aiptek = dev_get_drvdata(dev);
1172 if (aiptek->curSetting.xTilt == AIPTEK_TILT_DISABLE) {
1175 return sysfs_emit(buf, "%d\n", aiptek->curSetting.xTilt);
1182 struct aiptek *aiptek = dev_get_drvdata(dev);
1191 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE;
1196 aiptek->newSetting.xTilt = x;
1211 struct aiptek *aiptek = dev_get_drvdata(dev);
1213 if (aiptek->curSetting.yTilt == AIPTEK_TILT_DISABLE) {
1216 return sysfs_emit(buf, "%d\n", aiptek->curSetting.yTilt);
1223 struct aiptek *aiptek = dev_get_drvdata(dev);
1232 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE;
1237 aiptek->newSetting.yTilt = y;
1252 struct aiptek *aiptek = dev_get_drvdata(dev);
1254 return sysfs_emit(buf, "%d\n", aiptek->curSetting.jitterDelay);
1260 struct aiptek *aiptek = dev_get_drvdata(dev);
1267 aiptek->newSetting.jitterDelay = j;
1281 struct aiptek *aiptek = dev_get_drvdata(dev);
1283 return sysfs_emit(buf, "%d\n", aiptek->curSetting.programmableDelay);
1289 struct aiptek *aiptek = dev_get_drvdata(dev);
1296 aiptek->newSetting.programmableDelay = d;
1310 struct aiptek *aiptek = dev_get_drvdata(dev);
1312 return sysfs_emit(buf, "%ld\n", aiptek->eventCount);
1323 struct aiptek *aiptek = dev_get_drvdata(dev);
1326 switch (aiptek->diagnostic) {
1340 if (aiptek->curSetting.pointerMode ==
1369 struct aiptek *aiptek = dev_get_drvdata(dev);
1372 aiptek->curSetting.stylusButtonUpper));
1378 struct aiptek *aiptek = dev_get_drvdata(dev);
1384 aiptek->newSetting.stylusButtonUpper = new_button;
1399 struct aiptek *aiptek = dev_get_drvdata(dev);
1402 aiptek->curSetting.stylusButtonLower));
1408 struct aiptek *aiptek = dev_get_drvdata(dev);
1414 aiptek->newSetting.stylusButtonLower = new_button;
1436 struct aiptek *aiptek = dev_get_drvdata(dev);
1439 aiptek->curSetting.mouseButtonLeft));
1445 struct aiptek *aiptek = dev_get_drvdata(dev);
1451 aiptek->newSetting.mouseButtonLeft = new_button;
1465 struct aiptek *aiptek = dev_get_drvdata(dev);
1468 aiptek->curSetting.mouseButtonMiddle));
1474 struct aiptek *aiptek = dev_get_drvdata(dev);
1480 aiptek->newSetting.mouseButtonMiddle = new_button;
1494 struct aiptek *aiptek = dev_get_drvdata(dev);
1497 aiptek->curSetting.mouseButtonRight));
1503 struct aiptek *aiptek = dev_get_drvdata(dev);
1509 aiptek->newSetting.mouseButtonRight = new_button;
1523 struct aiptek *aiptek = dev_get_drvdata(dev);
1525 if (aiptek->curSetting.wheel == AIPTEK_WHEEL_DISABLE) {
1528 return sysfs_emit(buf, "%d\n", aiptek->curSetting.wheel);
1535 struct aiptek *aiptek = dev_get_drvdata(dev);
1542 aiptek->newSetting.wheel = w;
1564 struct aiptek *aiptek = dev_get_drvdata(dev);
1569 memcpy(&aiptek->curSetting, &aiptek->newSetting,
1572 if (aiptek_program_tablet(aiptek) < 0)
1587 struct aiptek *aiptek = dev_get_drvdata(dev);
1589 return sysfs_emit(buf, "0x%04x\n", aiptek->features.odmCode);
1600 struct aiptek *aiptek = dev_get_drvdata(dev);
1602 return sysfs_emit(buf, "0x%04x\n", aiptek->features.modelCode);
1613 struct aiptek *aiptek = dev_get_drvdata(dev);
1615 return sysfs_emit(buf, "%04x\n", aiptek->features.firmwareCode);
1655 struct aiptek *aiptek;
1676 aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL);
1678 if (!aiptek || !inputdev) {
1684 aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH,
1685 GFP_KERNEL, &aiptek->data_dma);
1686 if (!aiptek->data) {
1691 aiptek->urb = usb_alloc_urb(0, GFP_KERNEL);
1692 if (!aiptek->urb) {
1697 aiptek->inputdev = inputdev;
1698 aiptek->intf = intf;
1699 aiptek->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
1700 aiptek->inDelay = 0;
1701 aiptek->endDelay = 0;
1702 aiptek->previousJitterable = 0;
1703 aiptek->lastMacro = -1;
1711 aiptek->curSetting.pointerMode = AIPTEK_POINTER_EITHER_MODE;
1712 aiptek->curSetting.coordinateMode = AIPTEK_COORDINATE_ABSOLUTE_MODE;
1713 aiptek->curSetting.toolMode = AIPTEK_TOOL_BUTTON_PEN_MODE;
1714 aiptek->curSetting.xTilt = AIPTEK_TILT_DISABLE;
1715 aiptek->curSetting.yTilt = AIPTEK_TILT_DISABLE;
1716 aiptek->curSetting.mouseButtonLeft = AIPTEK_MOUSE_LEFT_BUTTON;
1717 aiptek->curSetting.mouseButtonMiddle = AIPTEK_MOUSE_MIDDLE_BUTTON;
1718 aiptek->curSetting.mouseButtonRight = AIPTEK_MOUSE_RIGHT_BUTTON;
1719 aiptek->curSetting.stylusButtonUpper = AIPTEK_STYLUS_UPPER_BUTTON;
1720 aiptek->curSetting.stylusButtonLower = AIPTEK_STYLUS_LOWER_BUTTON;
1721 aiptek->curSetting.jitterDelay = jitterDelay;
1722 aiptek->curSetting.programmableDelay = programmableDelay;
1726 aiptek->newSetting = aiptek->curSetting;
1735 usb_make_path(usbdev, aiptek->features.usbPath,
1736 sizeof(aiptek->features.usbPath));
1737 strlcat(aiptek->features.usbPath, "/input0",
1738 sizeof(aiptek->features.usbPath));
1744 inputdev->phys = aiptek->features.usbPath;
1748 input_set_drvdata(inputdev, aiptek);
1798 usb_fill_int_urb(aiptek->urb,
1802 aiptek->data, 8, aiptek_irq, aiptek,
1805 aiptek->urb->transfer_dma = aiptek->data_dma;
1806 aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1820 aiptek->curSetting.programmableDelay = speeds[i];
1821 (void)aiptek_program_tablet(aiptek);
1822 if (input_abs_get_max(aiptek->inputdev, ABS_X) > 0) {
1825 aiptek->curSetting.programmableDelay);
1841 usb_set_intfdata(intf, aiptek);
1845 err = input_register_device(aiptek->inputdev);
1853 fail3: usb_free_urb(aiptek->urb);
1854 fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data,
1855 aiptek->data_dma);
1858 kfree(aiptek);
1867 struct aiptek *aiptek = usb_get_intfdata(intf);
1872 if (aiptek != NULL) {
1875 usb_kill_urb(aiptek->urb);
1876 input_unregister_device(aiptek->inputdev);
1877 usb_free_urb(aiptek->urb);
1880 aiptek->data, aiptek->data_dma);
1881 kfree(aiptek);
1886 .name = "aiptek",