This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

touch screen

Other Parts Discussed in Thread: TSC2046, DM3730, ADS7846

hi.....

I'm using DM3730 with Linux PSP 04.02.00.07..... kernel version 2.6.37..... we have a custom board in which DM3730 uses USB HID to receive x-y coordinates from a micro controller ...this micro controller in-turn communicates with TSC2046 touchscreen controller to get the coordinates through SPI....

we r already able to receive the x-y cordinates from micro controller through USB HID on DM3730.. now the question is wat can i do with these coordinates.... how can i pass it to Linux OS component.. wat r the API's?

  we r able to receive touch data on /dev/hidraw0..... if do a cat /dev/hidraw0 and touch the screen i get some junk values... so i wrote a simple program to read the touch data from /dev/hidraw0...

pls guide me further...

  • Suhas,

    You can use the API  input_report_abs() to report the touch panel co-ordinates. Refer to standard touch panel drivers available,

     
  • hey here is the problem in using input_report_abs(), its a driver function, i'm not able to call it frm my userspace application.... here is my user space app code...

    #include <stdio.h>
    #include <linux/types.h>
    #include <fcntl.h>
    #include <linux/input.h>


    int main()

    {

    int fd;
    unsigned char buf[12]={0};
    int i=0;
    unsigned short x,y,x1,x2,y1,y2;

    while (1)
          {

           back:fd = open("/dev/hidraw0", O_RDONLY);
            if(fd < 0)
                {    
                printf("cant open /dev/hidraw0.....waiting for HID device...\n");    
                usleep(3*1000*1000);
                goto back;
                }
            
            read(fd, buf, sizeof(buf));
           
        
            x1 = buf[3];
            x2 = buf[4];
            x2 = x2 << 8;
            x= x2+x1;

            y1 = buf[5];
            y2 = buf[6];
            y2 = y2 << 8;
            y= y2+y1;
        
            printf("x=0x%X\t y=0x%X\n\n",x,y);
            close(fd);
            
          }

    }

    here is the output....

    x=0x7D0  y=0x6BB
    x=0x7D3  y=0x6AA

    x=0x7CE  y=0x6AA

    so i have my co-ordinates.. how can i use it with input_report_abs() , which is in touchscreen driver code ads7846.c

  • Suhas,

    Why do you need a userspace touch screen driver, when you can easily manage with a kernel driver?

  • can any one explain how is the flow in hidraw.c driver..... i want to know the sequence of events that happens in this driver when we receive data through a hidraw device.....

    i want to know in which variable(buffer) will the data recevied from hid device willl be stored??? i want to print that buffer to make sure im receiving right data and go on with further processing on it....

    i think the received data is stored in the following buffer...but not sure . pls help me...... 

    1. hid_get_raw_report(dev, report_number, buf, count, report_type) which is called in the function
     hidraw_get_report()
    im i right....??????? pls help..