Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rigor789/mirabox-streamdock-node

MiraBox StreamDock reverse-engineered communication protocol example
https://github.com/rigor789/mirabox-streamdock-node

mirabox mirabox293 node protocol reverse-engineering streamdock streamdock293 usb usb-hid

Last synced: 4 days ago
JSON representation

MiraBox StreamDock reverse-engineered communication protocol example

Awesome Lists containing this project

README

        

# MiraBox StreamDock reverse-engineer

The MiraBox StreamDock has semi-oss drivers that have the USB HID logic inside a pre-compiled library. Out of curiousity, I reverse engineered the USB packets and wrote this demo to show how one might control the device directly without the official drivers.

![MiraBox StreamDock running this demo](https://github.com/user-attachments/assets/f2c56dfb-0cb7-40cc-9816-999c73a06d31)

This is just an experiment, and possibly has some bugs, and potential for improvements.

## Supported Functions

- read firmware version
- wake screen
- clear screen
- refresh
- set brightness
- set key image
- set boot image
- receive key presses

> **Note:** Only tested on **MiraBox 293**.

## API

```ts
import { StreamDock, USBBackend } from "./streamdock";

interface USBBackend {
send(data: Buffer): Promise;
receive(byteSize?: number): Promise;
controlTransfer(
bmRequestType: number,
bRequest: number,
wValue: number,
wIndex: number,
wLength: number
): Promise;
}

const backend: USBBackend;
const sd = new StreamDock(backend);

console.log(await sd.getFirmwareVersion());
await sd.wakeScreen();
await sd.clearScreen();
await sd.setBrightness(0x19);
await sd.setKeyImage(i, path.join(process.cwd(), "test1.png"));
await sd.setBootImage(path.join(process.cwd(), "logo.jpg"));

while (true) {
const { keyId, state } = await sd.receiveKeyPress();
console.log("Key", keyId, "state", state);
}
```

See [Main Demo](./src/index.ts) for a concrete example.

## Run the repo

1. clone
1. `npm install`
1. `npm start`

> **Note**: on macos, I need to run `sudo npm start` to be able to access the usb HID device.