Question Emulate keystrokes on PC to send to Switch via USB?

Discussion in 'Switch - Emulation, Homebrew & Software Projects' started by DiscostewSM, May 15, 2019.

  1. DiscostewSM
    OP

    DiscostewSM GBAtemp Guru

    Member
    13
    Feb 10, 2009
    United States
    Sacramento, California
    "Emulate keystrokes? Why would you want that when you can just plug in a USB keyboard to Switch?"

    Hear me out.

    In a few weeks, FUZE4 will be released, which is a text-based programming language/environment for the Switch where you can create your own stuff. I'm hoping to make a few things with it, including porting my Mega Man 2 PTC project to it (originally made for Petit Computer on the DSi). The languages are incompatible, so I'd have to redo it. While I could do it straight on the Switch, doing such a thing right on a system isn't how I did my previous project. When I did that one, I did the majority of my programming, editing of images, compression, etc all on my PC, and used PTCUtilities to generate QR codes and then scan them into my 3DS. FUZE4, according to the devs and likely controlled by Nintendo, has no means to inject data externally with the exception of one. A USB keyboard, one character at a time.

    My thought, if possible, is connect the Switch to a PC via USB, and on the PC side, have a program that can send emulated keystrokes to the Switch. Not simply using a PC's keyboard, but even have a kind of copy/paste function where it'll stream a selection of data via emulated keystrokes from PC to Switch. Not exactly a fast way of sending a LOT of data, but a way nonetheless.

    "Sure, good for code, but what about graphics? Audio? Everything else?"

    Well, as far as I understand, assets made with the program, like graphics, use the program's own file handling functions to read/write them. So technically, we could code a file-write program with the asset inserted as static data, send it all as code, then run the program for it to write that asset to memory. An advantage of having all the stuff on the PC to send it to Switch in this fashion is that it'll allow sharing beyond the scope allowed by the devs. What they said was that sharing of projects is restricted to the friend list, but if we have the data outside of the program, we can share it however we want.

    So yeah........is there a program that could allow this, or maybe someone could make one? Doesn't even have to be specifically PC->Switch, just having a PC act like a keyboard to whatever else connects to it.
     
  2. galaxior

    galaxior Newbie

    Newcomer
    1
    Apr 25, 2019
    United Kingdom
    A pure software solution is not possible due to the nature of USB. USB is asymmetric and one side is the host and the other is the peripheral device. It's pretty much guaranteed that your computer's USB ports can only act in host mode whereas they'd need to be able to operate as a peripheral for this to work.

    It's technically possible for a USB port to operate as either but this is typically only found in mobile devices and is known as USB OTG (On the go), with a OTG supporting device what you suggest should be possible

    One of the easiest/cheapest hardware devices to do this would be using a Raspberry Pi Zero which has OTG fucntionality and could act as a HID keyboard. There are many tutorials demonstrating how it can be done

    With the Pi in place and connected to the Switch you you could just forward your keyboard inputs (or an entire text selection as you suggest) over to the pi via WiFi and it could relay them to the Switch
     
    Last edited by galaxior, May 15, 2019
  3. The Real Jdbye

    The Real Jdbye Always Remember 30/07/08

    Member
    19
    GBAtemp Patron
    The Real Jdbye is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Mar 17, 2010
    Norway
    Alola
    An Arduino or a Teensy of some sort would also work.
     
  4. stitchxd

    stitchxd GBAtemp Fan

    Member
    4
    Apr 27, 2017
    United States
    nope
    The switch has Keyboard support, it might be possible to create a sysmodule (and a driver for windows/linux) to do what OP is looking for. Sys module will take virtual key input from the PC and pass it to the Switch's kernel as key input. I wouldn't know how to implement, but it sure could be done right?
     
  5. LyfeOnEdge

    LyfeOnEdge Advanced Member

    Newcomer
    3
    Feb 24, 2019
    United States
    An ATMEGA32U4 could do it pretty easily. Alternatively you could probably set up ftp so it would be a simple matter of saving the files in a local file then pushing them to the switch
     
  6. galaxior

    galaxior Newbie

    Newcomer
    1
    Apr 25, 2019
    United Kingdom
    Potentially yes, I guess to be more accurate I should have said no pure software solution on only the PC side is possible (which is how I interpreted the post). A solution with software running on both ends does sound feasible but I have no experience with switch sysmodules either

    Sent from my BLA-L09 using Tapatalk
     
    stitchxd likes this.
Quick Reply
Draft saved Draft deleted
Loading...