From a standalone perspective, it includes two parts: the sensor module and the core board; thus, the core of the driver software is to ensure the connection between the two, with common hardware interfaces being MIPI and USB, focusing on the PHY layer during MIPI interface debugging; the common software driver frameworks are V4L2 and UVC.
This chapter mainly introduces another type of camera driver, USB and UVC, as a supplement to the previous chapter:Camera Driver Development Basics – MIPI and V4L2
1. Camera USB Interface Protocol
The USB ISO protocol is suitable for real-time streaming data transmission; while the Bulk protocol is suitable for non-real-time transmission of large amounts of data.
Both protocols can be used in UVC, and they need to be adapted and switched according to specific usage scenarios.
In terms of software implementation, both rely on corresponding USB library functions and APIs while also retaining differences.
In Linux systems, the libusb library can be used to implement ISO transmission.
libusb provides functions such as <span>libusb_fill_iso_transfer()</span>
and <span>libusb_submit_transfer()</span>
to set up and submit ISO transfer requests.
In Android development, the Android USB Host API can be used to implement Bulk transmission. It provides functions such as <span>UsbDeviceConnection.bulkTransfer()</span>
to send and receive Bulk data packets.
Protocol | ISO Protocol | Bulk Protocol |
---|---|---|
Real-Time | Provides guaranteed bandwidth and interval time, with strong fault tolerance for streaming data transmission. | No strict requirements |
Bandwidth | Requires a constant data transmission rate, and packet loss will not interrupt | Waits for all other types of data transmission to complete before allocating bandwidth |
Data Integrity | Immediate data delivery is more important | Requires ensuring the integrity and correctness of transmission |
2. USB Hardware Interface
In the Android system Linux kernel, the USB controller supports USB 3.0 OTG functionality and is backward compatible with USB 2.0. The USB subsystem can also support the USB port as a peripheral function.
When USB is used as USB Host mode, the software can treat USB as OTG.
When used for USB ADB debugging, the D+/D- pins are used in USB 2.0 to provide a signal channel; at the same time, TX1/2 and RX1/2 provide a super-speed data link with up to 20Gbps bandwidth.

3. Driver Software Framework UVC
UVC (USB Video Class) framework is a protocol standard defined specifically for USB video capture devices, the entire UVC is still based on the USB framework, it defines how devices communicate with hosts, including video stream transmission, control command sending, etc., applied to external USB cameras.
Configure USB mode to ensure that Android devices support USB host mode and configure the corresponding USB interface and driver.
Driver development involves modifying and compiling the underlying Linux kernel, integrating the UVC driver into the Android system’s Linux kernel, and verifying correct identification and management of USB video devices.
When connecting a UVC device, code is written at the upper layer to enumerate and initialize the USB camera device, capturing and displaying video streams through APIs.
When a USB device is plugged into the system, it is first initially recognized by the USB bus driver, confirming it is a USB device, then reading the configuration descriptor to further confirm the device type;
When confirming it is a UVC device, the corresponding USB interface driver uvcvideo is called for matching and registration.

Summary
Once you understand the basic hardware driver interfaces, you will find it easier to understand the related software interface settings.
With the above knowledge, the actual work focus, in addition to some device tree and interface debugging during driver bringup, is mainly based on using the driver framework to provide relevant interfaces to the upper operating system HAL layer.