diff -Nur c3000_pre/linux/drivers/char/Config.in c3000_work/linux/drivers/char/Config.in --- c3000_pre/linux/drivers/char/Config.in 2004-12-06 16:38:50.000000000 +0900 +++ c3000_work/linux/drivers/char/Config.in 2004-12-06 16:41:03.000000000 +0900 @@ -166,6 +166,7 @@ fi bool ' SL-series touchscreen pressure value read (EXPERIMENTAL)' CONFIG_SL_TS_PRESSURE dep_bool ' Boot On touchscreen pressure value read' CONFIG_BOOT_PRESSURE_ON $CONFIG_SL_TS_PRESSURE + bool ' SL-series write ts data (EXPERIMENTAL)' CONFIG_SL_WRITE_TS if [ "$CONFIG_SERIAL_SL_SERIES" = "y" ]; then bool ' SL-series Bluetooth support' CONFIG_BLUETOOTH_SL fi diff -Nur c3000_pre/linux/drivers/char/ads7846_ts.c c3000_work/linux/drivers/char/ads7846_ts.c --- c3000_pre/linux/drivers/char/ads7846_ts.c 2004-12-06 16:38:50.000000000 +0900 +++ c3000_work/linux/drivers/char/ads7846_ts.c 2004-12-06 16:50:50.000000000 +0900 @@ -87,7 +87,7 @@ static int head, tail, sample; static char pendown = 0; static unsigned long Pressure; -#if defined(CONFIG_SL_TS_PRESSURE) +#if defined(CONFIG_SL_TS_PRESSURE) || defined(CONFIG_SL_WRITE_TS) #include #endif @@ -1000,6 +1000,24 @@ } #endif +/// write ts data +#if defined(CONFIG_SL_WRITE_TS) +static void write_new_data(TS_EVENT write_data) +{ + write_data.millisecs = jiffies; + tbuf[head++] = write_data; + + if (head >= BUFSIZE) { head = 0; } + + if (head == tail && ++tail >= BUFSIZE) { tail = 0; } + + if (fasync) + kill_fasync(&fasync, SIGIO, POLL_IN); + + wake_up_interruptible(&queue); +} +#endif + static void cotulla_main_ts_timer(unsigned long irq) { // ts_interrupt(irq, NULL, NULL); @@ -1346,10 +1364,54 @@ static ssize_t ts_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { #if defined(CONFIG_ARCH_PXA_CORGI) - unsigned long param; - char *endp; - wait_after_sync_hs = simple_strtoul(buffer, &endp, 0); - return count+endp-buffer; + char *endp; +#if defined(CONFIG_SL_WRITE_TS) + + static TS_EVENT data, raw_data; + char tmp[50]; + int len; + len=49; + if(len>count) len=count; + copy_from_user(tmp,buffer,len); + tmp[len]='\0'; + + if (sscanf(tmp,"%d %d %d %d",&data.pressure, &data.x, &data.y, &data.millisecs) == 4) { +// printk("pressure= %d : x= %d : y= %d : millosecs= %d\n", data.pressure, data.x, data.y, data.millisecs); + + if (cal_ok) { + raw_data.x = (x_rev) ? raw_max_x - ((raw_max_x - raw_min_x) * data.x) / res_x + : raw_min_x + ((raw_max_x - raw_min_x) * data.x) / res_x; + + raw_data.y = (y_rev) ? raw_max_y - ((raw_max_y - raw_min_y) * data.y) / res_y + : raw_min_y + ((raw_max_y - raw_min_y) * data.y) / res_y; + + } else { + raw_data.x = data.x; + raw_data.y = data.y; + } + + if (xyswap) { + short tmp = raw_data.x; + raw_data.x = raw_data.y; + raw_data.y = tmp; + } + + raw_data.pressure = data.pressure; + raw_data.millisecs = data.millisecs; + + write_new_data(raw_data); + return count; + + }else { +#endif + wait_after_sync_hs = simple_strtol(buffer, &endp, 0); + printk("Wait_after_sync_hs: %d\n",(int) wait_after_sync_hs); + return count+endp-buffer; + +#if defined(CONFIG_SL_WRITE_TS) + } +#endif + #else return 0; #endif