Sohrab Behdani :freebsd: on Nostr: I have a Brother HL-2140 printer that, for some reason, works properly only on ...
I have a Brother HL-2140 printer that, for some reason, works properly only on Windows. On GNU/Linux and macOS, printing images often results in a horrible dithering effect because of the rather broken CUPS driver.
Now that we're living in the age of AI, and with increasingly capable models available, I had a thought: I already have the Windows driver, and I have access to Gemini, so why not throw a ridiculously long prompt at it and ask it to figure out how the Windows driver works, reverse-engineer the protocol, and build a proper CUPS driver from scratch? :)
So that's exactly what I did.
I gave Gemini the Windows driver and a detailed reverse-engineering task, let it work through the problem, and started implementing and testing what it came up with.
The result was honestly better than I expected. I was fully prepared to receive a giant pile of questionable AI-generated code, but instead it produced something surprisingly clean and functional. There's still plenty of room for optimization and cleanup, of course, but the basic result is already quite promising.
The project is available here:
https://github.com/behdanisohrab/open-hl2140here's a side-by-side: the left side is the driver generated through the reverse-engineering process with Gemini, while the right side is the original CUPS driver.
It's a surprisingly good example of how AI can be used as an engineering tool rather than simply asking it to generate code and hoping for the best.
We'll see how far this rabbit hole goes.
#cups #linux #AI
Published at
2026-08-30 11:39:30 UTCEvent JSON
{
"id": "4cab29384176a42ee2cb23ec328765ea3b6736d732cef78dd35de3c671ac4f5c",
"pubkey": "cbcd47faf2c5cc0bdd7550144f356cbd5ff607356c3699ba0414eb923723e54c",
"created_at": 1788089970,
"kind": 1,
"tags": [
[
"t",
"linux"
],
[
"imeta",
"url https://media.bsd.cafe/bsdmmedia01/media_attachments/files/117/184/258/729/943/743/original/0cefc166dc16bb7d.jpg",
"m image/jpeg"
],
[
"proxy",
"https://mastodon.bsd.cafe/@sohrab/117184264280209817",
"web"
],
[
"t",
"cups"
],
[
"t",
"ai"
],
[
"proxy",
"https://mastodon.bsd.cafe/users/sohrab/statuses/117184264280209817",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://mastodon.bsd.cafe/users/sohrab/statuses/117184264280209817",
"pink.momostr"
],
[
"-"
]
],
"content": "I have a Brother HL-2140 printer that, for some reason, works properly only on Windows. On GNU/Linux and macOS, printing images often results in a horrible dithering effect because of the rather broken CUPS driver.\n\nNow that we're living in the age of AI, and with increasingly capable models available, I had a thought: I already have the Windows driver, and I have access to Gemini, so why not throw a ridiculously long prompt at it and ask it to figure out how the Windows driver works, reverse-engineer the protocol, and build a proper CUPS driver from scratch? :)\n\nSo that's exactly what I did.\n\nI gave Gemini the Windows driver and a detailed reverse-engineering task, let it work through the problem, and started implementing and testing what it came up with.\n\nThe result was honestly better than I expected. I was fully prepared to receive a giant pile of questionable AI-generated code, but instead it produced something surprisingly clean and functional. There's still plenty of room for optimization and cleanup, of course, but the basic result is already quite promising.\n\nThe project is available here:\nhttps://github.com/behdanisohrab/open-hl2140\n\nhere's a side-by-side: the left side is the driver generated through the reverse-engineering process with Gemini, while the right side is the original CUPS driver.\n\nIt's a surprisingly good example of how AI can be used as an engineering tool rather than simply asking it to generate code and hoping for the best.\n\nWe'll see how far this rabbit hole goes.\n\n#cups #linux #AI\nhttps://media.bsd.cafe/bsdmmedia01/media_attachments/files/117/184/258/729/943/743/original/0cefc166dc16bb7d.jpg\n",
"sig": "69e2e603af7e27bad5cae775e12601825931488da0c1c131aae511b2ec7213f401d67e6e147b2445f3dd6b1d38fd6ff5a919c27db9424d7b64570713c775c7fd"
}