I am new to Linux Drivers Programming. I have been reading Linux Device Drivers book and looking at the source code for various examples in that book and have a decent understanding of the basics. However, I get confused once buses enter into the picture. I am not entirely sure as to how the message transits through various buses in the system to reach the terminal device. What mechanism and interfaces in the kernel comes into play.
For example, for the diagram above lets consider how a write would happen to the webcam in the above picture. Disregarding the knitty gritty details, here is my understanding of it (I will start from the part where webcam usb driver write routine gets data buffer which is to be written to webcam)
- Webcam USB driver write routine invoked with data
- In the webcam usb driver write routine, a usb message is prepared and usb write api invoked on the device
After 2 I am confused as to how the kernel would transfer a usb message over the PCI bus all the way to the USB device (these are two different buses). Not sure where along the way the message is first encoded into a PCI message and how transit happens from PCI bus to USB.
I have also tried reading linux driver model documentation to get an answer here: https://www.kernel.org/doc/html/latest/driver-api/driver-model/index.html. I think I understand the driver model at a high level but still haven’t been able to find an answer to my question (perhaps I overlooked some piece of information).
Any help would be appreciated!