Application Prospect and Preliminary Test Summary of USB Camera on android

Source: Internet
Author: User

USB Camera has been in our life for some years. Due to its ease of use, low price, and good performance, General cameras with USB interfaces are used in all aspects of work and life, for example, videophone, video chat, and normal video monitoring. However, USB Camera is rarely used in the vehicle-mounted industry. In the automotive industry, since the camera installation location is generally far away from the master, it is very difficult to use digital signals. Currently, most of them are analog signals, for example, if you convert the output signal of camera into a cvbs signal and then input it to the master, this path is feasible, but it is also very limited. One is definition and picture quality attenuation, it is conceivable that the overall effect will not be able to reach a level. With the advancement of technology, the consumer market is becoming more and more intense and needs to go further! At present, I want to develop USB Camera on android. USB Camera can collect high-definition signals and transmit them to the master through usb. Of course, usb cabling can also be relatively long. If the hardware is slightly enlarged, the cabling can meet the needs of vehicle-mounted vehicles, at least there is no problem with the rearview mirror. In theory, it should be able to solve the problem. I will show you how to apply USB Camera.

 


We all know that the underlying operating system kernel of android is based on linux. in linux, UVC (USB video class) is supported. First, you can open the configuration in the kernel and load the driver. In the kernel, UVC can be configured as the buildin mode, but it is better to be configured as a module for debugging convenience. The configuration is as follows:

[Python]
@-1561,6 + 1561,9 @ CONFIG_MEDIA_TUNER_MC44S803 = y
CONFIG_VIDEO_V4L2 = y
CONFIG_VIDEOBUF_GEN = m
CONFIG_VIDEOBUF_DMA_CONTIG = m
+ CONFIG_VIDEOBUF2_CORE = m
+ CONFIG_VIDEOBUF2_MEMOPS = m
+ CONFIG_VIDEOBUF2_VMALLOC = m
CONFIG_VIDEO_CAPTURE_DRIVERS = y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
@-, 7 + 1609,7 @@
CONFIG_VIDEO_HELPER_CHIPS_AUTO = y
# Miscelaneous helper chips
#
CONFIG_V4L_USB_DRIVERS = y
-# CONFIG_USB_VIDEO_CLASS is not set
+ CONFIG_USB_VIDEO_CLASS = m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV = y
CONFIG_USB_GSPCA = m
# CONFIG_USB_M5602 is not set

@-1561,6 + 1561,9 @ CONFIG_MEDIA_TUNER_MC44S803 = y
CONFIG_VIDEO_V4L2 = y
CONFIG_VIDEOBUF_GEN = m
CONFIG_VIDEOBUF_DMA_CONTIG = m
+ CONFIG_VIDEOBUF2_CORE = m
+ CONFIG_VIDEOBUF2_MEMOPS = m
+ CONFIG_VIDEOBUF2_VMALLOC = m
CONFIG_VIDEO_CAPTURE_DRIVERS = y
# CONFIG_VIDEO_ADV_DEBUG is not set
# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
@-, 7 + 1609,7 @@
CONFIG_VIDEO_HELPER_CHIPS_AUTO = y
# Miscelaneous helper chips
#
CONFIG_V4L_USB_DRIVERS = y
-# CONFIG_USB_VIDEO_CLASS is not set
+ CONFIG_USB_VIDEO_CLASS = m
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV = y
CONFIG_USB_GSPCA = m
# CONFIG_USB_M5602 is not set the loading driver has the following sequence requirements:

[Plain] view plaincopyprint? Insmod/system/vendor/modules/videobuf2-core.ko
Insmod/system/vendor/modules/videobuf2-memops.ko
Insmod/system/vendor/modules/videobuf2-vmalloc.ko
Insmod/system/vendor/modules/uvcvideo. ko

Insmod/system/vendor/modules/videobuf2-core.ko
Insmod/system/vendor/modules/videobuf2-memops.ko
Insmod/system/vendor/modules/videobuf2-vmalloc.ko
Insmod/system/vendor/modules/uvcvideo. ko
After the driver is loaded, insert the USB Camera file and check the video file generated under/dev. If no video file is generated, it indicates that it is not successful. Check whether the USB Camera supports uvc, of course, if you need some parameters, you have to write down the driver control of a specific device. Insert USB Camera printing and view the device file:

Print:

[Plain]
Root @ android:/# ls/dev/video *
 
/Dev/video0
/Dev/video1
Root @ android :/#
 
Root @ android :/#
 
Root @ android:/# [75.718597] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 336000
[80.103781] Line: 520: check_reset_complete
[2, 80.163617] usb 2-1: new high-speed USB device number 2 using sw-ehci
[80.223609] Line: 520: check_reset_complete
[80.441143] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45: 6341)
[80.472928] input: USB 2.0 Camera as/devices/platform/sw-ehci.1/usb2/2-1/2-. 0/input/input3
[81.118867] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 240000
[82.477074] init: waitpid returned pid 2776, status = 00000000
[82.483021] init: untracked pid 2776 exited
 
 
Root @ android :/#
 
Root @ android :/#
Root @ android:/# ls/dev/video *
[87.418713] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 144000
 
/Dev/video0
/Dev/video1
/Dev/video2
Root @ android :/#

Root @ android:/# ls/dev/video *

/Dev/video0
/Dev/video1
Root @ android :/#

Root @ android :/#

Root @ android:/# [75.718597] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 336000
[80.103781] Line: 520: check_reset_complete
[2, 80.163617] usb 2-1: new high-speed USB device number 2 using sw-ehci
[80.223609] Line: 520: check_reset_complete
[80.441143] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45: 6341)
[80.472928] input: USB 2.0 Camera as/devices/platform/sw-ehci.1/usb2/2-1/2-. 0/input/input3
[81.118867] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 240000
[82.477074] init: waitpid returned pid 2776, status = 00000000
[82.483021] init: untracked pid 2776 exited


Root @ android :/#

Root @ android :/#
Root @ android:/# ls/dev/video *
[87.418713] [fantasy] wrn dbs_check_cpu, 1227: try to switch cpu freq to 144000

/Dev/video0
/Dev/video1
/Dev/video2
Root @ android :/#
Next, let's modify the control of the camera hal layer of android, forcibly direct the device file to video2, that is, the device file of the USB Camera, replace the library file, and run the camera apk, let's take a look at the following results!

 

 

 

 

The basic path is running down, but there are still some problems, such as video recording and taking photos. The USB Camera controller uses SN9C259 and the sensor is NT99140, this may be the cause of some failed settings. We have to continue to follow up on these problems later. The journey is difficult, but I believe that the prospects are bright. Continue to cheer up!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.