├── .gitignore ├── .travis.yml ├── 40-streamdeck.rules ├── Cargo.lock ├── Cargo.toml ├── LICENSE.txt ├── README.md ├── icons ├── camera.png ├── keyboard.png ├── mouse.png ├── power.png └── windows.png └── src ├── images.rs ├── info.rs ├── lib.rs └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | *.iml 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | cache: cargo 3 | env: 4 | - TARGET=x86_64-unknown-linux-gnu 5 | addons: 6 | apt: 7 | packages: 8 | - libusb-1.0 9 | - libusb-dev 10 | install: 11 | - cargo fetch 12 | - rustup target add armv7-unknown-linux-gnueabihf 13 | - rustup component add rustfmt 14 | script: 15 | - cargo build && cargo test && cargo build --target=$TARGET --release 16 | before_deploy: 17 | - tar -cvf target/streamdeck-cli-$TARGET-$TRAVIS_TAG.tgz -C target/$TARGET/release/ 18 | streamdeck-cli 19 | notifications: 20 | email: 21 | on_success: never 22 | on_failure: never 23 | deploy: 24 | provider: releases 25 | api_key: 26 | secure: Ckf1VexYqDxEjJF/0XfCKQzypY92+yv2ZBLz6U+yoSQXFixKCAgjxbtuyR4nVr43sGwB9GPKSLXyqpfMrnbWdp67jU/QgB19hn+7+u6WGXhEKKq2fpgnl9SwXLcfLtdhEgRoB7YmlPONfTFgPe/u4lfrC3XH3AxsaYC1T/RVer3G+mCuode++2H9qh4LwZjhjwFRf1QpF6tAUG4v2IWL6z5ZOgkKW9/ynZ7w92GMKj75Kb8qmvhZQ4IKcswue33eM1DErccEIvrDG9eAPfNhcSpRJTOsKM5EBgDMFgJlZV10EdhJV8PpNv3AIVfIPjXr8ooLCAeomRJyXs8lxXvc4pfh66jKnkmZ9yR5WHCNI2GOPzqb0pbCho1B5ZL0y0et3VScVW8KoPsEQxoDiK+JddzNdjjz0s4WGlICkIwaTckXPKXMtU5NeyM9qRwg7MccNx7x6DEFHZSYa5/I3oF5fg7SujE2zGtp7rfU0t+qwWnAPoSu3UpJhoWv8DJU2BtdzF30Lg6xSRnSj7kjQbjJYCd6R3cU/Hkp2/33M2Wsb4rCMfH6TcfJh6DLfS/g7q9hG6OTqMifjyDbN3kG038QBJTcUZDw+Vz/M7gMtiWCFiptvGvIof36/UhGaVpJztVz/99ATaqiAbwxPsdUou0wyGsLT3Bmz27J+WFpoRAeLIo= 27 | file: target/*.tgz 28 | file_glob: true 29 | skip_cleanup: true 30 | on: 31 | tags: true 32 | repo: ryankurte/streamdeck-cli 33 | -------------------------------------------------------------------------------- /40-streamdeck.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="0060", MODE="0660", GROUP="plugdev" 2 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="0063", MODE="0660", GROUP="plugdev" 3 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="006c", MODE="0660", GROUP="plugdev" 4 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="006d", MODE="0660", GROUP="plugdev" 5 | SUBSYSTEM=="usb", ATTR{idVendor}=="0fd9", ATTR{idProduct}=="0090", MODE="0660", GROUP="plugdev" 6 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 4 4 | 5 | [[package]] 6 | name = "ab_glyph" 7 | version = "0.2.29" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "ec3672c180e71eeaaac3a541fbbc5f5ad4def8b747c595ad30d674e43049f7b0" 10 | dependencies = [ 11 | "ab_glyph_rasterizer", 12 | "owned_ttf_parser", 13 | ] 14 | 15 | [[package]] 16 | name = "ab_glyph_rasterizer" 17 | version = "0.1.8" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" 20 | 21 | [[package]] 22 | name = "adler2" 23 | version = "2.0.0" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 26 | 27 | [[package]] 28 | name = "aligned-vec" 29 | version = "0.5.0" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | checksum = "4aa90d7ce82d4be67b64039a3d588d38dbcc6736577de4a847025ce5b0c468d1" 32 | 33 | [[package]] 34 | name = "ansi_term" 35 | version = "0.12.1" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 38 | dependencies = [ 39 | "winapi", 40 | ] 41 | 42 | [[package]] 43 | name = "anyhow" 44 | version = "1.0.95" 45 | source = "registry+https://github.com/rust-lang/crates.io-index" 46 | checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" 47 | 48 | [[package]] 49 | name = "approx" 50 | version = "0.5.1" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" 53 | dependencies = [ 54 | "num-traits", 55 | ] 56 | 57 | [[package]] 58 | name = "arbitrary" 59 | version = "1.4.1" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" 62 | 63 | [[package]] 64 | name = "arg_enum_proc_macro" 65 | version = "0.3.4" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" 68 | dependencies = [ 69 | "proc-macro2", 70 | "quote", 71 | "syn 2.0.95", 72 | ] 73 | 74 | [[package]] 75 | name = "arrayvec" 76 | version = "0.7.6" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" 79 | 80 | [[package]] 81 | name = "atty" 82 | version = "0.2.14" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 85 | dependencies = [ 86 | "hermit-abi", 87 | "libc", 88 | "winapi", 89 | ] 90 | 91 | [[package]] 92 | name = "autocfg" 93 | version = "1.4.0" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" 96 | 97 | [[package]] 98 | name = "av1-grain" 99 | version = "0.2.3" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "6678909d8c5d46a42abcf571271e15fdbc0a225e3646cf23762cd415046c78bf" 102 | dependencies = [ 103 | "anyhow", 104 | "arrayvec", 105 | "log", 106 | "nom", 107 | "num-rational", 108 | "v_frame", 109 | ] 110 | 111 | [[package]] 112 | name = "avif-serialize" 113 | version = "0.8.2" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "e335041290c43101ca215eed6f43ec437eb5a42125573f600fc3fa42b9bddd62" 116 | dependencies = [ 117 | "arrayvec", 118 | ] 119 | 120 | [[package]] 121 | name = "bit_field" 122 | version = "0.10.2" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" 125 | 126 | [[package]] 127 | name = "bitflags" 128 | version = "1.3.2" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 131 | 132 | [[package]] 133 | name = "bitstream-io" 134 | version = "2.6.0" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2" 137 | 138 | [[package]] 139 | name = "built" 140 | version = "0.7.5" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" 143 | 144 | [[package]] 145 | name = "bumpalo" 146 | version = "3.16.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 149 | 150 | [[package]] 151 | name = "bytemuck" 152 | version = "1.21.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" 155 | 156 | [[package]] 157 | name = "byteorder" 158 | version = "1.5.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 161 | 162 | [[package]] 163 | name = "byteorder-lite" 164 | version = "0.1.0" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" 167 | 168 | [[package]] 169 | name = "cc" 170 | version = "1.2.7" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" 173 | dependencies = [ 174 | "jobserver", 175 | "libc", 176 | "shlex", 177 | ] 178 | 179 | [[package]] 180 | name = "cfg-expr" 181 | version = "0.15.8" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" 184 | dependencies = [ 185 | "smallvec", 186 | "target-lexicon", 187 | ] 188 | 189 | [[package]] 190 | name = "cfg-if" 191 | version = "1.0.0" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 194 | 195 | [[package]] 196 | name = "clap" 197 | version = "2.34.0" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 200 | dependencies = [ 201 | "ansi_term", 202 | "atty", 203 | "bitflags", 204 | "strsim", 205 | "textwrap", 206 | "unicode-width", 207 | "vec_map", 208 | ] 209 | 210 | [[package]] 211 | name = "color_quant" 212 | version = "1.1.0" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" 215 | 216 | [[package]] 217 | name = "conv" 218 | version = "0.3.3" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" 221 | dependencies = [ 222 | "custom_derive", 223 | ] 224 | 225 | [[package]] 226 | name = "crc32fast" 227 | version = "1.4.2" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" 230 | dependencies = [ 231 | "cfg-if", 232 | ] 233 | 234 | [[package]] 235 | name = "crossbeam-deque" 236 | version = "0.8.6" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" 239 | dependencies = [ 240 | "crossbeam-epoch", 241 | "crossbeam-utils", 242 | ] 243 | 244 | [[package]] 245 | name = "crossbeam-epoch" 246 | version = "0.9.18" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" 249 | dependencies = [ 250 | "crossbeam-utils", 251 | ] 252 | 253 | [[package]] 254 | name = "crossbeam-utils" 255 | version = "0.8.21" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" 258 | 259 | [[package]] 260 | name = "crunchy" 261 | version = "0.2.2" 262 | source = "registry+https://github.com/rust-lang/crates.io-index" 263 | checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" 264 | 265 | [[package]] 266 | name = "custom_derive" 267 | version = "0.1.7" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" 270 | 271 | [[package]] 272 | name = "deranged" 273 | version = "0.3.11" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" 276 | dependencies = [ 277 | "powerfmt", 278 | ] 279 | 280 | [[package]] 281 | name = "either" 282 | version = "1.13.0" 283 | source = "registry+https://github.com/rust-lang/crates.io-index" 284 | checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" 285 | 286 | [[package]] 287 | name = "equivalent" 288 | version = "1.0.1" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 291 | 292 | [[package]] 293 | name = "exr" 294 | version = "1.73.0" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "f83197f59927b46c04a183a619b7c29df34e63e63c7869320862268c0ef687e0" 297 | dependencies = [ 298 | "bit_field", 299 | "half", 300 | "lebe", 301 | "miniz_oxide", 302 | "rayon-core", 303 | "smallvec", 304 | "zune-inflate", 305 | ] 306 | 307 | [[package]] 308 | name = "fdeflate" 309 | version = "0.3.7" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" 312 | dependencies = [ 313 | "simd-adler32", 314 | ] 315 | 316 | [[package]] 317 | name = "flate2" 318 | version = "1.0.35" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" 321 | dependencies = [ 322 | "crc32fast", 323 | "miniz_oxide", 324 | ] 325 | 326 | [[package]] 327 | name = "getrandom" 328 | version = "0.2.15" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 331 | dependencies = [ 332 | "cfg-if", 333 | "js-sys", 334 | "libc", 335 | "wasi", 336 | "wasm-bindgen", 337 | ] 338 | 339 | [[package]] 340 | name = "gif" 341 | version = "0.13.1" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "3fb2d69b19215e18bb912fa30f7ce15846e301408695e44e0ef719f1da9e19f2" 344 | dependencies = [ 345 | "color_quant", 346 | "weezl", 347 | ] 348 | 349 | [[package]] 350 | name = "half" 351 | version = "2.4.1" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" 354 | dependencies = [ 355 | "cfg-if", 356 | "crunchy", 357 | ] 358 | 359 | [[package]] 360 | name = "hashbrown" 361 | version = "0.15.2" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" 364 | 365 | [[package]] 366 | name = "heck" 367 | version = "0.3.3" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 370 | dependencies = [ 371 | "unicode-segmentation", 372 | ] 373 | 374 | [[package]] 375 | name = "heck" 376 | version = "0.5.0" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 379 | 380 | [[package]] 381 | name = "hermit-abi" 382 | version = "0.1.19" 383 | source = "registry+https://github.com/rust-lang/crates.io-index" 384 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 385 | dependencies = [ 386 | "libc", 387 | ] 388 | 389 | [[package]] 390 | name = "hidapi" 391 | version = "2.6.3" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "03b876ecf37e86b359573c16c8366bc3eba52b689884a0fc42ba3f67203d2a8b" 394 | dependencies = [ 395 | "cc", 396 | "cfg-if", 397 | "libc", 398 | "pkg-config", 399 | "windows-sys 0.48.0", 400 | ] 401 | 402 | [[package]] 403 | name = "humantime" 404 | version = "2.1.0" 405 | source = "registry+https://github.com/rust-lang/crates.io-index" 406 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 407 | 408 | [[package]] 409 | name = "image" 410 | version = "0.25.5" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "cd6f44aed642f18953a158afeb30206f4d50da59fbc66ecb53c66488de73563b" 413 | dependencies = [ 414 | "bytemuck", 415 | "byteorder-lite", 416 | "color_quant", 417 | "exr", 418 | "gif", 419 | "image-webp", 420 | "num-traits", 421 | "png", 422 | "qoi", 423 | "ravif", 424 | "rayon", 425 | "rgb", 426 | "tiff", 427 | "zune-core", 428 | "zune-jpeg", 429 | ] 430 | 431 | [[package]] 432 | name = "image-webp" 433 | version = "0.2.0" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "e031e8e3d94711a9ccb5d6ea357439ef3dcbed361798bd4071dc4d9793fbe22f" 436 | dependencies = [ 437 | "byteorder-lite", 438 | "quick-error", 439 | ] 440 | 441 | [[package]] 442 | name = "imageproc" 443 | version = "0.24.0" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "a2a0d7770f428b4615960cc8602775d1f04c75d41b0ccdef862e889ebaae9bbf" 446 | dependencies = [ 447 | "ab_glyph", 448 | "approx", 449 | "conv", 450 | "getrandom", 451 | "image", 452 | "itertools", 453 | "nalgebra", 454 | "num", 455 | "rand", 456 | "rand_distr", 457 | "rayon", 458 | ] 459 | 460 | [[package]] 461 | name = "imgref" 462 | version = "1.11.0" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "d0263a3d970d5c054ed9312c0057b4f3bde9c0b33836d3637361d4a9e6e7a408" 465 | 466 | [[package]] 467 | name = "indexmap" 468 | version = "2.7.0" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" 471 | dependencies = [ 472 | "equivalent", 473 | "hashbrown", 474 | ] 475 | 476 | [[package]] 477 | name = "interpolate_name" 478 | version = "0.2.4" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" 481 | dependencies = [ 482 | "proc-macro2", 483 | "quote", 484 | "syn 2.0.95", 485 | ] 486 | 487 | [[package]] 488 | name = "itertools" 489 | version = "0.12.1" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" 492 | dependencies = [ 493 | "either", 494 | ] 495 | 496 | [[package]] 497 | name = "itoa" 498 | version = "1.0.14" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" 501 | 502 | [[package]] 503 | name = "jobserver" 504 | version = "0.1.32" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" 507 | dependencies = [ 508 | "libc", 509 | ] 510 | 511 | [[package]] 512 | name = "jpeg-decoder" 513 | version = "0.3.1" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" 516 | 517 | [[package]] 518 | name = "js-sys" 519 | version = "0.3.76" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" 522 | dependencies = [ 523 | "once_cell", 524 | "wasm-bindgen", 525 | ] 526 | 527 | [[package]] 528 | name = "lazy_static" 529 | version = "1.5.0" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 532 | 533 | [[package]] 534 | name = "lebe" 535 | version = "0.5.2" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" 538 | 539 | [[package]] 540 | name = "libc" 541 | version = "0.2.169" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" 544 | 545 | [[package]] 546 | name = "libfuzzer-sys" 547 | version = "0.4.8" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "9b9569d2f74e257076d8c6bfa73fb505b46b851e51ddaecc825944aa3bed17fa" 550 | dependencies = [ 551 | "arbitrary", 552 | "cc", 553 | ] 554 | 555 | [[package]] 556 | name = "libm" 557 | version = "0.2.11" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" 560 | 561 | [[package]] 562 | name = "log" 563 | version = "0.4.22" 564 | source = "registry+https://github.com/rust-lang/crates.io-index" 565 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 566 | 567 | [[package]] 568 | name = "loop9" 569 | version = "0.1.5" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062" 572 | dependencies = [ 573 | "imgref", 574 | ] 575 | 576 | [[package]] 577 | name = "matrixmultiply" 578 | version = "0.3.9" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" 581 | dependencies = [ 582 | "autocfg", 583 | "rawpointer", 584 | ] 585 | 586 | [[package]] 587 | name = "maybe-rayon" 588 | version = "0.1.1" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519" 591 | dependencies = [ 592 | "cfg-if", 593 | "rayon", 594 | ] 595 | 596 | [[package]] 597 | name = "memchr" 598 | version = "2.7.4" 599 | source = "registry+https://github.com/rust-lang/crates.io-index" 600 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 601 | 602 | [[package]] 603 | name = "minimal-lexical" 604 | version = "0.2.1" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 607 | 608 | [[package]] 609 | name = "miniz_oxide" 610 | version = "0.8.2" 611 | source = "registry+https://github.com/rust-lang/crates.io-index" 612 | checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" 613 | dependencies = [ 614 | "adler2", 615 | "simd-adler32", 616 | ] 617 | 618 | [[package]] 619 | name = "nalgebra" 620 | version = "0.32.6" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" 623 | dependencies = [ 624 | "approx", 625 | "matrixmultiply", 626 | "num-complex", 627 | "num-rational", 628 | "num-traits", 629 | "simba", 630 | "typenum", 631 | ] 632 | 633 | [[package]] 634 | name = "new_debug_unreachable" 635 | version = "1.0.6" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" 638 | 639 | [[package]] 640 | name = "nom" 641 | version = "7.1.3" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 644 | dependencies = [ 645 | "memchr", 646 | "minimal-lexical", 647 | ] 648 | 649 | [[package]] 650 | name = "noop_proc_macro" 651 | version = "0.3.0" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" 654 | 655 | [[package]] 656 | name = "num" 657 | version = "0.4.3" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" 660 | dependencies = [ 661 | "num-bigint", 662 | "num-complex", 663 | "num-integer", 664 | "num-iter", 665 | "num-rational", 666 | "num-traits", 667 | ] 668 | 669 | [[package]] 670 | name = "num-bigint" 671 | version = "0.4.6" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" 674 | dependencies = [ 675 | "num-integer", 676 | "num-traits", 677 | ] 678 | 679 | [[package]] 680 | name = "num-complex" 681 | version = "0.4.6" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" 684 | dependencies = [ 685 | "num-traits", 686 | ] 687 | 688 | [[package]] 689 | name = "num-conv" 690 | version = "0.1.0" 691 | source = "registry+https://github.com/rust-lang/crates.io-index" 692 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 693 | 694 | [[package]] 695 | name = "num-derive" 696 | version = "0.4.2" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" 699 | dependencies = [ 700 | "proc-macro2", 701 | "quote", 702 | "syn 2.0.95", 703 | ] 704 | 705 | [[package]] 706 | name = "num-integer" 707 | version = "0.1.46" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" 710 | dependencies = [ 711 | "num-traits", 712 | ] 713 | 714 | [[package]] 715 | name = "num-iter" 716 | version = "0.1.45" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" 719 | dependencies = [ 720 | "autocfg", 721 | "num-integer", 722 | "num-traits", 723 | ] 724 | 725 | [[package]] 726 | name = "num-rational" 727 | version = "0.4.2" 728 | source = "registry+https://github.com/rust-lang/crates.io-index" 729 | checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" 730 | dependencies = [ 731 | "num-bigint", 732 | "num-integer", 733 | "num-traits", 734 | ] 735 | 736 | [[package]] 737 | name = "num-traits" 738 | version = "0.2.19" 739 | source = "registry+https://github.com/rust-lang/crates.io-index" 740 | checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 741 | dependencies = [ 742 | "autocfg", 743 | "libm", 744 | ] 745 | 746 | [[package]] 747 | name = "num_threads" 748 | version = "0.1.7" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" 751 | dependencies = [ 752 | "libc", 753 | ] 754 | 755 | [[package]] 756 | name = "once_cell" 757 | version = "1.20.2" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 760 | 761 | [[package]] 762 | name = "owned_ttf_parser" 763 | version = "0.25.0" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "22ec719bbf3b2a81c109a4e20b1f129b5566b7dce654bc3872f6a05abf82b2c4" 766 | dependencies = [ 767 | "ttf-parser", 768 | ] 769 | 770 | [[package]] 771 | name = "paste" 772 | version = "1.0.15" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" 775 | 776 | [[package]] 777 | name = "pkg-config" 778 | version = "0.3.31" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" 781 | 782 | [[package]] 783 | name = "png" 784 | version = "0.17.16" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" 787 | dependencies = [ 788 | "bitflags", 789 | "crc32fast", 790 | "fdeflate", 791 | "flate2", 792 | "miniz_oxide", 793 | ] 794 | 795 | [[package]] 796 | name = "powerfmt" 797 | version = "0.2.0" 798 | source = "registry+https://github.com/rust-lang/crates.io-index" 799 | checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 800 | 801 | [[package]] 802 | name = "ppv-lite86" 803 | version = "0.2.20" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 806 | dependencies = [ 807 | "zerocopy", 808 | ] 809 | 810 | [[package]] 811 | name = "proc-macro-error" 812 | version = "1.0.4" 813 | source = "registry+https://github.com/rust-lang/crates.io-index" 814 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 815 | dependencies = [ 816 | "proc-macro-error-attr", 817 | "proc-macro2", 818 | "quote", 819 | "syn 1.0.109", 820 | "version_check", 821 | ] 822 | 823 | [[package]] 824 | name = "proc-macro-error-attr" 825 | version = "1.0.4" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 828 | dependencies = [ 829 | "proc-macro2", 830 | "quote", 831 | "version_check", 832 | ] 833 | 834 | [[package]] 835 | name = "proc-macro2" 836 | version = "1.0.92" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" 839 | dependencies = [ 840 | "unicode-ident", 841 | ] 842 | 843 | [[package]] 844 | name = "profiling" 845 | version = "1.0.16" 846 | source = "registry+https://github.com/rust-lang/crates.io-index" 847 | checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" 848 | dependencies = [ 849 | "profiling-procmacros", 850 | ] 851 | 852 | [[package]] 853 | name = "profiling-procmacros" 854 | version = "1.0.16" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" 857 | dependencies = [ 858 | "quote", 859 | "syn 2.0.95", 860 | ] 861 | 862 | [[package]] 863 | name = "qoi" 864 | version = "0.4.1" 865 | source = "registry+https://github.com/rust-lang/crates.io-index" 866 | checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001" 867 | dependencies = [ 868 | "bytemuck", 869 | ] 870 | 871 | [[package]] 872 | name = "quick-error" 873 | version = "2.0.1" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" 876 | 877 | [[package]] 878 | name = "quote" 879 | version = "1.0.38" 880 | source = "registry+https://github.com/rust-lang/crates.io-index" 881 | checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" 882 | dependencies = [ 883 | "proc-macro2", 884 | ] 885 | 886 | [[package]] 887 | name = "rand" 888 | version = "0.8.5" 889 | source = "registry+https://github.com/rust-lang/crates.io-index" 890 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 891 | dependencies = [ 892 | "libc", 893 | "rand_chacha", 894 | "rand_core", 895 | ] 896 | 897 | [[package]] 898 | name = "rand_chacha" 899 | version = "0.3.1" 900 | source = "registry+https://github.com/rust-lang/crates.io-index" 901 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 902 | dependencies = [ 903 | "ppv-lite86", 904 | "rand_core", 905 | ] 906 | 907 | [[package]] 908 | name = "rand_core" 909 | version = "0.6.4" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 912 | dependencies = [ 913 | "getrandom", 914 | ] 915 | 916 | [[package]] 917 | name = "rand_distr" 918 | version = "0.4.3" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31" 921 | dependencies = [ 922 | "num-traits", 923 | "rand", 924 | ] 925 | 926 | [[package]] 927 | name = "rav1e" 928 | version = "0.7.1" 929 | source = "registry+https://github.com/rust-lang/crates.io-index" 930 | checksum = "cd87ce80a7665b1cce111f8a16c1f3929f6547ce91ade6addf4ec86a8dda5ce9" 931 | dependencies = [ 932 | "arbitrary", 933 | "arg_enum_proc_macro", 934 | "arrayvec", 935 | "av1-grain", 936 | "bitstream-io", 937 | "built", 938 | "cfg-if", 939 | "interpolate_name", 940 | "itertools", 941 | "libc", 942 | "libfuzzer-sys", 943 | "log", 944 | "maybe-rayon", 945 | "new_debug_unreachable", 946 | "noop_proc_macro", 947 | "num-derive", 948 | "num-traits", 949 | "once_cell", 950 | "paste", 951 | "profiling", 952 | "rand", 953 | "rand_chacha", 954 | "simd_helpers", 955 | "system-deps", 956 | "thiserror", 957 | "v_frame", 958 | "wasm-bindgen", 959 | ] 960 | 961 | [[package]] 962 | name = "ravif" 963 | version = "0.11.11" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "2413fd96bd0ea5cdeeb37eaf446a22e6ed7b981d792828721e74ded1980a45c6" 966 | dependencies = [ 967 | "avif-serialize", 968 | "imgref", 969 | "loop9", 970 | "quick-error", 971 | "rav1e", 972 | "rayon", 973 | "rgb", 974 | ] 975 | 976 | [[package]] 977 | name = "rawpointer" 978 | version = "0.2.1" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" 981 | 982 | [[package]] 983 | name = "rayon" 984 | version = "1.10.0" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" 987 | dependencies = [ 988 | "either", 989 | "rayon-core", 990 | ] 991 | 992 | [[package]] 993 | name = "rayon-core" 994 | version = "1.12.1" 995 | source = "registry+https://github.com/rust-lang/crates.io-index" 996 | checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" 997 | dependencies = [ 998 | "crossbeam-deque", 999 | "crossbeam-utils", 1000 | ] 1001 | 1002 | [[package]] 1003 | name = "rgb" 1004 | version = "0.8.50" 1005 | source = "registry+https://github.com/rust-lang/crates.io-index" 1006 | checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" 1007 | 1008 | [[package]] 1009 | name = "safe_arch" 1010 | version = "0.7.4" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" 1013 | dependencies = [ 1014 | "bytemuck", 1015 | ] 1016 | 1017 | [[package]] 1018 | name = "serde" 1019 | version = "1.0.217" 1020 | source = "registry+https://github.com/rust-lang/crates.io-index" 1021 | checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" 1022 | dependencies = [ 1023 | "serde_derive", 1024 | ] 1025 | 1026 | [[package]] 1027 | name = "serde_derive" 1028 | version = "1.0.217" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" 1031 | dependencies = [ 1032 | "proc-macro2", 1033 | "quote", 1034 | "syn 2.0.95", 1035 | ] 1036 | 1037 | [[package]] 1038 | name = "serde_spanned" 1039 | version = "0.6.8" 1040 | source = "registry+https://github.com/rust-lang/crates.io-index" 1041 | checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" 1042 | dependencies = [ 1043 | "serde", 1044 | ] 1045 | 1046 | [[package]] 1047 | name = "shlex" 1048 | version = "1.3.0" 1049 | source = "registry+https://github.com/rust-lang/crates.io-index" 1050 | checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1051 | 1052 | [[package]] 1053 | name = "simba" 1054 | version = "0.8.1" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" 1057 | dependencies = [ 1058 | "approx", 1059 | "num-complex", 1060 | "num-traits", 1061 | "paste", 1062 | "wide", 1063 | ] 1064 | 1065 | [[package]] 1066 | name = "simd-adler32" 1067 | version = "0.3.7" 1068 | source = "registry+https://github.com/rust-lang/crates.io-index" 1069 | checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" 1070 | 1071 | [[package]] 1072 | name = "simd_helpers" 1073 | version = "0.1.0" 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" 1075 | checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6" 1076 | dependencies = [ 1077 | "quote", 1078 | ] 1079 | 1080 | [[package]] 1081 | name = "simplelog" 1082 | version = "0.12.2" 1083 | source = "registry+https://github.com/rust-lang/crates.io-index" 1084 | checksum = "16257adbfaef1ee58b1363bdc0664c9b8e1e30aed86049635fb5f147d065a9c0" 1085 | dependencies = [ 1086 | "log", 1087 | "termcolor", 1088 | "time", 1089 | ] 1090 | 1091 | [[package]] 1092 | name = "smallvec" 1093 | version = "1.13.2" 1094 | source = "registry+https://github.com/rust-lang/crates.io-index" 1095 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 1096 | 1097 | [[package]] 1098 | name = "streamdeck" 1099 | version = "0.9.0" 1100 | dependencies = [ 1101 | "ab_glyph", 1102 | "hidapi", 1103 | "humantime", 1104 | "image", 1105 | "imageproc", 1106 | "log", 1107 | "serde", 1108 | "simplelog", 1109 | "structopt", 1110 | "thiserror", 1111 | ] 1112 | 1113 | [[package]] 1114 | name = "strsim" 1115 | version = "0.8.0" 1116 | source = "registry+https://github.com/rust-lang/crates.io-index" 1117 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 1118 | 1119 | [[package]] 1120 | name = "structopt" 1121 | version = "0.3.26" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" 1124 | dependencies = [ 1125 | "clap", 1126 | "lazy_static", 1127 | "structopt-derive", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "structopt-derive" 1132 | version = "0.4.18" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" 1135 | dependencies = [ 1136 | "heck 0.3.3", 1137 | "proc-macro-error", 1138 | "proc-macro2", 1139 | "quote", 1140 | "syn 1.0.109", 1141 | ] 1142 | 1143 | [[package]] 1144 | name = "syn" 1145 | version = "1.0.109" 1146 | source = "registry+https://github.com/rust-lang/crates.io-index" 1147 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1148 | dependencies = [ 1149 | "proc-macro2", 1150 | "quote", 1151 | "unicode-ident", 1152 | ] 1153 | 1154 | [[package]] 1155 | name = "syn" 1156 | version = "2.0.95" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "46f71c0377baf4ef1cc3e3402ded576dccc315800fbc62dfc7fe04b009773b4a" 1159 | dependencies = [ 1160 | "proc-macro2", 1161 | "quote", 1162 | "unicode-ident", 1163 | ] 1164 | 1165 | [[package]] 1166 | name = "system-deps" 1167 | version = "6.2.2" 1168 | source = "registry+https://github.com/rust-lang/crates.io-index" 1169 | checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" 1170 | dependencies = [ 1171 | "cfg-expr", 1172 | "heck 0.5.0", 1173 | "pkg-config", 1174 | "toml", 1175 | "version-compare", 1176 | ] 1177 | 1178 | [[package]] 1179 | name = "target-lexicon" 1180 | version = "0.12.16" 1181 | source = "registry+https://github.com/rust-lang/crates.io-index" 1182 | checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" 1183 | 1184 | [[package]] 1185 | name = "termcolor" 1186 | version = "1.4.1" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" 1189 | dependencies = [ 1190 | "winapi-util", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "textwrap" 1195 | version = "0.11.0" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 1198 | dependencies = [ 1199 | "unicode-width", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "thiserror" 1204 | version = "1.0.69" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" 1207 | dependencies = [ 1208 | "thiserror-impl", 1209 | ] 1210 | 1211 | [[package]] 1212 | name = "thiserror-impl" 1213 | version = "1.0.69" 1214 | source = "registry+https://github.com/rust-lang/crates.io-index" 1215 | checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" 1216 | dependencies = [ 1217 | "proc-macro2", 1218 | "quote", 1219 | "syn 2.0.95", 1220 | ] 1221 | 1222 | [[package]] 1223 | name = "tiff" 1224 | version = "0.9.1" 1225 | source = "registry+https://github.com/rust-lang/crates.io-index" 1226 | checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" 1227 | dependencies = [ 1228 | "flate2", 1229 | "jpeg-decoder", 1230 | "weezl", 1231 | ] 1232 | 1233 | [[package]] 1234 | name = "time" 1235 | version = "0.3.37" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" 1238 | dependencies = [ 1239 | "deranged", 1240 | "itoa", 1241 | "libc", 1242 | "num-conv", 1243 | "num_threads", 1244 | "powerfmt", 1245 | "serde", 1246 | "time-core", 1247 | "time-macros", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "time-core" 1252 | version = "0.1.2" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" 1255 | 1256 | [[package]] 1257 | name = "time-macros" 1258 | version = "0.2.19" 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" 1260 | checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" 1261 | dependencies = [ 1262 | "num-conv", 1263 | "time-core", 1264 | ] 1265 | 1266 | [[package]] 1267 | name = "toml" 1268 | version = "0.8.19" 1269 | source = "registry+https://github.com/rust-lang/crates.io-index" 1270 | checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" 1271 | dependencies = [ 1272 | "serde", 1273 | "serde_spanned", 1274 | "toml_datetime", 1275 | "toml_edit", 1276 | ] 1277 | 1278 | [[package]] 1279 | name = "toml_datetime" 1280 | version = "0.6.8" 1281 | source = "registry+https://github.com/rust-lang/crates.io-index" 1282 | checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" 1283 | dependencies = [ 1284 | "serde", 1285 | ] 1286 | 1287 | [[package]] 1288 | name = "toml_edit" 1289 | version = "0.22.22" 1290 | source = "registry+https://github.com/rust-lang/crates.io-index" 1291 | checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" 1292 | dependencies = [ 1293 | "indexmap", 1294 | "serde", 1295 | "serde_spanned", 1296 | "toml_datetime", 1297 | "winnow", 1298 | ] 1299 | 1300 | [[package]] 1301 | name = "ttf-parser" 1302 | version = "0.25.1" 1303 | source = "registry+https://github.com/rust-lang/crates.io-index" 1304 | checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" 1305 | 1306 | [[package]] 1307 | name = "typenum" 1308 | version = "1.17.0" 1309 | source = "registry+https://github.com/rust-lang/crates.io-index" 1310 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1311 | 1312 | [[package]] 1313 | name = "unicode-ident" 1314 | version = "1.0.14" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" 1317 | 1318 | [[package]] 1319 | name = "unicode-segmentation" 1320 | version = "1.12.0" 1321 | source = "registry+https://github.com/rust-lang/crates.io-index" 1322 | checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" 1323 | 1324 | [[package]] 1325 | name = "unicode-width" 1326 | version = "0.1.14" 1327 | source = "registry+https://github.com/rust-lang/crates.io-index" 1328 | checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" 1329 | 1330 | [[package]] 1331 | name = "v_frame" 1332 | version = "0.3.8" 1333 | source = "registry+https://github.com/rust-lang/crates.io-index" 1334 | checksum = "d6f32aaa24bacd11e488aa9ba66369c7cd514885742c9fe08cfe85884db3e92b" 1335 | dependencies = [ 1336 | "aligned-vec", 1337 | "num-traits", 1338 | "wasm-bindgen", 1339 | ] 1340 | 1341 | [[package]] 1342 | name = "vec_map" 1343 | version = "0.8.2" 1344 | source = "registry+https://github.com/rust-lang/crates.io-index" 1345 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 1346 | 1347 | [[package]] 1348 | name = "version-compare" 1349 | version = "0.2.0" 1350 | source = "registry+https://github.com/rust-lang/crates.io-index" 1351 | checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" 1352 | 1353 | [[package]] 1354 | name = "version_check" 1355 | version = "0.9.5" 1356 | source = "registry+https://github.com/rust-lang/crates.io-index" 1357 | checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 1358 | 1359 | [[package]] 1360 | name = "wasi" 1361 | version = "0.11.0+wasi-snapshot-preview1" 1362 | source = "registry+https://github.com/rust-lang/crates.io-index" 1363 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1364 | 1365 | [[package]] 1366 | name = "wasm-bindgen" 1367 | version = "0.2.99" 1368 | source = "registry+https://github.com/rust-lang/crates.io-index" 1369 | checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" 1370 | dependencies = [ 1371 | "cfg-if", 1372 | "once_cell", 1373 | "wasm-bindgen-macro", 1374 | ] 1375 | 1376 | [[package]] 1377 | name = "wasm-bindgen-backend" 1378 | version = "0.2.99" 1379 | source = "registry+https://github.com/rust-lang/crates.io-index" 1380 | checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" 1381 | dependencies = [ 1382 | "bumpalo", 1383 | "log", 1384 | "proc-macro2", 1385 | "quote", 1386 | "syn 2.0.95", 1387 | "wasm-bindgen-shared", 1388 | ] 1389 | 1390 | [[package]] 1391 | name = "wasm-bindgen-macro" 1392 | version = "0.2.99" 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" 1394 | checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" 1395 | dependencies = [ 1396 | "quote", 1397 | "wasm-bindgen-macro-support", 1398 | ] 1399 | 1400 | [[package]] 1401 | name = "wasm-bindgen-macro-support" 1402 | version = "0.2.99" 1403 | source = "registry+https://github.com/rust-lang/crates.io-index" 1404 | checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" 1405 | dependencies = [ 1406 | "proc-macro2", 1407 | "quote", 1408 | "syn 2.0.95", 1409 | "wasm-bindgen-backend", 1410 | "wasm-bindgen-shared", 1411 | ] 1412 | 1413 | [[package]] 1414 | name = "wasm-bindgen-shared" 1415 | version = "0.2.99" 1416 | source = "registry+https://github.com/rust-lang/crates.io-index" 1417 | checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" 1418 | 1419 | [[package]] 1420 | name = "weezl" 1421 | version = "0.1.8" 1422 | source = "registry+https://github.com/rust-lang/crates.io-index" 1423 | checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" 1424 | 1425 | [[package]] 1426 | name = "wide" 1427 | version = "0.7.31" 1428 | source = "registry+https://github.com/rust-lang/crates.io-index" 1429 | checksum = "cc0ca27312d1e9218687a4e804cd4b7410bf54125d54d13e5170efbf09066d24" 1430 | dependencies = [ 1431 | "bytemuck", 1432 | "safe_arch", 1433 | ] 1434 | 1435 | [[package]] 1436 | name = "winapi" 1437 | version = "0.3.9" 1438 | source = "registry+https://github.com/rust-lang/crates.io-index" 1439 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1440 | dependencies = [ 1441 | "winapi-i686-pc-windows-gnu", 1442 | "winapi-x86_64-pc-windows-gnu", 1443 | ] 1444 | 1445 | [[package]] 1446 | name = "winapi-i686-pc-windows-gnu" 1447 | version = "0.4.0" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1450 | 1451 | [[package]] 1452 | name = "winapi-util" 1453 | version = "0.1.9" 1454 | source = "registry+https://github.com/rust-lang/crates.io-index" 1455 | checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" 1456 | dependencies = [ 1457 | "windows-sys 0.59.0", 1458 | ] 1459 | 1460 | [[package]] 1461 | name = "winapi-x86_64-pc-windows-gnu" 1462 | version = "0.4.0" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1465 | 1466 | [[package]] 1467 | name = "windows-sys" 1468 | version = "0.48.0" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1471 | dependencies = [ 1472 | "windows-targets 0.48.5", 1473 | ] 1474 | 1475 | [[package]] 1476 | name = "windows-sys" 1477 | version = "0.59.0" 1478 | source = "registry+https://github.com/rust-lang/crates.io-index" 1479 | checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 1480 | dependencies = [ 1481 | "windows-targets 0.52.6", 1482 | ] 1483 | 1484 | [[package]] 1485 | name = "windows-targets" 1486 | version = "0.48.5" 1487 | source = "registry+https://github.com/rust-lang/crates.io-index" 1488 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1489 | dependencies = [ 1490 | "windows_aarch64_gnullvm 0.48.5", 1491 | "windows_aarch64_msvc 0.48.5", 1492 | "windows_i686_gnu 0.48.5", 1493 | "windows_i686_msvc 0.48.5", 1494 | "windows_x86_64_gnu 0.48.5", 1495 | "windows_x86_64_gnullvm 0.48.5", 1496 | "windows_x86_64_msvc 0.48.5", 1497 | ] 1498 | 1499 | [[package]] 1500 | name = "windows-targets" 1501 | version = "0.52.6" 1502 | source = "registry+https://github.com/rust-lang/crates.io-index" 1503 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1504 | dependencies = [ 1505 | "windows_aarch64_gnullvm 0.52.6", 1506 | "windows_aarch64_msvc 0.52.6", 1507 | "windows_i686_gnu 0.52.6", 1508 | "windows_i686_gnullvm", 1509 | "windows_i686_msvc 0.52.6", 1510 | "windows_x86_64_gnu 0.52.6", 1511 | "windows_x86_64_gnullvm 0.52.6", 1512 | "windows_x86_64_msvc 0.52.6", 1513 | ] 1514 | 1515 | [[package]] 1516 | name = "windows_aarch64_gnullvm" 1517 | version = "0.48.5" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1520 | 1521 | [[package]] 1522 | name = "windows_aarch64_gnullvm" 1523 | version = "0.52.6" 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" 1525 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1526 | 1527 | [[package]] 1528 | name = "windows_aarch64_msvc" 1529 | version = "0.48.5" 1530 | source = "registry+https://github.com/rust-lang/crates.io-index" 1531 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1532 | 1533 | [[package]] 1534 | name = "windows_aarch64_msvc" 1535 | version = "0.52.6" 1536 | source = "registry+https://github.com/rust-lang/crates.io-index" 1537 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1538 | 1539 | [[package]] 1540 | name = "windows_i686_gnu" 1541 | version = "0.48.5" 1542 | source = "registry+https://github.com/rust-lang/crates.io-index" 1543 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1544 | 1545 | [[package]] 1546 | name = "windows_i686_gnu" 1547 | version = "0.52.6" 1548 | source = "registry+https://github.com/rust-lang/crates.io-index" 1549 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1550 | 1551 | [[package]] 1552 | name = "windows_i686_gnullvm" 1553 | version = "0.52.6" 1554 | source = "registry+https://github.com/rust-lang/crates.io-index" 1555 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1556 | 1557 | [[package]] 1558 | name = "windows_i686_msvc" 1559 | version = "0.48.5" 1560 | source = "registry+https://github.com/rust-lang/crates.io-index" 1561 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1562 | 1563 | [[package]] 1564 | name = "windows_i686_msvc" 1565 | version = "0.52.6" 1566 | source = "registry+https://github.com/rust-lang/crates.io-index" 1567 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1568 | 1569 | [[package]] 1570 | name = "windows_x86_64_gnu" 1571 | version = "0.48.5" 1572 | source = "registry+https://github.com/rust-lang/crates.io-index" 1573 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1574 | 1575 | [[package]] 1576 | name = "windows_x86_64_gnu" 1577 | version = "0.52.6" 1578 | source = "registry+https://github.com/rust-lang/crates.io-index" 1579 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1580 | 1581 | [[package]] 1582 | name = "windows_x86_64_gnullvm" 1583 | version = "0.48.5" 1584 | source = "registry+https://github.com/rust-lang/crates.io-index" 1585 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1586 | 1587 | [[package]] 1588 | name = "windows_x86_64_gnullvm" 1589 | version = "0.52.6" 1590 | source = "registry+https://github.com/rust-lang/crates.io-index" 1591 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1592 | 1593 | [[package]] 1594 | name = "windows_x86_64_msvc" 1595 | version = "0.48.5" 1596 | source = "registry+https://github.com/rust-lang/crates.io-index" 1597 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1598 | 1599 | [[package]] 1600 | name = "windows_x86_64_msvc" 1601 | version = "0.52.6" 1602 | source = "registry+https://github.com/rust-lang/crates.io-index" 1603 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1604 | 1605 | [[package]] 1606 | name = "winnow" 1607 | version = "0.6.22" 1608 | source = "registry+https://github.com/rust-lang/crates.io-index" 1609 | checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" 1610 | dependencies = [ 1611 | "memchr", 1612 | ] 1613 | 1614 | [[package]] 1615 | name = "zerocopy" 1616 | version = "0.7.35" 1617 | source = "registry+https://github.com/rust-lang/crates.io-index" 1618 | checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 1619 | dependencies = [ 1620 | "byteorder", 1621 | "zerocopy-derive", 1622 | ] 1623 | 1624 | [[package]] 1625 | name = "zerocopy-derive" 1626 | version = "0.7.35" 1627 | source = "registry+https://github.com/rust-lang/crates.io-index" 1628 | checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 1629 | dependencies = [ 1630 | "proc-macro2", 1631 | "quote", 1632 | "syn 2.0.95", 1633 | ] 1634 | 1635 | [[package]] 1636 | name = "zune-core" 1637 | version = "0.4.12" 1638 | source = "registry+https://github.com/rust-lang/crates.io-index" 1639 | checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a" 1640 | 1641 | [[package]] 1642 | name = "zune-inflate" 1643 | version = "0.2.54" 1644 | source = "registry+https://github.com/rust-lang/crates.io-index" 1645 | checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" 1646 | dependencies = [ 1647 | "simd-adler32", 1648 | ] 1649 | 1650 | [[package]] 1651 | name = "zune-jpeg" 1652 | version = "0.4.14" 1653 | source = "registry+https://github.com/rust-lang/crates.io-index" 1654 | checksum = "99a5bab8d7dedf81405c4bb1f2b83ea057643d9cb28778cea9eecddeedd2e028" 1655 | dependencies = [ 1656 | "zune-core", 1657 | ] 1658 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "streamdeck" 3 | description = "Elgato Stream Deck driver and command line interface" 4 | repository = "https://github.com/ryankurte/rust-streamdeck" 5 | authors = ["ryan "] 6 | version = "0.9.0" 7 | readme = "README.md" 8 | license = "MPL-2.0" 9 | edition = "2018" 10 | 11 | [features] 12 | util = [ "structopt", "simplelog", "humantime" ] 13 | default = [ "util" ] 14 | 15 | [dependencies] 16 | hidapi = "2.4" 17 | log = "0.4.8" 18 | image = "0.25.1" 19 | imageproc = "0.24.0" 20 | thiserror = "1.0.30" 21 | ab_glyph = "0.2.25" 22 | 23 | structopt = { version = "0.3.5", optional = true } 24 | simplelog = { version = "0.12.0", optional = true } 25 | humantime = { version = "2.1.0", optional = true } 26 | serde = { version = "1.0.104", optional = true, features = ["derive"] } 27 | 28 | [[bin]] 29 | path = "src/main.rs" 30 | name = "streamdeck-cli" 31 | required-features = [ "util" ] 32 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust Elgato StreamDeck Driver and Utility 2 | 3 | An [hidapi](https://crates.io/crates/hidapi) based driver for direct interaction with Elgato StreamDeck devices, this is intended to allow applications to use these devices directly and on arbitrary platforms (without the use of the Elgato SDK), heavily based on the [python streamdeck library](https://github.com/abcminiuser/python-elgato-streamdeck). 4 | 5 | 6 | ## Status 7 | 8 | [![GitHub tag](https://img.shields.io/github/tag/ryankurte/rust-streamdeck.svg)](https://github.com/ryankurte/rust-streamdeck) 9 | [![Travis Build Status](https://travis-ci.org/ryankurte/rust-streamdeck.svg?branch=master)](https://travis-ci.org/ryankurte/rust-streamdeck) 10 | [![Crates.io](https://img.shields.io/crates/v/streamdeck.svg)](https://crates.io/crates/streamdeck) 11 | [![Docs.rs](https://docs.rs/streamdeck/badge.svg)](https://docs.rs/streamdeck) 12 | 13 | WIP. Pull requests more than welcome! 14 | 15 | Features: 16 | 17 | - [x] Connecting to devices 18 | - [x] Connecting by VID/PID/Serial 19 | - [x] Matching device _types_ (Mini etc.) 20 | - [ ] Reading buttons 21 | - [x] Poll based mode (w/ blocking / non-blocking selection and timeouts) 22 | - [ ] Multi-threaded / async / callback driven mode 23 | - [x] Writing brightness 24 | - [x] Setting buttons 25 | - [x] Writing colours 26 | - [x] Writing images 27 | - [ ] Devices 28 | - [x] Stream Deck Mini 29 | - [x] Stream Deck Original (untested) 30 | - [x] Stream Deck Original V2 31 | - [x] Stream Deck XL 32 | 33 | 34 | ## Getting started 35 | 36 | - `cargo add streamdeck` to add this library to your project (with [cargo-edit](https://github.com/killercup/cargo-edit)) 37 | - `cargo install streamdeck` to install the utility only 38 | - `git clone git@github.com:ryankurte/rust-streamdeck.git` to clone the repo 39 | 40 | Building requires `libusb` and `hidapi` packages. 41 | 42 | ### Setting up permissions on linux 43 | 44 | - `cp 40-streamdeck.rules /etc/udev/rules.d/` to allow user access to streamdeck devices 45 | - note this may need to be edited with other vid/pid combinations for other devices 46 | - `sudo udevadm control --reload-rules` to reload udev rules 47 | 48 | ### Using the CLI 49 | 50 | `streamdeck-cli --help` displays available subcommands and options, passing `--help` to subcommands (ie. `streamdeck set-image --help`) displays options for that subcommand 51 | 52 | ``` 53 | streamdeck-cli 0.4.1 54 | A CLI for the Elgato StreamDeck 55 | 56 | USAGE: 57 | streamdeck-cli [OPTIONS] 58 | 59 | FLAGS: 60 | -h, --help Prints help information 61 | -V, --version Prints version information 62 | 63 | OPTIONS: 64 | --log-level Enable verbose logging [default: info] 65 | --pid USB Device Product ID (PID) in hex [env: USB_PID=] [default: 0063] 66 | --serial USB Device Serial [env: USB_SERIAL=] 67 | --vid USB Device Vendor ID (VID) in hex [env: USB_VID=] [default: 0fd9] 68 | 69 | SUBCOMMANDS: 70 | get-buttons Fetch button states 71 | help Prints this message or the help of the given subcommand(s) 72 | reset Reset the attached device 73 | set-brightness Set device display brightness 74 | set-colour Set button colours 75 | set-image Set button images 76 | version Fetch the device firmware version 77 | 78 | ``` 79 | 80 | ## Related Works 81 | 82 | This library stands on the shoulders of giants (who had already done all the reversing work)... 83 | 84 | You might also like to look at: 85 | 86 | - [streamdeck-rs](https://crates.io/crates/streamdeck-rs) for writing plugins to interact with the official Elgato SDK 87 | - [stream_deck_rs](https://crates.io/crates/stream_deck_rs) another project with similar goals 88 | - [@cliffrowley's streamdeck protocol notes](https://gist.github.com/cliffrowley/d18a9c4569537b195f2b1eb6c68469e0) 89 | - [python streamdeck library](https://github.com/abcminiuser/python-elgato-streamdeck) 90 | - [node-elgato-stream-deck](https://github.com/Lange/node-elgato-stream-deck/blob/master/NOTES.md) 91 | 92 | [Icons](icons/) from [material.io](https://material.io) and [brandeps.com](https://www.brandeps.com) 93 | 94 | -------------------------------------------------------------------------------- /icons/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/rust-streamdeck/06ce283ee0e08d7494bde4a40e244fbd2f07fba0/icons/camera.png -------------------------------------------------------------------------------- /icons/keyboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/rust-streamdeck/06ce283ee0e08d7494bde4a40e244fbd2f07fba0/icons/keyboard.png -------------------------------------------------------------------------------- /icons/mouse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/rust-streamdeck/06ce283ee0e08d7494bde4a40e244fbd2f07fba0/icons/mouse.png -------------------------------------------------------------------------------- /icons/power.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/rust-streamdeck/06ce283ee0e08d7494bde4a40e244fbd2f07fba0/icons/power.png -------------------------------------------------------------------------------- /icons/windows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ryankurte/rust-streamdeck/06ce283ee0e08d7494bde4a40e244fbd2f07fba0/icons/windows.png -------------------------------------------------------------------------------- /src/images.rs: -------------------------------------------------------------------------------- 1 | use std::str::FromStr; 2 | 3 | use image::codecs::jpeg::JpegEncoder; 4 | use image::io::Reader; 5 | use image::{imageops::FilterType, Pixel, Rgba}; 6 | use image::{DynamicImage, ExtendedColorType}; 7 | 8 | use crate::info::{ColourOrder, Mirroring, Rotation}; 9 | use crate::{rgb_to_bgr, Error}; 10 | 11 | /// Simple Colour object for re-writing backgrounds etc. 12 | #[derive(Debug, Clone)] 13 | #[cfg_attr(feature = "structopt", derive(structopt::StructOpt))] 14 | #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] 15 | pub struct Colour { 16 | #[cfg_attr(feature = "structopt", structopt(long))] 17 | pub r: u8, 18 | 19 | #[cfg_attr(feature = "structopt", structopt(long))] 20 | pub g: u8, 21 | 22 | #[cfg_attr(feature = "structopt", structopt(long))] 23 | pub b: u8, 24 | } 25 | 26 | impl FromStr for Colour { 27 | type Err = String; 28 | 29 | fn from_str(s: &str) -> Result { 30 | if s.len() != 6 && s.len() != 8 { 31 | return Err(format!("Expected colour in the hex form: RRGGBB")); 32 | } 33 | 34 | let r = 35 | u8::from_str_radix(&s[0..2], 16).map_err(|e| format!("int parsing error: {}", e))?; 36 | let g = 37 | u8::from_str_radix(&s[2..4], 16).map_err(|e| format!("int parsing error: {}", e))?; 38 | let b = 39 | u8::from_str_radix(&s[4..6], 16).map_err(|e| format!("int parsing error: {}", e))?; 40 | 41 | Ok(Self { r, g, b }) 42 | } 43 | } 44 | 45 | /// Options for image loading and editing 46 | #[derive(Debug)] 47 | #[cfg_attr(feature = "structopt", derive(structopt::StructOpt))] 48 | #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] 49 | pub struct ImageOptions { 50 | #[cfg_attr(feature = "structopt", structopt(long = "bg"))] 51 | /// Background colour 52 | background: Option, 53 | 54 | #[cfg_attr(feature = "structopt", structopt(long))] 55 | /// Invert colours 56 | invert: bool, 57 | } 58 | 59 | impl ImageOptions { 60 | pub fn new(background: Option, invert: bool) -> Self { 61 | ImageOptions { background, invert } 62 | } 63 | } 64 | 65 | impl Default for ImageOptions { 66 | fn default() -> Self { 67 | Self { 68 | background: None, 69 | invert: false, 70 | } 71 | } 72 | } 73 | 74 | pub(crate) fn apply_transform( 75 | image: DynamicImage, 76 | rotation: Rotation, 77 | mirroring: Mirroring, 78 | ) -> DynamicImage { 79 | let image = match rotation { 80 | Rotation::Rot0 => image, 81 | Rotation::Rot90 => image.rotate90(), 82 | Rotation::Rot180 => image.rotate180(), 83 | Rotation::Rot270 => image.rotate270(), 84 | }; 85 | let image = match mirroring { 86 | Mirroring::None => image, 87 | Mirroring::X => image.flipv(), 88 | Mirroring::Y => image.fliph(), 89 | Mirroring::Both => image.flipv().fliph(), 90 | }; 91 | image 92 | } 93 | 94 | /// Load an image from a file, resize to defined x and y, and apply the provided options 95 | pub(crate) fn load_image( 96 | path: &str, 97 | x: usize, 98 | y: usize, 99 | rotate: Rotation, 100 | mirror: Mirroring, 101 | opts: &ImageOptions, 102 | colour_order: ColourOrder, 103 | ) -> Result, Error> { 104 | // Open image reader 105 | let reader = match Reader::open(path) { 106 | Ok(v) => v, 107 | Err(e) => { 108 | error!("error loading file '{}': {:?}", path, e); 109 | return Err(Error::Io(e)); 110 | } 111 | }; 112 | 113 | // Load image 114 | let mut image = reader.decode().map_err(Error::Image)?; 115 | 116 | // Apply background filter / replace 117 | // This must be done before transparency is removed 118 | if let Some(c) = &opts.background { 119 | let rgba = image.as_mut_rgba8().unwrap(); 120 | 121 | let mut r = Rgba([c.r, c.g, c.b, 0]); 122 | if opts.invert { 123 | r.invert(); 124 | } 125 | 126 | for p in rgba.pixels_mut() { 127 | r.0[3] = 255 - p.0[3]; 128 | 129 | p.blend(&r); 130 | } 131 | } 132 | 133 | // Resize image 134 | let mut image = image.resize(x as u32, y as u32, FilterType::Gaussian); 135 | 136 | // Apply the requested mirroring transformation 137 | image = apply_transform(image, rotate, mirror); 138 | 139 | // Invert image if requir 140 | if opts.invert { 141 | image.invert(); 142 | } 143 | 144 | // Convert to vector with correct encoding 145 | let mut v = image.to_rgb8().into_vec(); 146 | if matches!(colour_order, ColourOrder::BGR) { 147 | rgb_to_bgr(&mut v); 148 | } 149 | 150 | if v.len() != x * y * 3 { 151 | return Err(Error::InvalidImageSize); 152 | } 153 | 154 | Ok(v) 155 | } 156 | 157 | /// Encodes a BGR bitmap into a JPEG image for outputting to a V2 device 158 | pub(crate) fn encode_jpeg(image: &[u8], width: usize, height: usize) -> Result, Error> { 159 | let mut buf = Vec::new(); 160 | let mut encoder = JpegEncoder::new_with_quality(&mut buf, 100); 161 | encoder.encode(image, width as u32, height as u32, ExtendedColorType::Rgb8)?; 162 | Ok(buf) 163 | } 164 | 165 | #[cfg(test)] 166 | mod test { 167 | use super::*; 168 | 169 | #[test] 170 | fn load_images() { 171 | let _image = load_image( 172 | "./icons/power.png", 173 | 72, 174 | 72, 175 | Rotation::Rot180, 176 | Mirroring::Both, 177 | &ImageOptions::default(), 178 | ColourOrder::BGR, 179 | ) 180 | .expect("error loading image"); 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /src/info.rs: -------------------------------------------------------------------------------- 1 | /// Stream Deck Device Kinds 2 | #[derive(Debug, Copy, Clone, PartialEq)] 3 | pub enum Kind { 4 | Original, 5 | OriginalV2, 6 | Mini, 7 | RevisedMini, 8 | Xl, 9 | Mk2, 10 | Plus, 11 | } 12 | 13 | /// Stream Deck key layout direction 14 | #[derive(Debug, Copy, Clone, PartialEq)] 15 | pub enum KeyDirection { 16 | LeftToRight, 17 | RightToLeft, 18 | } 19 | 20 | /// Stream Deck Image Modes 21 | #[derive(Debug, Clone, PartialEq)] 22 | pub enum ImageMode { 23 | Bmp, 24 | Jpeg, 25 | } 26 | 27 | /// Stream Deck color mode 28 | #[derive(Debug, Clone, PartialEq)] 29 | pub(crate) enum ColourOrder { 30 | RGB, 31 | BGR, 32 | } 33 | 34 | /// Rotation to apply to an image 35 | #[derive(Debug, Clone, PartialEq)] 36 | pub enum Rotation { 37 | Rot0, 38 | Rot90, 39 | Rot180, 40 | Rot270, 41 | } 42 | 43 | /// Mirroring to apply to an image 44 | #[derive(Debug, Clone, PartialEq)] 45 | pub enum Mirroring { 46 | None, 47 | X, 48 | Y, 49 | Both, 50 | } 51 | 52 | impl Kind { 53 | pub fn keys(&self) -> u8 { 54 | match self { 55 | Kind::Original | Kind::OriginalV2 | Kind::Mk2 => 15, 56 | Kind::Mini | Kind::RevisedMini => 6, 57 | Kind::Xl => 32, 58 | Kind::Plus => 8, 59 | } 60 | } 61 | 62 | // Offset for the first key in button report 63 | pub(crate) fn key_data_offset(&self) -> usize { 64 | match self { 65 | Kind::Original => 0, 66 | Kind::OriginalV2 | Kind::Mk2 => 3, 67 | Kind::Mini | Kind::RevisedMini => 0, 68 | Kind::Xl => 3, 69 | Kind::Plus => 3, 70 | } 71 | } 72 | 73 | pub(crate) fn key_direction(&self) -> KeyDirection { 74 | match self { 75 | Kind::Original => KeyDirection::RightToLeft, 76 | _ => KeyDirection::LeftToRight, 77 | } 78 | } 79 | 80 | pub(crate) fn key_index_offset(&self) -> u8 { 81 | match self { 82 | Kind::RevisedMini => 1, 83 | _ => 0, 84 | } 85 | } 86 | 87 | pub(crate) fn key_columns(&self) -> u8 { 88 | match self { 89 | Kind::Mini | Kind::RevisedMini => 3, 90 | Kind::Original | Kind::OriginalV2 | Kind::Mk2 => 5, 91 | Kind::Xl => 8, 92 | Kind::Plus => 4, 93 | } 94 | } 95 | 96 | pub fn image_mode(&self) -> ImageMode { 97 | match self { 98 | Kind::Original | Kind::Mini | Kind::RevisedMini => ImageMode::Bmp, 99 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 | Kind::Plus => ImageMode::Jpeg, 100 | } 101 | } 102 | 103 | pub fn image_size(&self) -> (usize, usize) { 104 | match self { 105 | Kind::Original | Kind::OriginalV2 | Kind::Mk2 => (72, 72), 106 | Kind::Mini | Kind::RevisedMini => (80, 80), 107 | Kind::Xl => (96, 96), 108 | Kind::Plus => (120, 120), 109 | } 110 | } 111 | 112 | pub fn image_rotation(&self) -> Rotation { 113 | match self { 114 | Kind::Mini | Kind::RevisedMini => Rotation::Rot270, 115 | _ => Rotation::Rot0, 116 | } 117 | } 118 | 119 | pub fn image_mirror(&self) -> Mirroring { 120 | match self { 121 | // Mini has rotation, not mirror 122 | Kind::Mini | Kind::RevisedMini | Kind::Plus => Mirroring::None, 123 | // On the original the image is flipped across the Y axis 124 | Kind::Original => Mirroring::Y, 125 | // On the V2 devices, both X and Y need to flip 126 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 => Mirroring::Both, 127 | } 128 | } 129 | 130 | pub fn image_size_bytes(&self) -> usize { 131 | let (x, y) = self.image_size(); 132 | x * y * 3 133 | } 134 | 135 | pub(crate) fn image_report_len(&self) -> usize { 136 | match self { 137 | Kind::Original => 8191, 138 | _ => 1024, 139 | } 140 | } 141 | 142 | pub(crate) fn image_report_header_len(&self) -> usize { 143 | match self { 144 | Kind::Original | Kind::Mini | Kind::RevisedMini => 16, 145 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 | Kind::Plus => 8, 146 | } 147 | } 148 | 149 | pub fn image_base(&self) -> &[u8] { 150 | match self { 151 | // BMP headers for the original and mini 152 | Kind::Original => &ORIGINAL_IMAGE_BASE, 153 | Kind::Mini | Kind::RevisedMini => &MINI_IMAGE_BASE, 154 | 155 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 | Kind::Plus => &[], 156 | } 157 | } 158 | 159 | pub(crate) fn image_colour_order(&self) -> ColourOrder { 160 | match self { 161 | Kind::Original | Kind::Mini | Kind::RevisedMini => ColourOrder::BGR, 162 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 | Kind::Plus => ColourOrder::RGB, 163 | } 164 | } 165 | 166 | pub(crate) fn is_v2(&self) -> bool { 167 | match self { 168 | Kind::OriginalV2 | Kind::Xl | Kind::Mk2 | Kind::Plus => true, 169 | _ => false, 170 | } 171 | } 172 | } 173 | 174 | pub const ORIGINAL_IMAGE_BASE: [u8; 54] = [ 175 | 0x42, 0x4d, 0xf6, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 176 | 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 177 | 0x00, 0x00, 0xc0, 0x3c, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0x00, 0x00, 178 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 179 | ]; 180 | 181 | const MINI_IMAGE_BASE: [u8; 54] = [ 182 | 0x42, 0x4d, 0xf6, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 183 | 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00, 0x00, 0x00, 184 | 0x00, 0x00, 0xc0, 0x3c, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0x00, 0x00, 185 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 186 | ]; 187 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::io::Error as IoError; 2 | use std::time::Duration; 3 | 4 | #[macro_use] 5 | extern crate log; 6 | 7 | extern crate hidapi; 8 | use ab_glyph::{FontRef, PxScale}; 9 | use hidapi::{HidApi, HidDevice, HidError}; 10 | 11 | extern crate image; 12 | use image::{DynamicImage, ImageBuffer, ImageError, Rgb}; 13 | 14 | pub mod images; 15 | use crate::images::{apply_transform, encode_jpeg}; 16 | pub use crate::images::{Colour, ImageOptions}; 17 | 18 | pub mod info; 19 | pub use info::*; 20 | 21 | use imageproc::drawing::draw_text_mut; 22 | use std::str::FromStr; 23 | use thiserror::Error; 24 | 25 | /// StreamDeck object 26 | pub struct StreamDeck { 27 | kind: Kind, 28 | device: HidDevice, 29 | } 30 | 31 | /// Helper object for filtering device connections 32 | #[cfg(feature = "structopt")] 33 | #[derive(structopt::StructOpt)] 34 | pub struct Filter { 35 | #[structopt(long, default_value="0fd9", parse(try_from_str=u16_parse_hex), env="USB_VID")] 36 | /// USB Device Vendor ID (VID) in hex 37 | pub vid: u16, 38 | 39 | #[structopt(long, default_value="0063", parse(try_from_str=u16_parse_hex), env="USB_PID")] 40 | /// USB Device Product ID (PID) in hex 41 | pub pid: u16, 42 | 43 | #[structopt(long, env = "USB_SERIAL")] 44 | /// USB Device Serial 45 | pub serial: Option, 46 | } 47 | 48 | fn u16_parse_hex(s: &str) -> Result { 49 | u16::from_str_radix(s, 16) 50 | } 51 | 52 | #[derive(Debug, Error)] 53 | pub enum Error { 54 | #[error(transparent)] 55 | Hid(#[from] HidError), 56 | #[error(transparent)] 57 | Io(#[from] IoError), 58 | #[error(transparent)] 59 | Image(#[from] ImageError), 60 | 61 | #[error("invalid image size")] 62 | InvalidImageSize, 63 | #[error("invalid key index")] 64 | InvalidKeyIndex, 65 | #[error("unrecognised pid")] 66 | UnrecognisedPID, 67 | #[error("unsupported input")] 68 | UnsupportedInput, 69 | #[error("no data")] 70 | NoData, 71 | } 72 | 73 | pub struct DeviceImage { 74 | data: Vec, 75 | } 76 | 77 | impl DeviceImage { 78 | /// Constructs [DeviceImage] from a byte array 79 | pub fn from_bytes(data: Vec) -> Self { 80 | Self::from(data) 81 | } 82 | } 83 | 84 | impl From> for DeviceImage { 85 | fn from(data: Vec) -> Self { 86 | Self { data } 87 | } 88 | } 89 | 90 | /// Device USB Product Identifiers (PIDs) 91 | pub mod pids { 92 | pub const ORIGINAL: u16 = 0x0060; 93 | pub const ORIGINAL_V2: u16 = 0x006d; 94 | pub const MINI: u16 = 0x0063; 95 | pub const XL: u16 = 0x006c; 96 | pub const MK2: u16 = 0x0080; 97 | pub const REVISED_MINI: u16 = 0x0090; 98 | pub const PLUS: u16 = 0x0084; 99 | } 100 | 101 | impl StreamDeck { 102 | /// Connect to a streamdeck device 103 | pub fn connect(vid: u16, pid: u16, serial: Option) -> Result { 104 | // Create new API 105 | let api = HidApi::new()?; 106 | StreamDeck::connect_with_hid(&api, vid, pid, serial) 107 | } 108 | 109 | /// Connect to a streamdeck device with an already initialise HidApi instance 110 | pub fn connect_with_hid( 111 | api: &HidApi, 112 | vid: u16, 113 | pid: u16, 114 | serial: Option, 115 | ) -> Result { 116 | // Match info based on PID 117 | let kind = match pid { 118 | pids::ORIGINAL => Kind::Original, 119 | pids::MINI => Kind::Mini, 120 | 121 | pids::ORIGINAL_V2 => Kind::OriginalV2, 122 | pids::XL => Kind::Xl, 123 | pids::MK2 => Kind::Mk2, 124 | pids::REVISED_MINI => Kind::RevisedMini, 125 | pids::PLUS => Kind::Plus, 126 | 127 | _ => return Err(Error::UnrecognisedPID), 128 | }; 129 | 130 | debug!("Device info: {:?}", kind); 131 | 132 | // Attempt to connect to device 133 | let device = match &serial { 134 | Some(s) => api.open_serial(vid, pid, s), 135 | None => api.open(vid, pid), 136 | }?; 137 | 138 | // Return streamdeck object 139 | Ok(StreamDeck { device, kind }) 140 | } 141 | 142 | /// Fetch the connected device kind 143 | /// 144 | /// This can be used to retrieve related device information such as 145 | /// images sizes and modes 146 | pub fn kind(&self) -> Kind { 147 | self.kind 148 | } 149 | 150 | /// Fetch the device manufacturer string 151 | pub fn manufacturer(&mut self) -> Result { 152 | let s = self.device.get_manufacturer_string()?; 153 | Ok(s.unwrap()) 154 | } 155 | 156 | /// Fetch the device product string 157 | pub fn product(&mut self) -> Result { 158 | let s = self.device.get_product_string()?; 159 | Ok(s.unwrap()) 160 | } 161 | 162 | /// Fetch the device serial 163 | pub fn serial(&mut self) -> Result { 164 | let s = self.device.get_serial_number_string()?; 165 | Ok(s.unwrap()) 166 | } 167 | 168 | /// Fetch the device firmware version 169 | pub fn version(&mut self) -> Result { 170 | let mut buff = [0u8; 17]; 171 | buff[0] = if self.kind.is_v2() { 0x05 } else { 0x04 }; 172 | 173 | let _s = self.device.get_feature_report(&mut buff)?; 174 | 175 | let offset = if self.kind.is_v2() { 6 } else { 5 }; 176 | Ok(std::str::from_utf8(&buff[offset..]).unwrap().to_string()) 177 | } 178 | 179 | /// Reset the connected device 180 | pub fn reset(&mut self) -> Result<(), Error> { 181 | let mut cmd = [0u8; 17]; 182 | 183 | if self.kind.is_v2() { 184 | cmd[..2].copy_from_slice(&[0x03, 0x02]); 185 | } else { 186 | cmd[..2].copy_from_slice(&[0x0b, 0x63]); 187 | } 188 | 189 | self.device.send_feature_report(&cmd)?; 190 | 191 | Ok(()) 192 | } 193 | 194 | /// Set the device display brightness (in percent) 195 | pub fn set_brightness(&mut self, brightness: u8) -> Result<(), Error> { 196 | let mut cmd = [0u8; 17]; 197 | 198 | let brightness = brightness.min(100); 199 | 200 | if self.kind.is_v2() { 201 | cmd[..3].copy_from_slice(&[0x03, 0x08, brightness]); 202 | } else { 203 | cmd[..6].copy_from_slice(&[0x05, 0x55, 0xaa, 0xd1, 0x01, brightness]); 204 | } 205 | 206 | self.device.send_feature_report(&cmd)?; 207 | 208 | Ok(()) 209 | } 210 | 211 | /// Set blocking mode 212 | /// 213 | /// See: `read_buttons` for discussion of this functionality 214 | pub fn set_blocking(&mut self, blocking: bool) -> Result<(), Error> { 215 | self.device.set_blocking_mode(blocking)?; 216 | 217 | Ok(()) 218 | } 219 | 220 | /// Probe for connected devices. 221 | /// 222 | /// Returns a list of results, 223 | /// each containing the device kind and PID or an error if the PID is unrecognised 224 | pub fn probe() -> Result>, Error> { 225 | let api = HidApi::new()?; 226 | let mut available_devices = vec![]; 227 | for device in api.device_list() { 228 | if device.vendor_id() == 0x0fd9 { 229 | let deck = match device.product_id() { 230 | pids::MK2 => Ok((Kind::Mk2, pids::MK2)), 231 | pids::XL => Ok((Kind::Xl, pids::XL)), 232 | pids::ORIGINAL_V2 => Ok((Kind::OriginalV2, pids::ORIGINAL_V2)), 233 | pids::ORIGINAL => Ok((Kind::Original, pids::ORIGINAL)), 234 | pids::MINI => Ok((Kind::Mini, pids::MINI)), 235 | pids::PLUS => Ok((Kind::Plus, pids::PLUS)), 236 | _ => Err(Error::UnrecognisedPID) 237 | }; 238 | available_devices.push(deck); 239 | } 240 | } 241 | Ok(available_devices) 242 | } 243 | 244 | /// Fetch button states 245 | /// 246 | /// In blocking mode this will wait until a report packet has been received 247 | /// (or the specified timeout has elapsed). In non-blocking mode this will return 248 | /// immediately with a zero vector if no data is available 249 | pub fn read_buttons(&mut self, timeout: Option) -> Result, Error> { 250 | let mut cmd = [0u8; 36]; 251 | let keys = self.kind.keys() as usize; 252 | let offset = self.kind.key_data_offset(); 253 | 254 | match timeout { 255 | Some(t) => self 256 | .device 257 | .read_timeout(&mut cmd[..keys + offset + 1], t.as_millis() as i32)?, 258 | None => self.device.read(&mut cmd[..keys + offset + 1])?, 259 | }; 260 | 261 | if cmd[0] == 0 { 262 | return Err(Error::NoData); 263 | } 264 | 265 | if self.kind == Kind::Plus { 266 | //If the second byte is not 0, a dial or the touchscreen was used, we don't support that here 267 | //This would write to indices which represent buttons and thus create faulty output 268 | if cmd[1] != 0 { 269 | return Err(Error::UnsupportedInput); 270 | } 271 | } 272 | 273 | let mut out = vec![0u8; keys]; 274 | match self.kind.key_direction() { 275 | KeyDirection::RightToLeft => { 276 | for (i, val) in out.iter_mut().enumerate() { 277 | // In right-to-left mode(original Streamdeck) the first key has index 1, 278 | // so we don't add the +1 here. 279 | *val = cmd[offset + self.translate_key_index(i as u8)? as usize]; 280 | } 281 | } 282 | KeyDirection::LeftToRight => { 283 | out[0..keys].copy_from_slice(&cmd[1 + offset..1 + offset + keys]); 284 | } 285 | } 286 | 287 | Ok(out) 288 | } 289 | 290 | /// Fetch image size for the connected device 291 | pub fn image_size(&self) -> (usize, usize) { 292 | self.kind.image_size() 293 | } 294 | 295 | /// Convert an image into the device dependent format 296 | fn convert_image(&self, image: Vec) -> Result { 297 | // Check image dimensions 298 | if image.len() != self.kind.image_size_bytes() { 299 | return Err(Error::InvalidImageSize); 300 | } 301 | let image = match self.kind.image_mode() { 302 | ImageMode::Bmp => image, 303 | ImageMode::Jpeg => { 304 | let (w, h) = self.kind.image_size(); 305 | encode_jpeg(&image, w, h)? 306 | } 307 | }; 308 | Ok(DeviceImage { data: image }) 309 | } 310 | 311 | /// Set a button to the provided RGB colour 312 | pub fn set_button_rgb(&mut self, key: u8, colour: &Colour) -> Result<(), Error> { 313 | let mut image = vec![0u8; self.kind.image_size_bytes()]; 314 | let colour_order = self.kind.image_colour_order(); 315 | 316 | for i in 0..image.len() { 317 | match i % 3 { 318 | 0 => { 319 | image[i] = match colour_order { 320 | ColourOrder::BGR => colour.b, 321 | ColourOrder::RGB => colour.r, 322 | } 323 | } 324 | 1 => image[i] = colour.g, 325 | 2 => { 326 | image[i] = match colour_order { 327 | ColourOrder::BGR => colour.r, 328 | ColourOrder::RGB => colour.b, 329 | } 330 | } 331 | _ => unreachable!(), 332 | }; 333 | } 334 | self.write_button_image(key, &self.convert_image(image)?)?; 335 | 336 | Ok(()) 337 | } 338 | 339 | /// Set a button to the provided image 340 | pub fn set_button_image(&mut self, key: u8, image: DynamicImage) -> Result<(), Error> { 341 | let image = apply_transform(image, self.kind.image_rotation(), self.kind.image_mirror()); 342 | let mut data = image.into_rgb8().into_vec(); 343 | if matches!(self.kind.image_colour_order(), ColourOrder::BGR) { 344 | rgb_to_bgr(&mut data); 345 | } 346 | self.write_button_image(key, &self.convert_image(data)?) 347 | } 348 | 349 | /// Sets a button to the provided text. 350 | /// Will break text over \n linebreaks 351 | pub fn set_button_text( 352 | &mut self, 353 | key: u8, 354 | font: &FontRef, 355 | pos: &TextPosition, 356 | text: &str, 357 | opts: &TextOptions, 358 | ) -> Result<(), Error> { 359 | let (width, height) = self.kind.image_size(); 360 | let background = Rgb([opts.background.r, opts.background.g, opts.background.b]); 361 | let colour = Rgb([opts.foreground.r, opts.foreground.g, opts.foreground.b]); 362 | let mut image = ImageBuffer::from_pixel(width as u32, height as u32, background); 363 | 364 | match pos { 365 | TextPosition::Absolute { x, y } => { 366 | let mut y = *y; 367 | text.to_string().split("\n").for_each(|txt| { 368 | draw_text_mut(&mut image, colour, *x, y, opts.scale, font, txt); 369 | y += (opts.scale.y * opts.line_height).round() as i32; 370 | }); 371 | } 372 | } 373 | 374 | self.set_button_image(key, DynamicImage::ImageRgb8(image)) 375 | } 376 | 377 | /// Set a button to the provided image file 378 | pub fn set_button_file( 379 | &mut self, 380 | key: u8, 381 | image: &str, 382 | opts: &ImageOptions, 383 | ) -> Result<(), Error> { 384 | self.write_button_image(key, &self.load_image(image, opts)?) 385 | } 386 | 387 | /// Load an image file into the device specific representation 388 | pub fn load_image(&self, image: &str, opts: &ImageOptions) -> Result { 389 | let (x, y) = self.kind.image_size(); 390 | let rotate = self.kind.image_rotation(); 391 | let mirror = self.kind.image_mirror(); 392 | 393 | let image = images::load_image( 394 | image, 395 | x, 396 | y, 397 | rotate, 398 | mirror, 399 | opts, 400 | self.kind.image_colour_order(), 401 | )?; 402 | self.convert_image(image) 403 | } 404 | 405 | /// Transforms a key from zero-indexed left-to-right into the device-correct coordinate system 406 | fn translate_key_index(&self, key: u8) -> Result { 407 | if key > self.kind.keys() { 408 | return Err(Error::InvalidKeyIndex); 409 | } 410 | let mapped = match self.kind.key_direction() { 411 | // All but the original Streamdeck already have correct coordinates 412 | KeyDirection::LeftToRight => key + self.kind.key_index_offset(), 413 | // The original Streamdeck uses 1-indexed right-to-left 414 | KeyDirection::RightToLeft => { 415 | let cols = self.kind.key_columns() as u8; 416 | let col = key % cols; 417 | let row = key / cols; 418 | row * cols + cols - col 419 | } 420 | }; 421 | Ok(mapped) 422 | } 423 | 424 | /// Writes an image to a button 425 | /// Image at this point in correct dimensions and in device native colour order. 426 | pub fn write_button_image(&mut self, key: u8, image: &DeviceImage) -> Result<(), Error> { 427 | let image = &image.data; 428 | let key = self.translate_key_index(key)?; 429 | 430 | let mut buf = vec![0u8; self.kind.image_report_len()]; 431 | let base = self.kind.image_base(); 432 | let hdrlen = self.kind.image_report_header_len(); 433 | 434 | match self.kind { 435 | Kind::Original => { 436 | // Original Streamdeck uses static lengths, not the dynamically sized protocol on the 437 | // later versions. First packet contains the initial 7749 bytes. 438 | self.write_image_header(&mut buf, key, 1, false, 0); 439 | let start = hdrlen + base.len(); 440 | buf[hdrlen..start].copy_from_slice(base); 441 | buf[start..start + 7749].copy_from_slice(&image[0..7749]); 442 | self.device.write(&buf)?; 443 | 444 | // Second packet contains the last 7803 bytes 445 | self.write_image_header(&mut buf, key, 2, true, 0); 446 | buf[hdrlen..hdrlen + 7803].copy_from_slice(&image[7749..15552]); 447 | self.device.write(&buf)?; 448 | 449 | Ok(()) 450 | } 451 | 452 | _ => { 453 | let mut sequence = 0; 454 | let mut offset = 0; 455 | let maxdatalen = buf.len() - hdrlen; 456 | 457 | while offset < image.len() { 458 | let mut take = (image.len() - offset).min(maxdatalen); 459 | let mut start = hdrlen; 460 | 461 | if sequence == 0 && !base.is_empty() { 462 | trace!("outputting base"); 463 | buf[start..start + base.len()].copy_from_slice(base); 464 | // Recalculate take with the smaller room 465 | take = (image.len() - offset).min(maxdatalen - base.len()); 466 | start += base.len(); 467 | } 468 | 469 | let is_last = take == image.len() - offset; 470 | self.write_image_header(&mut buf, key, sequence, is_last, take); 471 | buf[start..start + take].copy_from_slice(&image[offset..offset + take]); 472 | 473 | trace!( 474 | "outputting image chunk [{}..{}[ in [{}..{}[, sequence {}{}", 475 | offset, 476 | offset + take, 477 | start, 478 | start + take, 479 | sequence, 480 | if is_last { " (last)" } else { "" }, 481 | ); 482 | self.device.write(&buf)?; 483 | 484 | sequence += 1; 485 | offset += take; 486 | } 487 | Ok(()) 488 | } 489 | } 490 | } 491 | 492 | /// Writes the image report header to the given buffer 493 | fn write_image_header( 494 | &self, 495 | buf: &mut [u8], 496 | key: u8, 497 | sequence: u16, 498 | is_last: bool, 499 | payload_len: usize, 500 | ) { 501 | if self.kind.is_v2() { 502 | buf[0] = 0x02; 503 | buf[1] = 0x07; 504 | buf[2] = key; 505 | buf[3] = if is_last { 1 } else { 0 }; 506 | buf[4..6].copy_from_slice(&(payload_len as u16).to_le_bytes()); 507 | buf[6..8].copy_from_slice(&sequence.to_le_bytes()); 508 | } else { 509 | buf[0] = 0x02; 510 | buf[1] = 0x01; 511 | buf[2..4].copy_from_slice(&sequence.to_le_bytes()); 512 | buf[4] = if is_last { 1 } else { 0 }; 513 | buf[5] = key; 514 | } 515 | } 516 | } 517 | 518 | /// TextPosition is how to position text via set_button_text 519 | pub enum TextPosition { 520 | /// Absolute positioning 521 | Absolute { x: i32, y: i32 }, 522 | } 523 | 524 | /// Text Options provide values for text buttons 525 | pub struct TextOptions { 526 | foreground: Colour, 527 | background: Colour, 528 | scale: PxScale, 529 | line_height: f32, 530 | } 531 | 532 | impl TextOptions { 533 | pub fn new(foreground: Colour, background: Colour, scale: PxScale, line_height: f32) -> Self { 534 | TextOptions { 535 | foreground, 536 | background, 537 | scale, 538 | line_height, 539 | } 540 | } 541 | } 542 | 543 | impl Default for TextOptions { 544 | /// default is white text on a black background, with 15 pixel high text 545 | /// and 1.1x the line height. 546 | fn default() -> Self { 547 | TextOptions { 548 | foreground: Colour::from_str("FFFFFF").unwrap(), 549 | background: Colour::from_str("000000").unwrap(), 550 | scale: PxScale { x: 15.0, y: 15.0 }, 551 | line_height: 1.1, 552 | } 553 | } 554 | } 555 | 556 | // Convert RGB image data to BGR 557 | fn rgb_to_bgr(data: &mut Vec) { 558 | for chunk in data.chunks_exact_mut(3) { 559 | chunk.swap(0, 2); 560 | } 561 | } 562 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | 2 | #[macro_use] extern crate log; 3 | extern crate simplelog; 4 | use simplelog::{TermLogger, LevelFilter, TerminalMode, ColorChoice}; 5 | 6 | extern crate structopt; 7 | use structopt::StructOpt; 8 | 9 | extern crate humantime; 10 | use humantime::Duration; 11 | 12 | use streamdeck::{StreamDeck, Filter, Colour, ImageOptions, Error}; 13 | 14 | #[derive(StructOpt)] 15 | #[structopt(name = "streamdeck-cli", about = "A CLI for the Elgato StreamDeck")] 16 | struct Options { 17 | 18 | #[structopt(subcommand)] 19 | cmd: Commands, 20 | 21 | #[structopt(flatten)] 22 | filter: Filter, 23 | 24 | #[structopt(long = "log-level", default_value = "info")] 25 | /// Enable verbose logging 26 | level: LevelFilter, 27 | } 28 | 29 | #[derive(StructOpt)] 30 | pub enum Commands { 31 | /// Reset the attached device 32 | Reset, 33 | /// Fetch the device firmware version 34 | Version, 35 | /// Search for connected streamdecks 36 | Probe, 37 | /// Set device display brightness 38 | SetBrightness{ 39 | /// Brightness value from 0 to 100 40 | brightness: u8, 41 | }, 42 | /// Fetch button states 43 | GetButtons { 44 | #[structopt(long)] 45 | /// Timeout for button reading 46 | timeout: Option, 47 | 48 | #[structopt(long)] 49 | /// Read continuously 50 | continuous: bool, 51 | }, 52 | /// Set button colours 53 | SetColour { 54 | /// Index of button to be set 55 | key: u8, 56 | 57 | #[structopt(flatten)] 58 | colour: Colour, 59 | }, 60 | /// Set button images 61 | SetImage { 62 | /// Index of button to be set 63 | key: u8, 64 | 65 | /// Image file to be loaded 66 | file: String, 67 | 68 | #[structopt(flatten)] 69 | opts: ImageOptions, 70 | } 71 | } 72 | 73 | fn main() { 74 | // Parse options 75 | let opts = Options::from_args(); 76 | 77 | // Setup logging 78 | let mut config = simplelog::ConfigBuilder::new(); 79 | config.set_time_level(LevelFilter::Off); 80 | 81 | TermLogger::init(opts.level, config.build(), TerminalMode::Mixed, ColorChoice::Auto).unwrap(); 82 | 83 | // Connect to device 84 | let mut deck = match StreamDeck::connect(opts.filter.vid, opts.filter.pid, opts.filter.serial) { 85 | Ok(d) => d, 86 | Err(e) => { 87 | error!("Error connecting to streamdeck: {:?}", e); 88 | return 89 | } 90 | }; 91 | 92 | let serial = deck.serial().unwrap(); 93 | info!("Connected to device (vid: {:04x} pid: {:04x} serial: {})", 94 | opts.filter.vid, opts.filter.pid, serial); 95 | 96 | // Run the command 97 | if let Err(e) = do_command(&mut deck, opts.cmd) { 98 | error!("Command error: {:?}", e); 99 | } 100 | } 101 | 102 | fn do_command(deck: &mut StreamDeck, cmd: Commands) -> Result<(), Error> { 103 | match cmd { 104 | Commands::Reset => { 105 | deck.reset()?; 106 | }, 107 | Commands::Version => { 108 | let version = deck.version()?; 109 | info!("Firmware version: {}", version); 110 | } 111 | Commands::SetBrightness{brightness} => { 112 | deck.set_brightness(brightness)?; 113 | }, 114 | Commands::GetButtons{timeout, continuous} => { 115 | loop { 116 | let buttons = deck.read_buttons(timeout.map(|t| *t ))?; 117 | info!("buttons: {:?}", buttons); 118 | 119 | if !continuous { 120 | break 121 | } 122 | } 123 | }, 124 | Commands::Probe => { 125 | let results = StreamDeck::probe()?; 126 | if results.is_empty() { 127 | info!("No devices found"); 128 | return Ok(()); 129 | } 130 | info!("Found {} devices", results.len()); 131 | for res in results { 132 | match res { 133 | Ok((device, pid)) => info!("Streamdeck: {:?} (pid: {:#x})", device, pid), 134 | Err(_) => warn!("Found Elgato device with unsupported PID"), 135 | } 136 | } 137 | } 138 | Commands::SetColour{key, colour} => { 139 | info!("Setting key {} colour to: ({:?})", key, colour); 140 | deck.set_button_rgb(key, &colour)?; 141 | }, 142 | Commands::SetImage{key, file, opts} => { 143 | info!("Setting key {} to image: {}", key, file); 144 | deck.set_button_file(key, &file, &opts)?; 145 | } 146 | } 147 | 148 | Ok(()) 149 | } 150 | --------------------------------------------------------------------------------