Commit 4742a859 authored by Todd E. Johnson's avatar Todd E. Johnson Committed by Greg Kroah-Hartman

[PATCH] USB: mtouchusb update for 2.6.6-rc2

The attached patch for the 3M Touch Systems Capacitive controller.

Quick list of changes:

        *    Changed reset from standard USB dev reset to vendor reset
        *    Changed data sent to host from compensated to raw coordinates
        *    Eliminated vendor/product module params
        *    Performed multiple successfull tests with an EXII-5010UC

The changes are primarily due to comments from Vojtech Pavlik, as well
as making the newer EXII-50XXUC controllers work.

Thanks to 3M Touch Systems for sending me some new controllers to test with!

An updated HOWTO is also available at:


http://groomlakelabs.com/grandamp/code/microtouch/Linux-Input-USB-Touchscreen-HowTo.txt
parent 581dc32c
CHANGES CHANGES
- Created based off of scanner & INSTALL from the original touchscreen - 0.3 - Created based off of scanner & INSTALL from the original touchscreen
driver on freshmeat (http://freshmeat.net/projects/3mtouchscreendriver) driver on freshmeat (http://freshmeat.net/projects/3mtouchscreendriver)
- Amended for linux-2.4.18, then 2.4.19 - Amended for linux-2.4.18, then 2.4.19
- Complete rewrite using Linux Input in 2.6.3 - 0.5 - Complete rewrite using Linux Input in 2.6.3
Unfortunately no calibration support at this time Unfortunately no calibration support at this time
- 1.4 - Multiple changes to support the EXII 5000UC and house cleaning
Changed reset from standard USB dev reset to vendor reset
Changed data sent to host from compensated to raw coordinates
Eliminated vendor/product module params
Performed multiple successfull tests with an EXII-5010UC
DRIVER NOTES: SUPPORTED HARDWARE:
All controllers have the Vendor: 0x0596 & Product: 0x0001
Installation is simple, you only need to add Linux Input, Linux USB, and the
driver to the kernel. The driver can also be optionally built as a module.
If you have another MicroTouch device that you wish to experiment with Controller Description Part Number
or try using this driver with, but the Vendor and Product ID's are not ------------------------------------------------------
coded in, don't despair. If the driver was compiled as a module, you can
pass options to the driver. Simply try:
/sbin/modprobe mtouchusb vendor=0x#### product=0x**** USB Capacitive - Pearl Case 14-205 (Discontinued)
USB Capacitive - Black Case 14-124 (Discontinued)
USB Capacitive - No Case 14-206 (Discontinued)
If it works, send me the iVendor & iProduct (or a patch) and I will add... USB Capacitive - Pearl Case EXII-5010UC
USB Capacitive - Black Case EXII-5030UC
USB Capacitive - No Case EXII-5050UC
DRIVER NOTES:
Installation is simple, you only need to add Linux Input, Linux USB, and the
driver to the kernel. The driver can also be optionally built as a module.
This driver appears to be one of possible 2 Linux USB Input Touchscreen This driver appears to be one of possible 2 Linux USB Input Touchscreen
drivers. Although 3M produces a binary only driver available for drivers. Although 3M produces a binary only driver available for
...@@ -28,53 +40,28 @@ download, I persist in updating this driver since I would like to use the ...@@ -28,53 +40,28 @@ download, I persist in updating this driver since I would like to use the
touchscreen for embedded apps using QTEmbedded, DirectFB, etc. So I feel the touchscreen for embedded apps using QTEmbedded, DirectFB, etc. So I feel the
logical choice is to use Linux Imput. logical choice is to use Linux Imput.
A little info about the MicroTouch USB controller (14-206): Currently there is no way to calibrate the device via this driver. Even if
the device could be calibrated, the driver pulls to raw coordinate data from
Y is inverted, and the device has a total possible resolution of 0 - 65535. the controller. This means calibration must be performed within the
userspace.
Y is inverted by the driver by:
The controller screen resolution is now 0 to 16384 for both X and Y reporting
input.absmin[ABS_Y] = MTOUCHUSB_MAX_YC; the raw touch data. This is the same for the old and new capacitive USB
input.absmax[ABS_Y] = MTOUCHUSB_MIN_YC; controllers.
absmin & absmax are also used to scale the data, sine it is rather high Perhaps at some point an abstract function will be placed into evdev so
resolution. generic functions like calibrations, resets, and vendor information can be
requested from the userspace (And the drivers would handle the vendor specific
---------------touch screen area----------------- tasks).
I MicroTouch (xmax,ymax) @I
I X I ADDITIONAL INFORMATION/UPDATES/X CONFIGURATION EXAMPLE:
I ########visible monitor area############## I
I #@ (xmin,ymin) # I
I # # I
I # # I
I # # I
I # # I
I # # I
I Y # # I
I # # I
I # # I
I # # I
I # # I
I # # I
I # (xmax,ymax) @# I
I ########################################## I
I I
I@ MicroTouch (xmin,ymin) I
-------------------------------------------------
Currently there is no way to calibrate the device via this driver. Perhaps
at some point an abstract function will be placed into evdev so generic
functions like calibrations, resets, and vendor information can be requested
(And the drivers would handle the vendor specific tasks).
ADDITIONAL INFORMATION/UPDATES:
http://groomlakelabs.com/grandamp/code/microtouch/ http://groomlakelabs.com/grandamp/code/microtouch/
TODO: TODO:
Implement a control urb again to handle requests to and from the device Implement a control urb again to handle requests to and from the device
such as calibration, etc. such as calibration, etc once/if it becomes available.
DISCLAMER: DISCLAMER:
...@@ -83,3 +70,7 @@ this driver! If you want touch drivers only supported within X, please go to: ...@@ -83,3 +70,7 @@ this driver! If you want touch drivers only supported within X, please go to:
http://www.3m.com/3MTouchSystems/downloads/ http://www.3m.com/3MTouchSystems/downloads/
THANKS:
A huge thank you to 3M Touch Systems for the EXII-5010UC controllers for
testing!
...@@ -28,6 +28,12 @@ ...@@ -28,6 +28,12 @@
* Complete rewrite using Linux Input in 2.6.3 * Complete rewrite using Linux Input in 2.6.3
* Unfortunately no calibration support at this time * Unfortunately no calibration support at this time
* *
* 1.4 04/25/2004 (TEJ) tejohnson@yahoo.com
* Changed reset from standard USB dev reset to vendor reset
* Changed data sent to host from compensated to raw coordinates
* Eliminated vendor/product module params
* Performed multiple successfull tests with an EXII-5010UC
*
*****************************************************************************/ *****************************************************************************/
#include <linux/config.h> #include <linux/config.h>
...@@ -45,25 +51,28 @@ ...@@ -45,25 +51,28 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#define MTOUCHUSB_MIN_XC 0xc8 #define MTOUCHUSB_MIN_XC 0x0
#define MTOUCHUSB_MAX_XC 0xff78 #define MTOUCHUSB_MAX_XC 0x4000
#define MTOUCHUSB_XC_FUZZ 0x0 #define MTOUCHUSB_XC_FUZZ 0x0
#define MTOUCHUSB_XC_FLAT 0x0 #define MTOUCHUSB_XC_FLAT 0x0
#define MTOUCHUSB_MIN_YC 0x0 #define MTOUCHUSB_MIN_YC 0x0
#define MTOUCHUSB_MAX_YC 0xff78 #define MTOUCHUSB_MAX_YC 0x4000
#define MTOUCHUSB_YC_FUZZ 0x0 #define MTOUCHUSB_YC_FUZZ 0x0
#define MTOUCHUSB_YC_FLAT 0x0 #define MTOUCHUSB_YC_FLAT 0x0
#define MTOUCHUSB_ASYC_REPORT 1
#define MTOUCHUSB_REPORT_SIZE_DATA 11 #define MTOUCHUSB_ASYNC_REPORT 1
#define MTOUCHUSB_RESET 7
#define MTOUCHUSB_REPORT_DATA_SIZE 11
#define MTOUCHUSB_REQ_CTRLLR_ID 10 #define MTOUCHUSB_REQ_CTRLLR_ID 10
#define MTOUCHUSB_GET_XC(data) (data[4]<<8 | data[3]) #define MTOUCHUSB_GET_XC(data) (data[8]<<8 | data[7])
#define MTOUCHUSB_GET_YC(data) (data[6]<<8 | data[5]) #define MTOUCHUSB_GET_YC(data) (data[10]<<8 | data[9])
#define MTOUCHUSB_GET_TOUCHED(data) ((data[2] & 0x40) ? 1:0) #define MTOUCHUSB_GET_TOUCHED(data) ((data[2] & 0x40) ? 1:0)
#define DRIVER_VERSION "v0.1" #define DRIVER_VERSION "v1.4"
#define DRIVER_AUTHOR "Todd E. Johnson, tejohnson@yahoo.com" #define DRIVER_AUTHOR "Todd E. Johnson, tejohnson@yahoo.com"
#define DRIVER_DESC "Microtouch USB HID Touchscreen Driver" #define DRIVER_DESC "3M USB Touchscreen Driver"
#define DRIVER_LICENSE "GPL"
struct mtouch_usb { struct mtouch_usb {
unsigned char *data; unsigned char *data;
...@@ -76,11 +85,9 @@ struct mtouch_usb { ...@@ -76,11 +85,9 @@ struct mtouch_usb {
char phys[64]; char phys[64];
}; };
static __s32 vendor=-1, product=-1;
static struct usb_device_id mtouchusb_devices [] = { static struct usb_device_id mtouchusb_devices [] = {
{ USB_DEVICE(0x0596, 0x0001) }, /* 3M (Formerly MicroTouch) 14-206 */ { USB_DEVICE(0x0596, 0x0001) },
{ } /* Terminating entry */ { }
}; };
static void mtouchusb_irq(struct urb *urb, struct pt_regs *regs) static void mtouchusb_irq(struct urb *urb, struct pt_regs *regs)
...@@ -153,7 +160,7 @@ static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *m ...@@ -153,7 +160,7 @@ static int mtouchusb_alloc_buffers(struct usb_device *udev, struct mtouch_usb *m
{ {
dbg("%s - called", __FUNCTION__); dbg("%s - called", __FUNCTION__);
mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_SIZE_DATA, mtouch->data = usb_buffer_alloc(udev, MTOUCHUSB_REPORT_DATA_SIZE,
SLAB_ATOMIC, &mtouch->data_dma); SLAB_ATOMIC, &mtouch->data_dma);
if (!mtouch->data) if (!mtouch->data)
...@@ -167,7 +174,7 @@ static void mtouchusb_free_buffers(struct usb_device *udev, struct mtouch_usb *m ...@@ -167,7 +174,7 @@ static void mtouchusb_free_buffers(struct usb_device *udev, struct mtouch_usb *m
dbg("%s - called", __FUNCTION__); dbg("%s - called", __FUNCTION__);
if (mtouch->data) if (mtouch->data)
usb_buffer_free(udev, MTOUCHUSB_REPORT_SIZE_DATA, usb_buffer_free(udev, MTOUCHUSB_REPORT_DATA_SIZE,
mtouch->data, mtouch->data_dma); mtouch->data, mtouch->data_dma);
} }
...@@ -180,41 +187,8 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -180,41 +187,8 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
char path[64]; char path[64];
char *buf; char *buf;
int nRet; int nRet;
int ix;
char valid_device = 0;
dbg("%s - called", __FUNCTION__); dbg("%s - called", __FUNCTION__);
if (vendor != -1 && product != -1) {
info("%s - User specified USB Touch -- Vend:Prod - %x:%x",
__FUNCTION__, vendor, product);
}
for (ix = 0; ix < sizeof (mtouchusb_devices) /
sizeof (struct usb_device_id); ix++) {
if ((udev->descriptor.idVendor ==
mtouchusb_devices [ix].idVendor) &&
(udev->descriptor.idProduct ==
mtouchusb_devices [ix].idProduct)) {
valid_device = 1;
break;
}
}
if (udev->descriptor.idVendor == vendor &&
udev->descriptor.idProduct == product) { /* User specified */
valid_device = 1;
}
if (!valid_device) {
err("%s - No valid device!", __FUNCTION__);
return -EIO;
}
if (udev->descriptor.bNumConfigurations != 1) {
err("%s - Only one device configuration is supported.",
__FUNCTION__);
return -EIO;
}
dbg("%s - setting interface", __FUNCTION__); dbg("%s - setting interface", __FUNCTION__);
interface = intf->cur_altsetting; interface = intf->cur_altsetting;
...@@ -222,11 +196,6 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -222,11 +196,6 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
dbg("%s - setting endpoint", __FUNCTION__); dbg("%s - setting endpoint", __FUNCTION__);
endpoint = &interface->endpoint[0].desc; endpoint = &interface->endpoint[0].desc;
if (interface->desc.bNumEndpoints != 1) {
err("%s - Only one endpoint is supported.", __FUNCTION__);
return -EIO;
}
if (!(mtouch = kmalloc (sizeof (struct mtouch_usb), GFP_KERNEL))) { if (!(mtouch = kmalloc (sizeof (struct mtouch_usb), GFP_KERNEL))) {
err("%s - Out of memory.", __FUNCTION__); err("%s - Out of memory.", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
...@@ -266,8 +235,8 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -266,8 +235,8 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
mtouch->input.absmax[ABS_X] = MTOUCHUSB_MAX_XC; mtouch->input.absmax[ABS_X] = MTOUCHUSB_MAX_XC;
mtouch->input.absfuzz[ABS_X] = MTOUCHUSB_XC_FUZZ; mtouch->input.absfuzz[ABS_X] = MTOUCHUSB_XC_FUZZ;
mtouch->input.absflat[ABS_X] = MTOUCHUSB_XC_FLAT; mtouch->input.absflat[ABS_X] = MTOUCHUSB_XC_FLAT;
mtouch->input.absmin[ABS_Y] = MTOUCHUSB_MAX_YC; mtouch->input.absmin[ABS_Y] = MTOUCHUSB_MIN_YC;
mtouch->input.absmax[ABS_Y] = MTOUCHUSB_MIN_YC; mtouch->input.absmax[ABS_Y] = MTOUCHUSB_MAX_YC;
mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ; mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ;
mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT; mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT;
...@@ -290,15 +259,15 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -290,15 +259,15 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
kfree(buf); kfree(buf);
nRet = usb_control_msg(mtouch->udev, nRet = usb_control_msg(mtouch->udev,
usb_rcvctrlpipe(udev, 0x80), usb_rcvctrlpipe(udev, 0),
USB_REQ_GET_CONFIGURATION, MTOUCHUSB_RESET,
USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1,
0, 0,
0x81,
NULL, NULL,
0, 0,
HZ * USB_CTRL_SET_TIMEOUT); HZ * USB_CTRL_SET_TIMEOUT);
dbg("%s - usb_control_msg - USB_REQ_GET_CONFIGURATION - bytes|err: %d", dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
__FUNCTION__, nRet); __FUNCTION__, nRet);
dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__); dbg("%s - usb_alloc_urb: mtouch->irq", __FUNCTION__);
...@@ -315,7 +284,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -315,7 +284,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
mtouch->udev, mtouch->udev,
usb_rcvintpipe(mtouch->udev, 0x81), usb_rcvintpipe(mtouch->udev, 0x81),
mtouch->data, mtouch->data,
MTOUCHUSB_REPORT_SIZE_DATA, MTOUCHUSB_REPORT_DATA_SIZE,
mtouchusb_irq, mtouchusb_irq,
mtouch, mtouch,
endpoint->bInterval); endpoint->bInterval);
...@@ -324,15 +293,15 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -324,15 +293,15 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
input_register_device(&mtouch->input); input_register_device(&mtouch->input);
nRet = usb_control_msg(mtouch->udev, nRet = usb_control_msg(mtouch->udev,
usb_rcvctrlpipe(udev, 0x80), usb_rcvctrlpipe(udev, 0),
MTOUCHUSB_ASYC_REPORT, MTOUCHUSB_ASYNC_REPORT,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
MTOUCHUSB_ASYC_REPORT, 1,
MTOUCHUSB_ASYC_REPORT, 1,
NULL, NULL,
0, 0,
HZ * USB_CTRL_SET_TIMEOUT); HZ * USB_CTRL_SET_TIMEOUT);
dbg("%s - usb_control_msg - MTOUCHUSB_ASYC_REPORT - bytes|err: %d", dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
__FUNCTION__, nRet); __FUNCTION__, nRet);
printk(KERN_INFO "input: %s on %s\n", mtouch->name, path); printk(KERN_INFO "input: %s on %s\n", mtouch->name, path);
...@@ -383,9 +352,3 @@ module_exit(mtouchusb_cleanup); ...@@ -383,9 +352,3 @@ module_exit(mtouchusb_cleanup);
MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(vendor, "i");
MODULE_PARM_DESC(vendor, "User specified USB idVendor");
MODULE_PARM(product, "i");
MODULE_PARM_DESC(product, "User specified USB idProduct");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment