Add a touch screen driver to the kernel (suitable for other devices)

Source: Internet
Author: User

I recently made a device driver for the 2.6.13 kernel and now wrote it to the "Touch Screen". My reference method is as follows:
(Let's take a look)
The S3C2410 driver is not provided in linux2.6.14, so we need to create a new driver file.
Create a new hfrk_s3c2410_ts.c file in the linux2.6.14/Drivers/input/touchscreen directory.
You can refer to similar Touch Screen drivers. For more information, see the source code provided by the website or CD.
First, we need to modify the MAKEFILE file in the linux2.6.14/Drivers/input/touchscreen directory and add the following at the end of the file:
OBJ-$ (config_touchscreen_s3c2410) + = hfrk_s3c2410_ts.o
Second, we need to modify linux2.6.14/Drivers/input/touchscreen/kconfig to add:
Config touchscreen_s
Tristate "Samsung S3C2410 touchscreen input driver"
Depends on arch_smdk2410 & input & input_touchscreen
Select Serio
Help
Say y here if you have the S3C2410 touchscreen.
If unsure, say n.
To compile this driver as a module, choose m here:
Module will be called s3c2410_ts.
Config touchscreen_s3c2410_debug
Boolean "Samsung S3C2410 touchscreen debug messages"
Depends on touchscreen_s3c2410
Help
Select this if you want debug messages
After the modification is complete, we will add the touch screen configuration of the relation S3C2410 When configuring the kernel. we can add the driver by selecting these configurations.
Device Drivers-à
Input Device Support à
Touchscreensà
Samsung S3C2410 touchscreen input driver
[] Samsung S3C2410 touchscreen debug message
Third: add the following content in/linux-2.6.14/ARCH/ARM/mach-s3c2410/mach-smdk2410.c:
Static struct s3c2410_ts_mach_info sbc2410_ts_cfg _ initdata = {
. Delay= 10000,
. Presc = 49,
. Oversampling_shift = 2,
};
In the smdk2410_devices structure, add:
& Amp; cloud_device_ts,
Add the following to the smdk2410_map_io function:
Set_s3c2410ts_info (& sbc2410_ts_cfg );
Fourth: In the/linux-2.6.14/arch/arm/mach-s3c2410/devs. h file to add:
Extern struct platform_device initi_device_ts;
Fifth: Add the following lines in the arch/arm/mach-s3c2410/devs. c file:
/* Touchscreen */
Static struct s3c2410_ts_mach_info s3c2410ts_info;
Void _ init set_s3c2410ts_info (struct s3c2410_ts_mach_info * hard_s3c2410ts_info)
{
Memcpy (& s3c2410ts_info, hard_s3c2410ts_info, sizeof (struct s3c2410_ts_mach_info ));
}
EXPORT_SYMBOL (set_s3c2410ts_info );
Struct platform_device initi_device_ts = {
. Name = "s3c2410-ts ",
. Id =-1,
. Dev = {
. Platform_data = & s3c2410ts_info,
}
};
EXPORT_SYMBOL (initi_device_ts );
After these modifications, our touch screen driver has been completed and we can compile it. Our touch screen driver is registered as/dev/input/mouse0 in the kernel.
Please help me check the problem and give your comments.
OK !!! So far, the following information has been displayed in my startup information:
S3c2410 TouchScreen successfully loaded, and the device file/dev/input/mouse0 can also be generated.
My touch screen prints information in the kernel, and the data is correct. The touch screen driver should be good, but I still don't know where the 2.6 kernel and the test program interface are, what is the original
The fileoprition structure disappears, and the touch screen driver hangs onto the BUS... where can I transfer my data to the upper-layer test program ??? Where can I
There is a corresponding read, write, and function. Where can I write data to the buff .....??? My current test program cannot read the correct value from the device file. It should be a lower-level driver up
An error occurred while passing the test program at the layer, but I cannot find the interface location.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.