VVEIRD / StreamDeckCore

Java implementation for the Elgato Stream Deck
MIT License
31 stars 14 forks source link

Purejavahidapi and Jna no more compatible? #4

Open Adi-18 opened 4 years ago

Adi-18 commented 4 years ago

Its a nice projeckt bat it looks like its no more compatible with new Stream Deck (5 x 3 Buttons).

There was some exceptions. After inserted jna 5.5.0 and build current nyholku/urejavahidapi. I have still exception while running Example1_Displaying_A_Key.java Vendor-ID: 4057, Product-ID: 109 Found ESD [4057:109] Connected Stream Decks: Manufacurer: Elgato Product: Stream Deck Device-Id: HID\VID_0FD9&PID_006D\8&3992574&0&0000 Serial-No: AL17J2C01756 Path: \?\hid#vid_0fd9&pid_006d#8&3992574&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

Error sending the following command-class to the esd: class de.rcblum.stream.deck.device.StreamDeck$IconUpdater
java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at purejavahidapi.windows.HidDevice.setOutputReport(HidDevice.java:170)
    at de.rcblum.stream.deck.device.StreamDeck.internalDrawImage(StreamDeck.java:463)
    at de.rcblum.stream.deck.device.StreamDeck$IconUpdater.run(StreamDeck.java:230)
    at de.rcblum.stream.deck.device.StreamDeck$DeckWorker.run(StreamDeck.java:182)
    at java.lang.Thread.run(Thread.java:748)

It means the place with System.arraycopy(data, 0, m_OutputReportArray, 1, length)

    @Override
    synchronized public int setOutputReport(byte reportID, byte[] data, int length) {
        if (!m_Open)
            throw new IllegalStateException("device not open");
        if (m_OutputReportLength == 0)
            throw new IllegalArgumentException("this device supports no output reports");
        // In Windows writeFile() to HID device data has to be preceded with the report
        // number, regardless
        Arrays.fill(m_OutputReportArray, (byte)0);
        m_OutputReportArray[0] = reportID;
        System.arraycopy(data, 0, m_OutputReportArray, 1, length);

Length of data is 8190 but m_OutputReportArray is only 1024 get from caps.OutputReportByteLength; Where is this from?

m-10-c commented 1 year ago

Hi, it's a nice project indeed, I was also interested to get it working with the mk2 version, and was able to figure it out at least up to registering RunnableItem and StreamKeyListener. The differences compared to the earlier streamdeck version seem to be