poll function

Discussion in 'Embedded Systems and Microcontrollers' started by coolroose, Nov 4, 2011.

  1. coolroose

    Thread Starter New Member

    Aug 31, 2010
    16
    0
    I am stuck on implementing the poll method in the kernel code. how to set up the poll file operation for the parport device driver. I set up the irq function and hook_poll like this:

    irq_function(struct pp_adc *p)
    {
    p->irq_counter++;
    wake_up(p->wait_queue);
    }
    hook_poll(filp, wait)
    {
    mask = POLLIN | POLLNORMRD;
    struct pp_adc *p = filp->private data;
    poll_wait(filp, &p->wait_queue, wait);
    if (irq_counter > 0)
    {
    mask |= POLLBAND;
    }
    return mask;
    }
    I tried the poll method with various timeout values but the function always returns in 3-4 seconds saying that it detected traffic (input) on the pins even though the device is off. So I don't think I am doing it correctly. I could technically get this function to work by simply telling it to watch the ACK and return the mask value when detected. Is there a more refined method I could use? please help
     
Loading...