2011-01-15 05:08:51     Help: Close /dev/video failed!

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-01-15 05:08:51     Help: Close /dev/video failed!

HappyBlackfin Blackfin (CHINA)

Message: 97467   

 

Process: BF561 0.5

 

uClinux: 2009R1RC4

 

source code1:

 

int devfd;

 

devfd = open("/dev/video0",O_RDWR);

 

......

 

//do_mmap & other

 

....

 

//capture one frame

 

while (ioctl(devfd, VIDIOCSYNC, &frame_id) < 0 &&

                   (errno == EAGAIN || errno == EINTR));

  ptr = vbuf + vmbuf.offsets[frame_id];

  memcpy(pix_buf, ptr, frame_size);

  close(devfd);

 

........

 

I add some printk to bcap_close function in blackfin_cam.c as below:

 

static int bcap_close(struct inode *inode, struct file *filp)

{

    struct ppi_device_t *pdev = bcap_dev->ppidev;

    printk("<0>bcap_close called\n");

 

...........

 

}

 

But not display the "bcap_close called" message.

 

But when the application program exit, then the "bcap_close called" show.

 

Why? How to close the video device in application space?

 

BR!

 

source code 2:

 

.......

 

devfd = open("/dev/video0",0_RDWR);

 

close(devfd);

 

then the "bcap_close called" show.

QuoteReplyEditDelete

 

 

2011-01-16 19:05:39     Re: Help: Close /dev/video failed!

HappyBlackfin Blackfin (CHINA)

Message: 97481   

 

View the source code blackfin_cam.c

 

1. v4l_ioctl no the VIDEOCSTOPSTREAM.

 

2. the blackfin_cam.c for V4L no the munmap function.

 

How to implement ?

QuoteReplyEditDelete

 

 

2011-01-16 20:01:19     Re: Help: Close /dev/video failed!

HappyBlackfin Blackfin (CHINA)

Message: 97482   

 

munmap is system function.

QuoteReplyEditDelete

 

 

2011-01-16 21:36:46     Re: Help: Close /dev/video failed!

HappyBlackfin Blackfin (CHINA)

Message: 97485   

 

using munmap then close /dev/video0 successful.

QuoteReplyEditDelete

 

 

2011-01-16 22:18:52     Re: Help: Close /dev/video failed!

Mike Frysinger (UNITED STATES)

Message: 97486   

 

if you dont release all references to the fd before the close, then the behavior you describe is expected

QuoteReplyEditDelete

Attachments

    Outcomes