Opening And Closing The Capture Device
Prev | Chapter 3. Video Capture Devices | Next

## Opening And Closing The Capture Device

    static int users = 0;

    static int camera_open(struct video_device *dev, int flags)
    {
            if(users)
                    return -EBUSY;
            if(request_irq(irq, camera_irq, 0, "camera", dev)<0)
                    return -EBUSY;
            users++;
            return 0;
    }

    static int camera_close(struct video_device *dev)
    {
            users--;
            free_irq(irq, dev);
    }

The open and close routines are also quite similar. The only real change is that we now request an interrupt for the camera device interrupt line. If we cannot get the interrupt we report EBUSY to the application and give up.

Prev | Up | Next
Registering Video Capture Devices | Home | Interrupt Handling