2011-04-21 02:26:18     munmap error while interfacing uvc camera

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

2011-04-21 02:26:18     munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100054   

 

Hi,

 

I am using Logitech QuickCam E3500, with my BF527 board. I am also using 2010 R1 with trunk commit 9703 which provides non mmu support in the uvc driver.

 

When I try to do munmap to unmap the memory mapped via mmap I gat an 'Invalid Argument Error'.

 

According to the munmap manual this can be due to:

 

1. The start address is not a multiple of page size .........verified, in my case the page size is 4096 and the start address is a multiple of page size.

 

2. The length of the mapping is zero..........verified, the length was non zero.

 

3. The memory area to be unmapped is out of the processes address space......I tried doing munmap immediately after doing the mmap, and munmap still failed.

 

 

 

How can this issue be resolved?

 

Thanks.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-04-21 02:36:56     Re: munmap error while interfacing uvc camera

Sonic Zhang (CHINA)

Message: 100055   

 

This bug is fixed on SVN trunk kernel with commit 9703.

 

Please refer to bug   blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=6494&start=0

QuoteReplyEditDelete

 

 

2011-04-21 02:38:27     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100056   

 

Hello,

 

Could you give some detail steps, I need to reproduce this issue.

 

Which tool you used for testing ? luvcview or something else.

 

Thanks,

 

Bob

QuoteReplyEditDelete

 

 

2011-04-21 04:44:18     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100071   

 

Hi,

 

I used the code given at   v4l2spec.bytesex.org/spec/capture-example.html . It seems to be the standard test example for v4l2, as wherever I searched people used a modified form of it based on their needs.

 

 

 

The file is also attached.

 

 

 

Regards,

 

Shekhar

 

 

capture.c

QuoteReplyEditDelete

 

 

2011-04-21 04:53:34     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100075   

 

Hi,

 

I just wanted to add that I tried it with the QVGA - YUYV combination.

 

 

 

My output was the following:

 

 

 

................................................................................

 

....................munmap error 22, Invalid argument

 

 

 

That is....for each capture from the camera a ' . ' is printed on the screen. We can easily modify the code to write the frames to a file.

 

Thanks.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-04-21 08:04:50     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100084   

 

Hi,

 

I have also attached the files which I modified to implement commit 9703.....just in case.

 

 

 

Regards,

 

Shekhar

 

v4l2-dev.h

v4l2-dev.c

uvc_v4l2.c

uvc_queue.c

QuoteReplyEditDelete

 

 

2011-04-21 20:01:55     Re: munmap error while interfacing uvc camera

Ashish Gupta (INDIA)

Message: 100102   

 

Dear Bob,

 

Just wanted to clarify one thing, the above files that my colleague Chandrashekhar has added, were modified from 2010R1. So basically we are using 2010R1 distro and then we modified the above 4 files of 2010R1 by studying the changes implemented in svn 9703 thus backporting them to 2010R1.

 

For your replication of our error, you should start with 2010R1 and then replace with above 4 files.

 

regards

 

Ashish

QuoteReplyEditDelete

 

 

2011-04-21 23:05:59     Re: munmap error while interfacing uvc camera

Sonic Zhang (CHINA)

Message: 100110   

 

Could you attach a patch against 2010R1 other than files?

QuoteReplyEditDelete

 

 

2011-04-25 06:38:51     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100144   

 

Hi,

 

I have attached the patch generated against 2010R1.

 

The patch was generted by firing  ' svn diff ' inside folder uClinux-dist/linux-2.6.x

 

 

 

Regards,

 

Shekhar

 

2010R1_uvc_cam.patch

QuoteReplyEditDelete

 

 

2011-04-25 22:54:06     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100151   

 

I got error like this;

 

root:~> ./capture

uvcvideo: Failed to submit URB 0 (-90).

VIDIOC_STREAMON error 90, Message too long

root:~> uname -a

Linux blackfin 2.6.34.7-ADI-2010R1-svn9581 #467 Tue Apr 26 11:08:11 CST 2011 blackfin GNU/Linux

root:~>

QuoteReplyEditDelete

 

 

2011-04-25 23:23:53     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100152   

 

After change fmt from yuyv to mjepg in capture.c.

 

No more error.

 

root:~> ./capture

....................................................................................................root:~>

root:~>

root:~>

root:~> ./capture

....................................................................................................root:~>

root:~> version

kernel:    Linux release 2.6.34.7-ADI-2010R1-svn9581, build #467 Tue Apr 26 11:08:11 CST 2011

toolchain: bfin-uclinux-gcc release gcc version 4.3.5 (ADI-trunk/svn-4813)

user-dist: release svn-10106, build #145 Tue Apr 26 11:07:45 CST 2011

root:~>

QuoteReplyEditDelete

 

 

2011-04-26 03:27:02     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100162   

 

Hi Bob,

 

There is an issue in VGA capture, resulting in the error you faced, and I have started a thread on this forum regarding it. https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=45214&action=ForumBrowse&forum_id=39

 

 

 

Now I found this peculiar thing when I tried the capture example using QVGA.

 

 

 

1. I tried capturing QVGA frames in MJPEG format and got no error.

 

2. But, if I tried capturing the QVGA fames in YUYV format...then I got the munmap error. What can be the reason for this as it is affected by format change.?

 

 

 

I was using 2010R1-RC5 distribution with commit 9703.

 

I was using Logitech QuickCam E3500.

 

 

 

Regards,

 

Shekhar

 

QuoteReplyEditDelete

 

 

2011-04-26 03:47:01     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100163   

 

1. I have changed capture.c using fmt yuyv and 320x240 but I still can't reproduce this issue.

 

root:~> ./capture -d /dev/video0

select timeout

root:~>

 

Could you please attach the capture.c with QVGA fames in YUYV format ?

 

 

 

2. Please open the debug printk in file mm/nommu.c which should show why munmap fail.

QuoteReplyEditDelete

 

 

2011-04-26 09:23:22     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100167   

 

Hi Bob,

 

I have attached the capture.c file which uses YUYV in QVGA resolution.

 

I does give select timeout at times......you just need to run it again. This happens for MJPEG also .

 

Now as you said, I opened the debug printk in mm/nonmmu.c

 

I have attached the resultant /var/log/messages file . Please note that the snapshot of the /var/log/messages file was taken immediately after executing FDPIC binary corresponding to capture.c.

 

 

 

Since, I am using minicom ,the file was transfered from my BF527 based platform to my desktop using lsz .

 

 

 

Regards,

 

Shekhar

 

messages

capture.c

QuoteReplyEditDelete

 

 

2011-04-27 22:21:38     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100218   

 

Please try attached patch.

 

Thanks

 

0001-nommu-add-page_align-to-mmap.patch

QuoteReplyEditDelete

 

 

2011-04-28 06:56:18     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100254   

 

Hi Bob,

 

I applied the patch provided by you, but the issue is not resolved. I get the same error when I execute the capture.c code, with YUYV-QVGA combination.

 

Regards,

 

Shekhar

QuoteReplyEditDelete

 

 

2011-04-28 22:10:40     Re: munmap error while interfacing uvc camera

Bob Liu (CHINA)

Message: 100272   

 

It's strange.

 

In my test, after apply that patch the issue disappeared.

 

root:/> ./capture -d /dev/video0

select timeout

root:/> ./capture -d /dev/video0

....................................................................................................busize: 153600

busize: 153600

busize: 153600

busize: 153600

root:/> version

kernel:    Linux release 2.6.34.7-ADI-2010R1-svn9581, build #471 Fri Apr 29 10:21:15 CST 2011

toolchain: bfin-uclinux-gcc release gcc version 4.3.5 (ADI-trunk/svn-4813)

user-dist: release svn-10106, build #147 Fri Apr 29 10:20:44 CST 2011

root:/>

 

Would you please confirm that?

 

Thanks

QuoteReplyEditDelete

 

 

2011-04-29 03:21:28     Re: munmap error while interfacing uvc camera

Chandrashekhar Lavania (INDIA)

Message: 100292   

 

Hi Bob,

 

My mistake......it is working.

 

I guess , the patch you provided is for a trunk version as the patch command failed when I tried to do it on 2010-RC5 distribution.

 

I then manually made the changes to the mm/nommu.c file according to the patch. One thing which  was clear by looking at the patch was that the line numbers were different (I guess thats why the patch failed).

 

 

 

I think I made some mistake while doing the modification. I did the whole process again and re-built my image....Now it works fine.

 

 

 

Thanks a lot,

 

Regards,

 

Shekhar

Outcomes