The expanse of Rust-written kernel drivers for Linux continues. Posted to the Linux kernel mailing list is the first LED kernel driver written in the Rust programming language.
For Linux 6.18 merged was bindings for writing Rust USB drivers and a lot of other new Rust kernel code. Looking further out on the horizon, there’s even interest now in writing LED drivers in the Rust programming language.
Open-source developer Markus Probst posted the patch series on Wednesday for the first LED driver written in Rust. This isn’t a sample driver but rather a real driver targeting the atmega1608 microcontroller. The atmega1608 microcontroller is used by Synology NAS devices for controlling the LEDs on the device.
For getting this Rust LED driver up and running, the Rust code depends on a yet-to-be-upstreamed Rust i2c patches,m adding a Vec wrapper, adding LED class device abstractions for Rust, and related changes. Ultimately this “leds_atmega1608.rs” will allow the kernel to control LEDs on Synology devices via the i2c bus.
This Rust driver was created by analzing a C-based driver that Synology distributes as part of the GPL for their out-of-tree kernel code for their devices.
Those intrigued can learn more about this first Rust LED driver via the kernel mailing list.