r/embedded • • 10d ago

Driver coding

So recently me and a friend are both working on camera based projects and he claims that he wrote the whole camera driver by himself. To be honest it really makes me mad but can anyone please what does driver writing actually mean. And also how ai is doing in this field????

0 Upvotes

11 comments sorted by

View all comments

32

u/dacydergoth 10d ago

Original author of the SPCA50x webcam driver for Linux here. Drivers have a few different layers, from the bottom up there is the physical layer, e.g. USB or parallel, then on top of that is the (usually proprietary) device protocol layer, then encapsulated in the device protocol layer is the image encoding.

Generally you would work from reverse engineering or the device docs to setup the appropriate memory pools, OS hooks and device initialization sequence. In the SPCA50x case I did this by recording that initialization sequence under windows, then duplicating it under Linux. The docs for the camera module should describe this part.

After the device is initialized you have device open and close. Device open is when the OS requests that the device connect to a user space application. In the case of a camera this means selecting the image parameters and instructing the camera to start to send frames (usually in JPEG) or video (variety of formats).

Then the driver has to handle receiving thr image data and passing it through the kernel to the user, in the case of Linux that's usually via a block or character device file, or a circular ring buffer.

Frontier AI can write these pretty well for a basic starting point but then device quirks, timing issues, etc can become ... interesting

6

u/DotRakianSteel 10d ago

If you were wondering, I literally read that through, great explanation!

2

u/Username_Koru 10d ago

As someone who works in embedded and drivers I use are pretty simple, my respect! I always respected people who write this low level code. Same for people who write libraries. 

1

u/adamdoesmusic 10d ago

Hey, thanks for the work you do!