I have added another printk
printk(KERN_INFO "compute touch pressure resistance using equation #2 \n"); printk(KERN_INFO "z1=%d, z2=%d, x=%d, y=%d, x_plate_ohms=%d \n", z1, z2, x, y, ts->x_plate_ohms); Rt = z2; Rt -= z1; Rt *= x; Rt *= ts->x_plate_ohms; Rt /= z1; Rt = (Rt + 2047) >> 12;
the output:
<6>[ 49.927917] ads7846_report_state <6>[ 49.931304] compute touch pressure resistance using equation #2 <6>[ 49.937652] z1=8191, z2=8191, x=8191, y=8191, x_plate_ohms=180 <6>[ 49.943908] Rt 0 <6>[ 49.945922] not reporting. Rt=0 <6>[ 49.959045] ads7846_report_state <6>[ 49.962432] compute touch pressure resistance using equation #2 <6>[ 49.968749] z1=8191, z2=8191, x=8191, y=8191, x_plate_ohms=180 <6>[ 49.975006] Rt 0
Thanks Francesco
2012/2/15 Francesco Sarasini sarasini@gmail.com
Hi added the printk. this is my code
static void ads7846_report_state(struct ads7846 *ts) { struct ads7846_packet *packet = ts->packet; unsigned int Rt; u16 x, y, z1, z2;
/* added for debug */ printk(KERN_INFO "ads7846_report_state\n"); /* * ads7846_get_value() does in-place conversion (including byte swap) * from on-the-wire format as part of debouncing to get stable * readings. */ if (ts->model == 7845) { x = *(u16 *)packet->tc.x_buf; y = *(u16 *)packet->tc.y_buf; z1 = 0; z2 = 0; } else { x = packet->tc.x; y = packet->tc.y; z1 = packet->tc.z1; z2 = packet->tc.z2; } /* range filtering */ if (x == MAX_12BIT) x = 0; if (ts->model == 7843) { Rt = ts->pressure_max / 2; } else if (ts->model == 7845) { if (get_pendown_state(ts)) { Rt = ts->pressure_max / 2; } else { /* added for debug */ printk(KERN_INFO "cannot get pendown state \n"); Rt = 0; } dev_vdbg(&ts->spi->dev, "x/y: %d/%d, PD %d\n", x, y, Rt); } else if (likely(x && z1)) { /* compute touch pressure resistance using equation #2 */ /* added for debug */ printk(KERN_INFO "compute touch pressure resistance using equation
#2 \n"); Rt = z2; Rt -= z1; Rt *= x; Rt *= ts->x_plate_ohms; Rt /= z1; Rt = (Rt + 2047) >> 12; } else { /* added for debug */ printk(KERN_INFO "ts model ? %d \n", ts->model); Rt = 0; } /* added for debug */ printk(KERN_INFO "Rt %d \n", Rt);
/* * Sample found inconsistent by debouncing or pressure is beyond * the maximum. Don't report it to user space, repeat at least * once more the measurement */ if (packet->tc.ignore || Rt > ts->pressure_max) { /* added for debug */ printk(KERN_INFO "Ignored %d pressure %d \n", packet->tc.ignore,
Rt);
dev_vdbg(&ts->spi->dev, "ignored %d pressure %d \n", packet->tc.ignore, Rt); return; } /* * Maybe check the pendown state before reporting. This discards * false readings when the pen is lifted. */ if (ts->penirq_recheck_delay_usecs) { udelay(ts->penirq_recheck_delay_usecs); if (!get_pendown_state(ts)) { /* added for debug */ printk(KERN_INFO "cannot get pendown state \n"); Rt = 0; } } /* * NOTE: We can't rely on the pressure to determine the pen down * state, even this controller has a pressure sensor. The pressure * value can fluctuate for quite a while after lifting the pen and * in some cases may not even settle at the expected value. * * The only safe way to check for the pen up condition is in the * timer by reading the pen signal state (it's a GPIO _and_ IRQ). */ if (Rt) { struct input_dev *input = ts->input; if (ts->swap_xy) swap(x, y); if (!ts->pendown) { input_report_key(input, BTN_TOUCH, 1); ts->pendown = true; dev_vdbg(&ts->spi->dev, "DOWN\n"); } /* added for debug */ printk(KERN_INFO "input_report_abs x: %d, y: %d \n", x, y); input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, ts->pressure_max - Rt); input_sync(input); dev_vdbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); } else { /* added for debug */ printk(KERN_INFO "not reporting. Rt=%d \n", Rt); }
}
and the output after touching the screen
<6>[ 59.531036] ads7846_report_state <6>[ 59.534423] compute touch pressure resistance using equation #2 <6>[ 59.540771] Rt 0 <6>[ 59.542785] not reporting. Rt=0 <6>[ 59.553497] ads7846_report_state <6>[ 59.556884] compute touch pressure resistance using equation #2 <6>[ 59.563201] Rt 0 <6>[ 59.565216] not reporting. Rt=0 <6>[ 59.577087] ads7846_report_state <6>[ 59.580474] compute touch pressure resistance using equation #2 <6>[ 59.586791] Rt 0 <6>[ 59.588836] not reporting. Rt=0 <6>[ 59.850494] ads7846_report_state <6>[ 59.853881] compute touch pressure resistance using equation #2 <6>[ 59.860198] Rt 0 <6>[ 59.862213] not reporting. Rt=0
Thanks Francesco
2012/2/15 Francesco Sarasini sarasini@gmail.com
Thank you. My code base is Linaro Android. I will add the printk to the code
Francesco
2012/2/15 Bharathi Subramanian bharathi.list@gmail.com
On Tue, Feb 14, 2012 at 7:48 PM, Francesco Sarasini sarasini@gmail.com wrote:
Please add printk to show the value of x, y, before and after the OMAP3EVM macro. That will give better idea about the touchevent.
I'm sorry, where is the OMAP3EVM macro?
Oops. I hope, it is in EVM Code. For BB-xM, it might be different.
The following set of commands are responsible for sending the co-ordinates to user space. You have to add printk before this and check.
input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); input_report_abs(input, ABS_PRESSURE, ts->pressure_max - Rt);
Can you share info about code base (Rowboat/Linaro) ?
Bye :)
Bharathi Subramanian