45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""Elgato StreamDeck Python Library."""
|
|
from enum import IntEnum
|
|
|
|
from greendeck.lib.elgato.streamdeck import StreamDeck
|
|
from greendeck.lib.elgato.streamdeck.original_v2 import StreamDeckOriginalV2
|
|
from greendeck.lib.hidapi.device import enumerate_devices
|
|
|
|
|
|
class VendorIDs(IntEnum):
|
|
"""Elgato StreamDeck USB Vendor IDs."""
|
|
|
|
USB_VID_ELGATO = 0x0FD9
|
|
|
|
|
|
class ProductIDs(IntEnum):
|
|
"""Elgato StreamDeck USB product IDs."""
|
|
|
|
USB_PID_STREAMDECK_ORIGINAL = 0x0060
|
|
USB_PID_STREAMDECK_ORIGINAL_V2 = 0x006D
|
|
USB_PID_STREAMDECK_MINI = 0x0063
|
|
USB_PID_STREAMDECK_XL = 0x006C
|
|
USB_PID_STREAMDECK_XL_V2 = 0x008F
|
|
USB_PID_STREAMDECK_MK2 = 0x0080
|
|
USB_PID_STREAMDECK_PEDAL = 0x0086
|
|
USB_PID_STREAMDECK_MINI_MK2 = 0x0090
|
|
USB_PID_STREAMDECK_PLUS = 0x0084
|
|
|
|
|
|
async def enumerate_streamdecks() -> list[StreamDeck]:
|
|
"""Return a list of StreamDecks installed on the system."""
|
|
streamdecks: list[StreamDeck] = []
|
|
|
|
for device in await enumerate_devices():
|
|
match (device.vendor_id, device.product_id):
|
|
case (
|
|
VendorIDs.USB_VID_ELGATO,
|
|
ProductIDs.USB_PID_STREAMDECK_ORIGINAL_V2,
|
|
):
|
|
streamdecks.append(StreamDeckOriginalV2(device))
|
|
|
|
case _:
|
|
pass
|
|
|
|
return streamdecks
|