Skip to content(if available)orjump to list(if available)

Writing a basic Linux device driver when you know nothing about Linux drivers

ahartmetz

> I also thought I’d message the vendor and ask them if they could share any specifications or docs regarding their protocol. To my surprise, Nanoleaf tech support responded to me within 4 hours, with a full description of the protocol that’s used both by the Desk Dock as well as their RGB strips.

How cool is that? Too many vendors still think that they have valuable intellectual property in such relative trivialities. And that handing out the specs freely helps their competitors more than themselves.

Teknoman117

I almost had that experience with one of the popular PC liquid cooling hardware vendors around 10 years ago.

I emailed them saying I'd be interested in developing drivers for their hardware for Linux as I was a happy customer and was immediately put in touch with one of the managers and their engineering team.

Made quite a bit of progress before the whole thing was shut down because one of their component vendors threatened them saying it'd be a breach of their contract with them.

Apparently that vendor sold a "datacenter" (non consumer) version of that hardware for which they charged a hefty license fee for the management software (which was Linux compatible).

Jokes on them, someone reverse engineered the whole thing with a USB analyzer years later and published it XD. (not me)

starkrights

I had the same reaction. Nano leaf is extremely cool for that.

baby_souffle

This has to put them in the top 0.01% of companies that make consumer electronics.

I can think of only a few companies that bother to publish any details... And most of them are focused on industrial customers where it isn't unreasonable to need certain protocol details for integration or even just compliance with certain regulatory systems.

Maybe things are changing?

I have noticed that some of the LED light controllers you see on AliExpress are leaning in to open firmware standards. 5 years ago, you bought the controller and had to flash your own firmware. Now, there's an option at checkout to select an open source firmware. Some even have a USB port built in for flashing!

ianlevesque

It’s a userspace USB HID driver in rust, which is honestly more interesting/applicable to me than a kernel driver, which is what I thought it meant from the title.

kblissett

I enjoyed this post, but I'm eager to hear what the next step would be for a real "production" userspace driver. Are these typically just daemons that are configured to run at start up? And then some configuration GUI communicates with it over a socket or something?

dabedee

I really enjoyed the way this post was written, i.e. it includes the code, how it was run, the false paths, etc. You almost get to live through the author's journey and how he figured out just enough to get something working.

shreddit

> Let’s run it again to make sure it was not a fluke!

I understood that reference

fracus

I wish this was done in C so I didn't have to learn Rust. But maybe it is time to learn Rust.

0xbadcafebee

I want to run FreeBSD on my laptop, but they don't have a [complete] driver for my wifi card. I've thought about diving into AI coding-assistant agents just to see if I could use one to finish throwing together a working driver... but figuring out the AI agents is frictiony enough that I'm leaving it be. (I'm not a VSCode user)

LorenDB

The author should probably have implemented support in OpenRGB instead to better benefit others, but this is cool nonetheless.

jonnypotty

Thanks for this. Good read and also kinda inspiring.

null

[deleted]