Dear All:
I have to thank the android zaurus's author. he help me very much
on the touchscreen driver. thank you very much, android zaurus san.
Best Regards,
Akio
On 4月5日, 下午3時58分, Akio <[EMAIL PROTECTED]> wrote:
> Dear All:
>
> The following is the modified mxc_ts.c for mx27 touchscreen driver for
> android m3. not very well done one. and may be have some potential
> bug. If some one found, please tell me, I'll and the fixed code into
> mxc_ts.c. Right now, It is the very early version. It just work under
> webkit browser and google map. The two major test items I already
> test. the behavior is like double click not one touch. Would some one
> else can show me how to make one touch work? BTW, the position which
> reported from touchscreen seems have much noise, how to reduce the
> noise? the second thing I didn't understand is that I can't use
> touchscreen to select menu item when android gui shown on LCD screen.
> Does any one know how to fix this problem for android m3 or just
> android m3's item menu doesn't support touchscreen (I think this is
> impossible. :) )
>
> I think i.mx31's touchscreen driver can be applied with a little
> modification. Or some one is kind of to show the full function
> touchscreen driver of mx31? Any question is welcome.
>
> Best Regards,
> Akio
>
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/sched.h>
> #include <linux/input.h>
> #include <linux/init.h>
> #include <linux/delay.h>
> #include <linux/freezer.h>
> #include <linux/platform_device.h>
> #include <asm/arch/pmic_external.h>
> #include <asm/arch/pmic_adc.h>
>
> #ifdef CONFIG_ANDROID_POWER
> #define X_AXIS_MAX 1000
> #define X_AXIS_MIN 80
> #define Y_AXIS_MAX 1000
> #define Y_AXIS_MIN 80
> #define PRESSURE_MIN 0
> #define PRESSURE_MAX 1
> #endif
>
> static struct input_dev *mxc_inputdev = NULL;
> static u32 input_ts_installed;
>
> static char MXC_TS_NAME[] = "mxc_ts\0";
> static char MXC_TS_PHYS[] = "mxc_ts/input1\0";
>
> static int ts_thread(void *arg)
> {
> t_touch_screen ts_sample;
> s32 wait = 0;
>
> daemonize("mxc_ts");
> while (input_ts_installed) {
> try_to_freeze();
> memset(&ts_sample, 0, sizeof(t_touch_screen));
> pmic_adc_get_touch_sample(&ts_sample, !wait);
>
> if((ts_sample.x_position >= X_AXIS_MIN) &&
> (ts_sample.x_position <= X_AXIS_MAX) &&
> (ts_sample.y_position >= Y_AXIS_MIN) &&
> (ts_sample.y_position <= Y_AXIS_MAX)){
> input_report_abs(mxc_inputdev, ABS_X, ts_sample.x_position);
> input_report_abs(mxc_inputdev, ABS_Y, ts_sample.y_position);
> input_report_abs(mxc_inputdev, ABS_PRESSURE,
> ts_sample.contact_resistance);
> input_report_key(mxc_inputdev, BTN_TOUCH, 1);
> input_sync(mxc_inputdev);} else {
>
> input_report_key(mxc_inputdev, BTN_TOUCH, 0);
> input_sync(mxc_inputdev);}
>
> wait = ts_sample.contact_resistance;
> msleep(20);
>
> }
>
> return 0;
>
> }
>
> static int mxc_ts_open(struct input_dev *input)
> {
> printk("mxc_ts input touchscreen interface open\n");
>
> return 0;
>
> }
>
> static void mxc_ts_close(struct input_dev *input)
> {
> printk("mxc_ts input touchscreen interface close\n");
>
> return;
>
> }
>
> static int mxcts_probe(struct platform_device *pdev)
> {
> printk("mxc_ts input touchscreen interface probe\n");
>
> return 0;
>
> }
>
> static int mxcts_remove(struct platform_device *pdev)
> {
> printk("mxc_ts input touchscreen interface remove\n");
>
> return 0;
>
> }
>
> static int mxcts_suspend(struct platform_device *dev)
> {
> printk("mxc_ts input touchscreen interface suspend\n");
>
> return 0;
>
> }
>
> static int mxcts_resume(struct platform_device *dev)
> {
> printk("mxc_ts input touchscreen interface resume\n");
>
> return 0;
>
> }
>
> static struct platform_driver mxcts_driver =
> {
> .driver = {
> .name = MXC_TS_NAME,
> .bus = &platform_bus_type,},
>
> .probe = mxcts_probe,
> .remove = mxcts_remove,
> .suspend = mxcts_suspend,
> .resume = mxcts_resume,
>
> };
>
> static int __init mxc_ts_init(void)
> {
> mxc_inputdev = input_allocate_device();
> if (!mxc_inputdev) {
> printk(KERN_ERR "mxc_ts_init: not enough memory for input device\n");
> return -ENOMEM;
>
> }
>
> mxc_inputdev->name = MXC_TS_NAME;
> mxc_inputdev->phys = MXC_TS_PHYS;
> mxc_inputdev->id.bustype = BUS_HOST;
> mxc_inputdev->open = mxc_ts_open;
> mxc_inputdev->close = mxc_ts_close;
> mxc_inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
> mxc_inputdev->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
> input_set_abs_params(mxc_inputdev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0,
> 0);
> input_set_abs_params(mxc_inputdev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0,
> 0);
> input_set_abs_params(mxc_inputdev, ABS_PRESSURE, PRESSURE_MIN,
> PRESSURE_MAX, 0, 0);
> input_register_device(mxc_inputdev);
>
> input_ts_installed = 1;
> kernel_thread(ts_thread, NULL, CLONE_VM | CLONE_FS);
> platform_driver_register(&mxcts_driver);
> printk("mxc input touchscreen loaded\n");
>
> return 0;
>
> }
>
> static void __exit mxc_ts_exit(void)
> {
> input_ts_installed = 0;
> msleep(20);
>
> input_unregister_device(mxc_inputdev);
>
> if (mxc_inputdev) {
> input_free_device(mxc_inputdev);
> mxc_inputdev = NULL;
>
> }
>
> platform_driver_unregister(&mxcts_driver);
>
> }
>
> late_initcall(mxc_ts_init);
> module_exit(mxc_ts_exit);
>
> MODULE_DESCRIPTION("MXC input touchscreen driver");
> MODULE_AUTHOR("Freescale Semiconductor, Inc.");
> MODULE_LICENSE("GPL");
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Internals" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-internals?hl=en
-~----------~----~----~----~------~----~------~--~---