Arduino Cyclone X10 Emulator

I’ve got an Arduino MKR, which is supposed to be able to appear as USB peripherals, and I thought I’d give this a shot, since while there’s also a vibrating toy that uses the same interface as the cyclone they seem pretty hard to get. I’d have to either change the vid and pid of the board (apparently possible, but annoying) or modify the game files to point to the board (see above), but it should be doable. However, I’m running into issues.

Here’s my current test code.

#include "HID-Project.h"

uint8_t rawhidData[255];




void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  while (!Serial);
  RawHID.begin(rawhidData, sizeof(rawhidData));
  Keyboard.begin(); //HidSharp doesn't seem to see the board without this.
  Serial.println("Ready.");
}

void loop() {
  // put your main code here, to run repeatedly:



  auto bytesAvailable = RawHID.available();
  if (bytesAvailable) {
    while (bytesAvailable--) {
      Serial.print(RawHID.read());
    }
    Serial.println("==");
    // RawHID.enableFeatureReport();
  }
  delay(5);
}

I’m testing this using Intiface (edited the cyclone entry to point to the board) and Scriptplayer. As soon as I try anything that would send a command, I see that one command in the serial monitor, but then Scriptplayer disconnects from the intiface server and will not reconnect until restarting the server or (maybe) a significant delay.

So obviously I’m missing something, but I don’t know enough about how the USB stuff works to even guess what the problem is, and there aren’t any error messages in the log that I can see. (Even after setting the log level to Trace.

Anyone have any suggestions?