diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-28 16:09:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-28 16:09:47 -0400 |
commit | 84860bf0644d7c45afe7ddbd30731c3e3c371fae (patch) | |
tree | d6c4b98a9c3fd9981e7fcc5d7729c9e01e327767 /drivers/usb/input/aiptek.c | |
parent | 8caf89157d64f1eedba37113afb4b303b2b3e301 (diff) | |
parent | 6fbfddcb52d8d9fa2cd209f5ac2a1c87497d55b5 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Diffstat (limited to 'drivers/usb/input/aiptek.c')
-rw-r--r-- | drivers/usb/input/aiptek.c | 209 |
1 files changed, 93 insertions, 116 deletions
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index cd0cbfe20723..1c5205321d83 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -317,7 +317,7 @@ struct aiptek_settings { | |||
317 | }; | 317 | }; |
318 | 318 | ||
319 | struct aiptek { | 319 | struct aiptek { |
320 | struct input_dev inputdev; /* input device struct */ | 320 | struct input_dev *inputdev; /* input device struct */ |
321 | struct usb_device *usbdev; /* usb device struct */ | 321 | struct usb_device *usbdev; /* usb device struct */ |
322 | struct urb *urb; /* urb for incoming reports */ | 322 | struct urb *urb; /* urb for incoming reports */ |
323 | dma_addr_t data_dma; /* our dma stuffage */ | 323 | dma_addr_t data_dma; /* our dma stuffage */ |
@@ -402,7 +402,7 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs) | |||
402 | { | 402 | { |
403 | struct aiptek *aiptek = urb->context; | 403 | struct aiptek *aiptek = urb->context; |
404 | unsigned char *data = aiptek->data; | 404 | unsigned char *data = aiptek->data; |
405 | struct input_dev *inputdev = &aiptek->inputdev; | 405 | struct input_dev *inputdev = aiptek->inputdev; |
406 | int jitterable = 0; | 406 | int jitterable = 0; |
407 | int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; | 407 | int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; |
408 | 408 | ||
@@ -955,20 +955,20 @@ static int aiptek_program_tablet(struct aiptek *aiptek) | |||
955 | /* Query getXextension */ | 955 | /* Query getXextension */ |
956 | if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0) | 956 | if ((ret = aiptek_query(aiptek, 0x01, 0x00)) < 0) |
957 | return ret; | 957 | return ret; |
958 | aiptek->inputdev.absmin[ABS_X] = 0; | 958 | aiptek->inputdev->absmin[ABS_X] = 0; |
959 | aiptek->inputdev.absmax[ABS_X] = ret - 1; | 959 | aiptek->inputdev->absmax[ABS_X] = ret - 1; |
960 | 960 | ||
961 | /* Query getYextension */ | 961 | /* Query getYextension */ |
962 | if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0) | 962 | if ((ret = aiptek_query(aiptek, 0x01, 0x01)) < 0) |
963 | return ret; | 963 | return ret; |
964 | aiptek->inputdev.absmin[ABS_Y] = 0; | 964 | aiptek->inputdev->absmin[ABS_Y] = 0; |
965 | aiptek->inputdev.absmax[ABS_Y] = ret - 1; | 965 | aiptek->inputdev->absmax[ABS_Y] = ret - 1; |
966 | 966 | ||
967 | /* Query getPressureLevels */ | 967 | /* Query getPressureLevels */ |
968 | if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0) | 968 | if ((ret = aiptek_query(aiptek, 0x08, 0x00)) < 0) |
969 | return ret; | 969 | return ret; |
970 | aiptek->inputdev.absmin[ABS_PRESSURE] = 0; | 970 | aiptek->inputdev->absmin[ABS_PRESSURE] = 0; |
971 | aiptek->inputdev.absmax[ABS_PRESSURE] = ret - 1; | 971 | aiptek->inputdev->absmax[ABS_PRESSURE] = ret - 1; |
972 | 972 | ||
973 | /* Depending on whether we are in absolute or relative mode, we will | 973 | /* Depending on whether we are in absolute or relative mode, we will |
974 | * do a switchToTablet(absolute) or switchToMouse(relative) command. | 974 | * do a switchToTablet(absolute) or switchToMouse(relative) command. |
@@ -1025,8 +1025,8 @@ static ssize_t show_tabletSize(struct device *dev, struct device_attribute *attr | |||
1025 | return 0; | 1025 | return 0; |
1026 | 1026 | ||
1027 | return snprintf(buf, PAGE_SIZE, "%dx%d\n", | 1027 | return snprintf(buf, PAGE_SIZE, "%dx%d\n", |
1028 | aiptek->inputdev.absmax[ABS_X] + 1, | 1028 | aiptek->inputdev->absmax[ABS_X] + 1, |
1029 | aiptek->inputdev.absmax[ABS_Y] + 1); | 1029 | aiptek->inputdev->absmax[ABS_Y] + 1); |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | /* These structs define the sysfs files, param #1 is the name of the | 1032 | /* These structs define the sysfs files, param #1 is the name of the |
@@ -1048,7 +1048,7 @@ static ssize_t show_tabletProductId(struct device *dev, struct device_attribute | |||
1048 | return 0; | 1048 | return 0; |
1049 | 1049 | ||
1050 | return snprintf(buf, PAGE_SIZE, "0x%04x\n", | 1050 | return snprintf(buf, PAGE_SIZE, "0x%04x\n", |
1051 | aiptek->inputdev.id.product); | 1051 | aiptek->inputdev->id.product); |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | static DEVICE_ATTR(product_id, S_IRUGO, show_tabletProductId, NULL); | 1054 | static DEVICE_ATTR(product_id, S_IRUGO, show_tabletProductId, NULL); |
@@ -1063,7 +1063,7 @@ static ssize_t show_tabletVendorId(struct device *dev, struct device_attribute * | |||
1063 | if (aiptek == NULL) | 1063 | if (aiptek == NULL) |
1064 | return 0; | 1064 | return 0; |
1065 | 1065 | ||
1066 | return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->inputdev.id.vendor); | 1066 | return snprintf(buf, PAGE_SIZE, "0x%04x\n", aiptek->inputdev->id.vendor); |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | static DEVICE_ATTR(vendor_id, S_IRUGO, show_tabletVendorId, NULL); | 1069 | static DEVICE_ATTR(vendor_id, S_IRUGO, show_tabletVendorId, NULL); |
@@ -1977,7 +1977,6 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1977 | struct input_dev *inputdev; | 1977 | struct input_dev *inputdev; |
1978 | struct input_handle *inputhandle; | 1978 | struct input_handle *inputhandle; |
1979 | struct list_head *node, *next; | 1979 | struct list_head *node, *next; |
1980 | char path[64 + 1]; | ||
1981 | int i; | 1980 | int i; |
1982 | int speeds[] = { 0, | 1981 | int speeds[] = { 0, |
1983 | AIPTEK_PROGRAMMABLE_DELAY_50, | 1982 | AIPTEK_PROGRAMMABLE_DELAY_50, |
@@ -1996,24 +1995,26 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1996 | */ | 1995 | */ |
1997 | speeds[0] = programmableDelay; | 1996 | speeds[0] = programmableDelay; |
1998 | 1997 | ||
1999 | if ((aiptek = kmalloc(sizeof(struct aiptek), GFP_KERNEL)) == NULL) | 1998 | aiptek = kzalloc(sizeof(struct aiptek), GFP_KERNEL); |
2000 | return -ENOMEM; | 1999 | inputdev = input_allocate_device(); |
2001 | memset(aiptek, 0, sizeof(struct aiptek)); | 2000 | if (!aiptek || !inputdev) |
2001 | goto fail1; | ||
2002 | 2002 | ||
2003 | aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, | 2003 | aiptek->data = usb_buffer_alloc(usbdev, AIPTEK_PACKET_LENGTH, |
2004 | SLAB_ATOMIC, &aiptek->data_dma); | 2004 | SLAB_ATOMIC, &aiptek->data_dma); |
2005 | if (aiptek->data == NULL) { | 2005 | if (!aiptek->data) |
2006 | kfree(aiptek); | 2006 | goto fail1; |
2007 | return -ENOMEM; | ||
2008 | } | ||
2009 | 2007 | ||
2010 | aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); | 2008 | aiptek->urb = usb_alloc_urb(0, GFP_KERNEL); |
2011 | if (aiptek->urb == NULL) { | 2009 | if (!aiptek->urb) |
2012 | usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, | 2010 | goto fail2; |
2013 | aiptek->data_dma); | 2011 | |
2014 | kfree(aiptek); | 2012 | aiptek->inputdev = inputdev; |
2015 | return -ENOMEM; | 2013 | aiptek->usbdev = usbdev; |
2016 | } | 2014 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; |
2015 | aiptek->inDelay = 0; | ||
2016 | aiptek->endDelay = 0; | ||
2017 | aiptek->previousJitterable = 0; | ||
2017 | 2018 | ||
2018 | /* Set up the curSettings struct. Said struct contains the current | 2019 | /* Set up the curSettings struct. Said struct contains the current |
2019 | * programmable parameters. The newSetting struct contains changes | 2020 | * programmable parameters. The newSetting struct contains changes |
@@ -2036,31 +2037,48 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2036 | 2037 | ||
2037 | /* Both structs should have equivalent settings | 2038 | /* Both structs should have equivalent settings |
2038 | */ | 2039 | */ |
2039 | memcpy(&aiptek->newSetting, &aiptek->curSetting, | 2040 | aiptek->newSetting = aiptek->curSetting; |
2040 | sizeof(struct aiptek_settings)); | 2041 | |
2042 | /* Determine the usb devices' physical path. | ||
2043 | * Asketh not why we always pretend we're using "../input0", | ||
2044 | * but I suspect this will have to be refactored one | ||
2045 | * day if a single USB device can be a keyboard & a mouse | ||
2046 | * & a tablet, and the inputX number actually will tell | ||
2047 | * us something... | ||
2048 | */ | ||
2049 | usb_make_path(usbdev, aiptek->features.usbPath, | ||
2050 | sizeof(aiptek->features.usbPath)); | ||
2051 | strlcat(aiptek->features.usbPath, "/input0", | ||
2052 | sizeof(aiptek->features.usbPath)); | ||
2053 | |||
2054 | /* Set up client data, pointers to open and close routines | ||
2055 | * for the input device. | ||
2056 | */ | ||
2057 | inputdev->name = "Aiptek"; | ||
2058 | inputdev->phys = aiptek->features.usbPath; | ||
2059 | usb_to_input_id(usbdev, &inputdev->id); | ||
2060 | inputdev->cdev.dev = &intf->dev; | ||
2061 | inputdev->private = aiptek; | ||
2062 | inputdev->open = aiptek_open; | ||
2063 | inputdev->close = aiptek_close; | ||
2041 | 2064 | ||
2042 | /* Now program the capacities of the tablet, in terms of being | 2065 | /* Now program the capacities of the tablet, in terms of being |
2043 | * an input device. | 2066 | * an input device. |
2044 | */ | 2067 | */ |
2045 | aiptek->inputdev.evbit[0] |= BIT(EV_KEY) | 2068 | inputdev->evbit[0] |= BIT(EV_KEY) |
2046 | | BIT(EV_ABS) | 2069 | | BIT(EV_ABS) |
2047 | | BIT(EV_REL) | 2070 | | BIT(EV_REL) |
2048 | | BIT(EV_MSC); | 2071 | | BIT(EV_MSC); |
2049 | 2072 | ||
2050 | aiptek->inputdev.absbit[0] |= | 2073 | inputdev->absbit[0] |= BIT(ABS_MISC); |
2051 | (BIT(ABS_X) | | ||
2052 | BIT(ABS_Y) | | ||
2053 | BIT(ABS_PRESSURE) | | ||
2054 | BIT(ABS_TILT_X) | | ||
2055 | BIT(ABS_TILT_Y) | BIT(ABS_WHEEL) | BIT(ABS_MISC)); | ||
2056 | 2074 | ||
2057 | aiptek->inputdev.relbit[0] |= | 2075 | inputdev->relbit[0] |= |
2058 | (BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL) | BIT(REL_MISC)); | 2076 | (BIT(REL_X) | BIT(REL_Y) | BIT(REL_WHEEL) | BIT(REL_MISC)); |
2059 | 2077 | ||
2060 | aiptek->inputdev.keybit[LONG(BTN_LEFT)] |= | 2078 | inputdev->keybit[LONG(BTN_LEFT)] |= |
2061 | (BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE)); | 2079 | (BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE)); |
2062 | 2080 | ||
2063 | aiptek->inputdev.keybit[LONG(BTN_DIGI)] |= | 2081 | inputdev->keybit[LONG(BTN_DIGI)] |= |
2064 | (BIT(BTN_TOOL_PEN) | | 2082 | (BIT(BTN_TOOL_PEN) | |
2065 | BIT(BTN_TOOL_RUBBER) | | 2083 | BIT(BTN_TOOL_RUBBER) | |
2066 | BIT(BTN_TOOL_PENCIL) | | 2084 | BIT(BTN_TOOL_PENCIL) | |
@@ -2070,70 +2088,26 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2070 | BIT(BTN_TOOL_LENS) | | 2088 | BIT(BTN_TOOL_LENS) | |
2071 | BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2)); | 2089 | BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2)); |
2072 | 2090 | ||
2073 | aiptek->inputdev.mscbit[0] = BIT(MSC_SERIAL); | 2091 | inputdev->mscbit[0] = BIT(MSC_SERIAL); |
2074 | 2092 | ||
2075 | /* Programming the tablet macro keys needs to be done with a for loop | 2093 | /* Programming the tablet macro keys needs to be done with a for loop |
2076 | * as the keycodes are discontiguous. | 2094 | * as the keycodes are discontiguous. |
2077 | */ | 2095 | */ |
2078 | for (i = 0; i < sizeof(macroKeyEvents) / sizeof(macroKeyEvents[0]); ++i) | 2096 | for (i = 0; i < sizeof(macroKeyEvents) / sizeof(macroKeyEvents[0]); ++i) |
2079 | set_bit(macroKeyEvents[i], aiptek->inputdev.keybit); | 2097 | set_bit(macroKeyEvents[i], inputdev->keybit); |
2080 | |||
2081 | /* Set up client data, pointers to open and close routines | ||
2082 | * for the input device. | ||
2083 | */ | ||
2084 | aiptek->inputdev.private = aiptek; | ||
2085 | aiptek->inputdev.open = aiptek_open; | ||
2086 | aiptek->inputdev.close = aiptek_close; | ||
2087 | |||
2088 | /* Determine the usb devices' physical path. | ||
2089 | * Asketh not why we always pretend we're using "../input0", | ||
2090 | * but I suspect this will have to be refactored one | ||
2091 | * day if a single USB device can be a keyboard & a mouse | ||
2092 | * & a tablet, and the inputX number actually will tell | ||
2093 | * us something... | ||
2094 | */ | ||
2095 | if (usb_make_path(usbdev, path, 64) > 0) | ||
2096 | sprintf(aiptek->features.usbPath, "%s/input0", path); | ||
2097 | 2098 | ||
2098 | /* Program the input device coordinate capacities. We do not yet | 2099 | /* |
2100 | * Program the input device coordinate capacities. We do not yet | ||
2099 | * know what maximum X, Y, and Z values are, so we're putting fake | 2101 | * know what maximum X, Y, and Z values are, so we're putting fake |
2100 | * values in. Later, we'll ask the tablet to put in the correct | 2102 | * values in. Later, we'll ask the tablet to put in the correct |
2101 | * values. | 2103 | * values. |
2102 | */ | 2104 | */ |
2103 | aiptek->inputdev.absmin[ABS_X] = 0; | 2105 | input_set_abs_params(inputdev, ABS_X, 0, 2999, 0, 0); |
2104 | aiptek->inputdev.absmax[ABS_X] = 2999; | 2106 | input_set_abs_params(inputdev, ABS_X, 0, 2249, 0, 0); |
2105 | aiptek->inputdev.absmin[ABS_Y] = 0; | 2107 | input_set_abs_params(inputdev, ABS_PRESSURE, 0, 511, 0, 0); |
2106 | aiptek->inputdev.absmax[ABS_Y] = 2249; | 2108 | input_set_abs_params(inputdev, ABS_TILT_X, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); |
2107 | aiptek->inputdev.absmin[ABS_PRESSURE] = 0; | 2109 | input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0); |
2108 | aiptek->inputdev.absmax[ABS_PRESSURE] = 511; | 2110 | input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0); |
2109 | aiptek->inputdev.absmin[ABS_TILT_X] = AIPTEK_TILT_MIN; | ||
2110 | aiptek->inputdev.absmax[ABS_TILT_X] = AIPTEK_TILT_MAX; | ||
2111 | aiptek->inputdev.absmin[ABS_TILT_Y] = AIPTEK_TILT_MIN; | ||
2112 | aiptek->inputdev.absmax[ABS_TILT_Y] = AIPTEK_TILT_MAX; | ||
2113 | aiptek->inputdev.absmin[ABS_WHEEL] = AIPTEK_WHEEL_MIN; | ||
2114 | aiptek->inputdev.absmax[ABS_WHEEL] = AIPTEK_WHEEL_MAX - 1; | ||
2115 | aiptek->inputdev.absfuzz[ABS_X] = 0; | ||
2116 | aiptek->inputdev.absfuzz[ABS_Y] = 0; | ||
2117 | aiptek->inputdev.absfuzz[ABS_PRESSURE] = 0; | ||
2118 | aiptek->inputdev.absfuzz[ABS_TILT_X] = 0; | ||
2119 | aiptek->inputdev.absfuzz[ABS_TILT_Y] = 0; | ||
2120 | aiptek->inputdev.absfuzz[ABS_WHEEL] = 0; | ||
2121 | aiptek->inputdev.absflat[ABS_X] = 0; | ||
2122 | aiptek->inputdev.absflat[ABS_Y] = 0; | ||
2123 | aiptek->inputdev.absflat[ABS_PRESSURE] = 0; | ||
2124 | aiptek->inputdev.absflat[ABS_TILT_X] = 0; | ||
2125 | aiptek->inputdev.absflat[ABS_TILT_Y] = 0; | ||
2126 | aiptek->inputdev.absflat[ABS_WHEEL] = 0; | ||
2127 | aiptek->inputdev.name = "Aiptek"; | ||
2128 | aiptek->inputdev.phys = aiptek->features.usbPath; | ||
2129 | usb_to_input_id(usbdev, &aiptek->inputdev.id); | ||
2130 | aiptek->inputdev.dev = &intf->dev; | ||
2131 | |||
2132 | aiptek->usbdev = usbdev; | ||
2133 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; | ||
2134 | aiptek->inDelay = 0; | ||
2135 | aiptek->endDelay = 0; | ||
2136 | aiptek->previousJitterable = 0; | ||
2137 | 2111 | ||
2138 | endpoint = &intf->altsetting[0].endpoint[0].desc; | 2112 | endpoint = &intf->altsetting[0].endpoint[0].desc; |
2139 | 2113 | ||
@@ -2150,28 +2124,6 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2150 | aiptek->urb->transfer_dma = aiptek->data_dma; | 2124 | aiptek->urb->transfer_dma = aiptek->data_dma; |
2151 | aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 2125 | aiptek->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
2152 | 2126 | ||
2153 | /* Register the tablet as an Input Device | ||
2154 | */ | ||
2155 | input_register_device(&aiptek->inputdev); | ||
2156 | |||
2157 | /* We now will look for the evdev device which is mapped to | ||
2158 | * the tablet. The partial name is kept in the link list of | ||
2159 | * input_handles associated with this input device. | ||
2160 | * What identifies an evdev input_handler is that it begins | ||
2161 | * with 'event', continues with a digit, and that in turn | ||
2162 | * is mapped to /{devfs}/input/eventN. | ||
2163 | */ | ||
2164 | inputdev = &aiptek->inputdev; | ||
2165 | list_for_each_safe(node, next, &inputdev->h_list) { | ||
2166 | inputhandle = to_handle(node); | ||
2167 | if (strncmp(inputhandle->name, "event", 5) == 0) { | ||
2168 | strcpy(aiptek->features.inputPath, inputhandle->name); | ||
2169 | break; | ||
2170 | } | ||
2171 | } | ||
2172 | |||
2173 | info("input: Aiptek on %s (%s)\n", path, aiptek->features.inputPath); | ||
2174 | |||
2175 | /* Program the tablet. This sets the tablet up in the mode | 2127 | /* Program the tablet. This sets the tablet up in the mode |
2176 | * specified in newSetting, and also queries the tablet's | 2128 | * specified in newSetting, and also queries the tablet's |
2177 | * physical capacities. | 2129 | * physical capacities. |
@@ -2186,13 +2138,32 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2186 | for (i = 0; i < sizeof(speeds) / sizeof(speeds[0]); ++i) { | 2138 | for (i = 0; i < sizeof(speeds) / sizeof(speeds[0]); ++i) { |
2187 | aiptek->curSetting.programmableDelay = speeds[i]; | 2139 | aiptek->curSetting.programmableDelay = speeds[i]; |
2188 | (void)aiptek_program_tablet(aiptek); | 2140 | (void)aiptek_program_tablet(aiptek); |
2189 | if (aiptek->inputdev.absmax[ABS_X] > 0) { | 2141 | if (aiptek->inputdev->absmax[ABS_X] > 0) { |
2190 | info("input: Aiptek using %d ms programming speed\n", | 2142 | info("input: Aiptek using %d ms programming speed\n", |
2191 | aiptek->curSetting.programmableDelay); | 2143 | aiptek->curSetting.programmableDelay); |
2192 | break; | 2144 | break; |
2193 | } | 2145 | } |
2194 | } | 2146 | } |
2195 | 2147 | ||
2148 | /* Register the tablet as an Input Device | ||
2149 | */ | ||
2150 | input_register_device(aiptek->inputdev); | ||
2151 | |||
2152 | /* We now will look for the evdev device which is mapped to | ||
2153 | * the tablet. The partial name is kept in the link list of | ||
2154 | * input_handles associated with this input device. | ||
2155 | * What identifies an evdev input_handler is that it begins | ||
2156 | * with 'event', continues with a digit, and that in turn | ||
2157 | * is mapped to /{devfs}/input/eventN. | ||
2158 | */ | ||
2159 | list_for_each_safe(node, next, &inputdev->h_list) { | ||
2160 | inputhandle = to_handle(node); | ||
2161 | if (strncmp(inputhandle->name, "event", 5) == 0) { | ||
2162 | strcpy(aiptek->features.inputPath, inputhandle->name); | ||
2163 | break; | ||
2164 | } | ||
2165 | } | ||
2166 | |||
2196 | /* Associate this driver's struct with the usb interface. | 2167 | /* Associate this driver's struct with the usb interface. |
2197 | */ | 2168 | */ |
2198 | usb_set_intfdata(intf, aiptek); | 2169 | usb_set_intfdata(intf, aiptek); |
@@ -2207,6 +2178,12 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2207 | info("aiptek: error loading 'evdev' module"); | 2178 | info("aiptek: error loading 'evdev' module"); |
2208 | 2179 | ||
2209 | return 0; | 2180 | return 0; |
2181 | |||
2182 | fail2: usb_buffer_free(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, | ||
2183 | aiptek->data_dma); | ||
2184 | fail1: input_free_device(inputdev); | ||
2185 | kfree(aiptek); | ||
2186 | return -ENOMEM; | ||
2210 | } | 2187 | } |
2211 | 2188 | ||
2212 | /* Forward declaration */ | 2189 | /* Forward declaration */ |
@@ -2234,7 +2211,7 @@ static void aiptek_disconnect(struct usb_interface *intf) | |||
2234 | /* Free & unhook everything from the system. | 2211 | /* Free & unhook everything from the system. |
2235 | */ | 2212 | */ |
2236 | usb_kill_urb(aiptek->urb); | 2213 | usb_kill_urb(aiptek->urb); |
2237 | input_unregister_device(&aiptek->inputdev); | 2214 | input_unregister_device(aiptek->inputdev); |
2238 | aiptek_delete_files(&intf->dev); | 2215 | aiptek_delete_files(&intf->dev); |
2239 | usb_free_urb(aiptek->urb); | 2216 | usb_free_urb(aiptek->urb); |
2240 | usb_buffer_free(interface_to_usbdev(intf), | 2217 | usb_buffer_free(interface_to_usbdev(intf), |