Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cox34/a95f16929988dcce4bfa063e74734974 to your computer and use it in GitHub Desktop.
Save cox34/a95f16929988dcce4bfa063e74734974 to your computer and use it in GitHub Desktop.
amiibo-emulation-with-linux-vm.md

JoyControl

sudo apt install git python3-pip libglib2.0-dev libhidapi-hidraw0 libhidapi-libusb0 libdbus-1-dev
sudo pip3 install hid aioconsole crc8 dbus-python

cd ~
mkdir joycontrol
git clone https://github.com/cox34/joycontrol-jun2020 ~/joycontrol

Notes:

  • If you have problems, you can press CTRL+c and it will kill the app. Also, you can tap the up arrow to pull up the last command and run it again.
  • Only send buttons to the Switch via this app. Do not press buttons on real controllers!
  • After the connection, press <Enter> in the terminal to get the >>> prompt

The following shows someone starting joycontrol, connecting, sending some button presses and then loading up the amiibo bin and activating the amiibo reading:

cd ~/joycontrol
sudo python3 ./run_controller_cli.py PRO_CONTROLLER

# connect the control
# then after the messages and connection, press <ENTER>

# now you can send commands:
# you can send buttons (pressing enter after each line)
home
a
b

# get the amiibo payload ready:
# (see above for what the path should be)
amiibo /home/xubuntu/Downloads/backup-of-my-amiibo.bin

# activate the final dialog to start the NFC/amiibo read
a

Troubleshooting

  • Anything

    Try a few times! Things seem to be a bit flakey, even in pretty ideal conditions...

    Also, try another adapter. People seem to really struggle with the internal laptop adapters and report more luck when they try when they find lying around.

  • OSError: [Errno 97] Address family not supported by protocol

    You can't use WSL (neither WSL1 nor WSL2). If you're still getting this error, please give lots of details about anything you might have done differently.

  • The virtual joycon disconnects when I leave the Grip screen

    You might get an error like this:

    ERROR - [Errno 104] Connection reset by peer [19:39:05] joycontrol.protocol connection_lost::121
    ERROR - Connection lost.
    

    Few things:

    1. Do not touch the real joycons or controller! Remove the joycons entirely, if possible, from the system. Remove other pro controllers.
    2. Send all buttons from the joycontrol app, instead of pressing the real buttons. You should get the game all ready to read the amiibo, then do the steps to attach the controller. Then send the final buttons to get back to the game and activate the amiibo.
    3. If you've done these things and it still disconnects when you leave the Grip screen, then you might be having Bluetooth issues. If this is the case, check your BT forwarding to your VM setup. Try booting into Linux on a USB instead. Or try another Bluetooth adapter.
  • OSError: [Errno 98] Address already in use

    Check two things:

    1. It's likely that you have joycontrol running already. Run ps aux | grep joycontrol. Does it look like there are two sets running. Try to kill them, or reboot.

    2. If you're sure that's not it, you can try this workaround, but it really shouldn't be necessary almost ever. (details)

      sudo sed -i 's|^ExecStart=/usr/lib/bluetooth/bluetoothd.*$|ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=input|g' /lib/systemd/system/bluetooth.service
      sudo systemctl daemon-reload
      sudo systemctl restart bluetooth

      If this still doesn't help, it's the other one...

Old Troubleshooting

These steps are not really recommended by me anymore. I think they tend to cause more problems than good.

Windows + VirtualBox Workaround

You may need to disable your BT adapter so VirutalBox can control it:

  1. Go into Device Manager

    • Find your Bluetooth adapter
    • Right-click -> Disable
  2. Go into Windows Services

    • Disable THREE Bluetooth services:
      • "Bluetooth Audio Gateway Service"
      • "Bluetooth Support Service"
      • "BluetoothUserService_xxxx"

MANY USERS are reporting that they re-enabled the devices in Hardware Manager after the VM booted and THEN were able to complete the steps successfully.

Known Good Setups

  1. Raspberry Pi 4 with built-in Bluetooth + Raspbian
  2. Raspberry Pi 0 with built-in Bluetooth + Raspbian

(it's possible a few steps are slightly different on Raspbian)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment