scratchfoundation / scratch-link

Device interoperability layer for Windows and MacOS
BSD 3-Clause "New" or "Revised" License
102 stars 83 forks source link

Add USB HID support #146

Open dolmen opened 5 years ago

dolmen commented 5 years ago

Feature request

Add support for USB HID devices.

Use case: LEGO Dimensions Toypad extension

I would like to implement a Scratch 3.0 extension for the LEGO Dimensions Toypad created for the LEGO Dimensions console game. I want to give a second life to this hardware device that was created for a video game that is now abandoned by WB Games/LEGO. As this is an end-of-life product it is quite cheap device.

The LEGO Dimensions toypad PS3/PS4 is a USB HID device.

I have already a good understanding of the protocol between the toypad and a computer as I have implemented myself a Go library and tools to interact with the toypad. Some other implementations in JS already exist too.

So far documentation of Scratch 3.0 hardware extensions is quite lacking. The wiki seems to contain only documentation which is irrelevant to Scratch 3.0 (tell me if I'm wrong). I finally found this project.

To implement a LEGO Dimensions Toypad extension it looks like I need:

I also wonder if implementing a USB HID / WebSocket+JSON-RPC 2.0 gateway that implements the scratch-link network protocol in Go (as this is my favorite programming language) as a scratch-link bypass would be a viable option to quickly prototype my extension (the JS part). But I have not yet found how Scratch connects to scratch-link (how does it finds IP, port?) and where the JS has to be installed to work with Scratch Desktop.