Hi all, this is my problem. I have written a ts driver for my ADS7843 + et057003dh6 ts as a input device: this is my driver: static unsigned short __read_spi(unsigned char inreg) { unsigned char i; unsigned char mask = 0x80; unsigned short res = 0; inreg |= 0x80; // S bit always high CS_L; udelay(50); ((inreg & mask) ? DIN_H : DIN_L); udelay(__U_DELAY); for (i = 0; i < 8; i++) { DCLK_H; udelay(__U_DELAY); DCLK_L; mask >>= 1; ((inreg & mask) ? DIN_H : DIN_L); udelay(__U_DELAY); } DIN_L; for (i = 0; i < 16; i++) { DCLK_H; if (IS_DOUT_H) res |= 0x01; res <<= 1; udelay(__U_DELAY); DCLK_L; udelay(__U_DELAY); } CS_H; return (res >> 4); //return ((res & 0x7fff) >> 3); // real }
static irqreturn_t button_interrupt(int irq, void *dev, struct pt_regs *regs) { int absx = 0, absy = 0; unsigned short retdebug = 0; absx = retdebug = __read_spi(READ_X); DBG(ET05700x_DEBUG_INT,"%s:READ_X = 0x%02x,0x%04x\n",button_dev- >name,READ_X,retdebug); absy = retdebug = __read_spi(READ_Y); DBG(ET05700x_DEBUG_INT,"%s:READ_Y = 0x%02x,0x%04x\n",button_dev- >name,READ_Y,retdebug); // input_report_key(button_dev, BTN_1, 0); input_report_key(button_dev, BTN_TOUCH, 1); input_report_abs(button_dev, ABS_X, absx); input_report_abs(button_dev, ABS_Y, absy); input_sync(button_dev); return IRQ_HANDLED; } static int __init button_init(void) { // Name referred to slave devices ads7843 //BEGIN setting the I/O ports // DCLK ctrl_outw(ctrl_inw(PFCRH4) & ~0x0010 ,PFCRH4 ) ; /* PF29 set as I/O port */ ctrl_outw(ctrl_inw(PFIORH) | 0x2000 ,PFIORH ) ; /* PF29 set as out port */ // CS ctrl_outw(ctrl_inw(PFCRH3) & ~0x0001 ,PFCRH3 ) ; /* PF24 set as I/O port */ ctrl_outw(ctrl_inw(PFIORH) | 0x0100 ,PFIORH ) ; /* PF24 set as out port */ // DIN ctrl_outw(ctrl_inw(PFCRH4) & ~0x0001 ,PFCRH4 ) ; /* PF28 set as I/O port */ ctrl_outw(ctrl_inw(PFIORH) | 0x1000 ,PFIORH ) ; /* PF28 set as out port */ // DOUT ctrl_outw(ctrl_inw(PFCRH3) & ~0x1000 ,PFCRH3 ) ; /* PF27 set as I/O port */ ctrl_outw(ctrl_inw(PFIORH) & ~0x0800 ,PFIORH ) ; /* PF27 set as input port */ // BUSY ctrl_outw(ctrl_inw(PECRL4) & ~0x3000 ,PECRL4 ) ; /* PE15 set as I/O port */ ctrl_outw(ctrl_inw(PEIORL) & ~0x8000 ,PEIORL ) ; /* PE15 set as input port */ CS_H; DCLK_L; DIN_L; //END setting I/O ports button_dev = input_allocate_device(); if (!button_dev) return -ENOMEM; button_dev->name = "et057003dh6_ts"; button_dev->phys = "/dev/input/event0"; // button_dev->evbit[0] = BIT(EV_KEY); // button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); button_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); button_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); button_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); button_dev->absmin[ABS_X] = ET057003DH6_TS_ABS_X_MIN; button_dev->absmin[ABS_Y] = ET057003DH6_TS_ABS_Y_MIN; button_dev->absmax[ABS_X] = ET057003DH6_TS_ABS_X_MAX; button_dev->absmax[ABS_Y] = ET057003DH6_TS_ABS_Y_MAX; input_register_device(button_dev); if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { PRINTK(KERN_ERR "button.c: Can't allocate irq %d\n", BUTTON_IRQ); input_unregister_device(button_dev); return -EBUSY; } DBG(ET05700x_DEBUG_FUNC,"%s:initialized\n",button_dev->name); return 0; } static void __exit button_exit(void) { input_unregister_device(button_dev); free_irq(BUTTON_IRQ, button_interrupt); } module_init(button_init); module_exit(button_exit); MODULE_AUTHOR("Fabio Giovagnini <fabio.giovag...@aurion-tech.com>"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); well, my application does the follwing: int version=0; fd = -1; struct input_devinfo device_info; if ((fd = open(devname,O_RDONLY | O_NONBLOCK)) < 0) { PRINTF("version = %d \n",version); return 0; } else { PRINTF("%s open successfully.\n",devname); } ioctl(fd,EVIOCGVERSION,&version); PRINTF("version = %d \n",version); PRINTF("evdev driver version is %d.%d.%d\n",version >> 16, (version >> 8) & 0xff, version & 0xff); //geting info from device ioctl(fd,EVIOCGID,&device_info); printf("vendor 0x%04hx product 0x%04hx version 0x%04hx is on ?\n", device_info.vendor, device_info.product, device_info.version); . . . fd_set readfds; struct timeval to; int r; size_t rb; /* the events (up to 64 at once) */ #define EVLEN_BFF 5 #define NUM_MIN_EV (EVLEN_BFF - 1) struct input_event ev[EVLEN_BFF]; int yalv; int nReadEv; // number of read events unsigned long xAbsAvarage = 0; unsigned long yAbsAvarage = 0; if (fd < 0) return 0; FD_ZERO(&readfds); FD_SET(fd, &readfds); to.tv_sec = 0; to.tv_usec = 1000; r = select(FD_SETSIZE, &readfds, NULL, NULL, &to); if (r <= 0) { PRINTF("ts 1\n"); return 0; } rb=read(fd,ev,sizeof(struct input_event)*EVLEN_BFF); if (rb < (int) sizeof(struct input_event)) { PRINTF("ts 2\n"); return 0; } nReadEv = (int) (rb / sizeof(struct input_event)); if (nReadEv < NUM_MIN_EV) return 0; . . . . The behaviour is: I press the touch and I get printk infos properly form my driver and evbug moduls; but even if i open O_NONBLOCK my device i can really read infos from the kernel only when I release my finger from then ts It seems O_NONBLOCK doesn't work on evdev. Any suggestions? Thanks in advance -- Fabio Giovagnini Aurion s.r.l. P.I e C.F. 00885711200 Tel. +39.051.594.78.24 Cell. +39.335.83.50.919 _______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev