15 unstable releases (6 breaking)

0.7.0 Jun 16, 2024
0.5.0 Oct 15, 2023
0.4.1 Jul 12, 2023
0.2.4 Mar 4, 2023
0.2.2 Nov 7, 2022

#111 in Hardware support

Download history 7/week @ 2024-03-08 6/week @ 2024-03-15 55/week @ 2024-03-29 17/week @ 2024-04-05 9/week @ 2024-04-19 6/week @ 2024-04-26 116/week @ 2024-05-10 128/week @ 2024-05-17 20/week @ 2024-05-24 19/week @ 2024-05-31 20/week @ 2024-06-07 176/week @ 2024-06-14 20/week @ 2024-06-21

239 downloads per month

MPL-2.0 license

90KB
1.5K SLoC

elgato-streamdeck

Library for interacting with Elgato Stream Decks through hidapi. Heavily based on python-elgato-streamdeck and partially on streamdeck library for rust.

This library was made as a better designed alternative to streamdeck library for Rust. I just took code from both of the libraries and made it more so pleasant to use.

udev rules for Linux

If you're using systemd on your system, you might have to install udev rules to allow connecting to Stream Decks from userspace.

You can do that by using following command to copy included into repo 40-streamdeck.rules file into udev/rules.d/

cp 40-streamdeck.rules /etc/udev/rules.d/

And then reloading udev rules

sudo udevadm control --reload-rules

Unplugging and plugging back in the device should also help

You should also create group called "plugdev" and add yourself to it, so you get access to the devices. You also need to restart the user session to let user group changes to kick in

Example

// Create instance of HidApi
let hid = new_hidapi();

// List devices and unsafely take first one
let (kind, serial) = StreamDeck::list_devices(&hid).remove(0);

// Connect to the device
let mut device = StreamDeck::connect(&hid, kind, &serial)
    .expect("Failed to connect");

// Print out some info from the device
println!(
    "Connected to '{}' with version '{}'",
    device.serial_number().unwrap(),
    device.firmware_version().unwrap()
);

// Set device brightness
device.set_brightness(35).unwrap();

// Use image-rs to load an image
let image = open("no-place-like-localhost.jpg").unwrap();

// Write it to the device
device.set_button_image(7, image).unwrap();

// Flush
if device.updated {
    device.flush().unwrap();
}

Status

  • Convenient to use API for looking up devices, connecting to them and interacting with them
  • Reading buttons with async

Supported Devices

Support of the devices is the same as from libraries above, I personally tested Original v2 and Plus. I'll just keep updating this library to match upstream libraries.

But as it stands, this library should support following devices:

Dependencies

~10–22MB
~120K SLoC