ryankurte / rust-streamdeck

libusb based driver for Elgato StreamDeck devices
Mozilla Public License 2.0
57 stars 24 forks source link

Connect via device path #24

Open glance- opened 1 year ago

glance- commented 1 year ago

To support multiple simultaneously connected streamdeck devices, I'd like to use udev rules which starts a per device application which uses this library.

Currently we instantiate the systemd service per pid, but I'd like to switch that over to per device instances. This way we can use systemd.resource-control to allow that process just a certain access profile.

To simplify this I'd love to see a StreamDeck connect_with_device method, which either takes a HidDevice or perferably just a path to the usb device, and then just checks which kind of streamdeck this is based on the pid it sees from the HidDevice.

We could do this dance in the application but I'd love to see this feature in the library.

ryankurte commented 1 year ago

howdy, there's already an API for connecting to a specific device by passing the vid/pid/serial, but it would be nice to have a similar approach using HidApi::open_path / would be happy to accept a PR!

(as an aside, you might like to consider a single/long running daemon with support for multiple devices and unix socket RPC calls you can invoke on udev events to prompt a connection, easier to scan and connect devices at application start and you're going to have to associate profiles and devices anyway. i haven't sorted out the scanning here yet, but, something like this)