Now imitate webcam (drivers/usb/gadget/webcam. C)
The Android usb (drivers/usb/gadget/Android. C) implements a UVC on Camera driver (added to the usb composite device array)
USB connected to the PC, the PC can be identified as uvc camera equipment,
USB output video applications, mainly refer to
http://git.ideasonboard.org/uvc-gadget.git/commit/9fbc003442056cdf59b87e94c1d0e3814575d4b3
And made some changes to
[for]
Data transmission is the basic process of the
Start data transfer
1. Apply to the drive for the four frame buffer (VIDIOC_REQBUFS)
2. Get the frame buffer information (VIDIOC_QUERYBUF), and will apply to the frame buffer is mapped to a user space
3. Fill 4 frame data, four frame buffer into drive queue (VIDIOC_QBUF)
4. Select monitor and wait for the device file "to write" state
5. Device files "to write", a queue in a frame buffer (VIDIOC_DQBUF)
6. To frame buffer fills a frame data
7. To the frame buffer into the queue (VIDIOC_QBUF)
Repeat step 5 to 7 consecutive data transmission
At present has been achieved, real-time acquisition of the camera image data in a row, after a USB in the PC display, (MJPEG)
PC software is AMCap
[the problem]
Now when the amount of data per frame keeping them in more than 500 KB, video can be continuous transmission, this is no problem,
But if the amount of data is lower than the more than 500 KB per frame, may transfer the 10 frames, after dozens of frames, stopped,
Timeout is found after the tracking code in the select side, both the select does not return "to write" state
Check this problem for a long time, always don't know what is reason,
Just contact USB the novice, please supervise your ace grant instruction! ~
CodePudding user response:
Select a timeout, get error code to try?CodePudding user response: