Julusian / node-elgato-stream-deck

A Node.js library for interfacing with the Elgato Stream Deck. https://julusian.github.io/node-elgato-stream-deck/
https://www.npmjs.com/org/elgato-stream-deck
MIT License
159 stars 22 forks source link

Device.getStreamDecks fails when another vendor's device is paired #60

Closed deleolajide closed 1 year ago

deleolajide commented 1 year ago

This code fails because it assumes that the device list is filtered by vendor. This is the case with navigator.hid.requestDevice, but not with navigator.hid.getDevices which returns all paired devices in respect of vendor

https://github.com/Julusian/node-elgato-stream-deck/blob/c1a996eeb5aeccfbc543a9860d88f65b5ec3be64/packages/webhid/src/index.ts#L29

I have currently hacked the code by disabling the exception and returning null instead

    const model = DEVICE_MODELS.find((m) => m.productId === browserDevice.productId)
    if (!model) {
        // throw new Error('Stream Deck is of unexpected type.')
        console.warn('Stream Deck is of unexpected type.')
               return;
    }
Julusian commented 1 year ago

Thanks, this is fixed now in @elgato-stream-deck/webhid@5.7.1