I run OmniOS on an Aoostar WTR PRO as my NAS and for most of my self hosting needs. After installing a new fan, I wanted to see if I could read and control the fan speed from the OS instead of just the BIOS. Using Claude chat, I got a working kernel driver that gives me fan speed, PWM control, temperature readings, and even (incorrect) voltage readings.

I wanted to share as an example of what’s currently possible. I’ve even seen people vibe code ethernet drivers for freeBSD.

What do you all think of using LLMs to cobble together drivers like this?

  • litchralee@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    1
    ·
    9 hours ago

    I’ve even seen people vibe code ethernet drivers for freeBSD.

    Please make sure to read what considerations that developer had before undertaking that effort using an LLM: https://github.com/Aquantia/aqtion-freebsd/issues/32#issuecomment-3997341698

    Specifically, they (the human) were kept in the loop for the entire process, which included referencing the working Linux driver to do a clean-room reimplementation. This already means they have some experience with software engineering to spot any issues in the specifications that the LLM might generate.

    Also, Aquantia (before the merger) already had a published FreeBSD driver but it hasn’t been updated. So this port wouldn’t have to start from zero, but would be a matter of addition support for new NICs that have been released since, but Aquatia hadn’t updated the driver.

    This is very much not an example of an Ethernet NIC driver being “vibe coded” from scratch, but a seasoned engineer porting Linux support over to FreeBSD, a kernel that already has a lot of support for easily adding new drivers in a fairly safe manner, and then undertaking a test plan to make sure the changes wouldn’t be abject slop. That’s someone using their tools with reasonable care. In the industry, this is called engineering.

    Admiration for what people can do with the right tools must always be put into the right context. Even with the finest tools, it’s likely that neither you nor I could build a cathedral.

    • calamityjanitor@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 hours ago

      I used a very similar method in a similar situation to albb0920. They describe it as vibe coding too.

      The exact chip that handles everything is undocumented, but similar ones in the same series have datasheets. A maintained version of the linux driver handily collated all of the available datasheets and configurations used by different motherboards. Between that and my microcontroller/hardware experience, that side of things wasn’t too bad.

      What I didn’t know anything about was writing an Illumos driver. I used the chatbot with a free claude account, compiling and running the code manually myself. I was impressed that it was able to build out the boilerplate and get something going at all. Course it took a few tried to get something that compiled and worked somewhat correctly. At some points I needed to look through the generated code and point out exactly what what wrong, but at least it would address it.

      Code running in the context of the kernel is definitely not something I would have autonomously executing by a LLM. The end result is absolutely not something I would want put into the official Illumos source.

  • paper_moon@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 hours ago

    That’s awesome! Can you describe your set up for vibe coding this? I’d like to take a look at porting postmarketOS linux, or ubports to some phones I have laying around.

    • calamityjanitor@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 hours ago

      I just used the free chat with Claude, it created and tracked the files in its own webchat thingy. Being a kernel module, I was happy to manually check, copy/paste, compile, then run the code for each iteration.

      Porting postmarketOS to a phone sounds like it may require some amount of manual running and explaining results back to the chat. Ultimately the output only starts to get functional when it hits reality and needs to keep adapting to feedback.

      I wrote a blog on the process that more focuses on the journey and technical details of the controller chip.