Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
The main server is currently down. We are running on a backup server, so editing and search functionality are temporarily disabled. Please check back in a few hours.

Joycontrol-kb Switch: Difference between revisions

From GameBrew
Created page with "{{Infobox Switch Homebrews |title=JoyControl-KB |image=joycontrolkbswitch.png |description=Emulate Nintendo Switch Controllers over Bluetooth |author=QueenLinuxGlitch |lastupdated=2020/08/12 |type=PC Utilities |version=2020 |license=GPL-3.0 |download=https://dlhb.gamebrew.org/switchhomebrews/joycontrolkbswitch.7z |website=https://github.com/QueenLinuxGlitch/joycontrol-kb |source=https://github.com/QueenLinuxGlitch/joycontrol-kb |donation= }} {{#seo: |title=Switch Homebr..."
 
No edit summary
Line 1: Line 1:
{{Infobox Switch Homebrews
{{Infobox Switch Homebrews
|title=JoyControl-KB
|title=JoyControl-KB
|image=joycontrolkbswitch.png
|image=joycontrolkbnx.png
|description=Emulate Nintendo Switch Controllers over Bluetooth
|description=Emulate Nintendo Switch Controllers over Bluetooth
|author=QueenLinuxGlitch
|author=QueenLinuxGlitch
Line 8: Line 8:
|version=2020
|version=2020
|license=GPL-3.0
|license=GPL-3.0
|download=https://dlhb.gamebrew.org/switchhomebrews/joycontrolkbswitch.7z
|download=https://dlhb.gamebrew.org/switchhomebrews/joycontrolkbnx.7z
|website=https://github.com/QueenLinuxGlitch/joycontrol-kb
|website=https://github.com/QueenLinuxGlitch/joycontrol-kb
|source=https://github.com/QueenLinuxGlitch/joycontrol-kb
|source=https://github.com/QueenLinuxGlitch/joycontrol-kb
|donation=  
|donation=  
}}
}}
{{#seo:
Emulate Nintendo Switch Controllers over Bluetooth w/ Amiibo Support through Python3.
|title=Switch Homebrew PC Tools (PC Utilities) - GameBrew
 
|title_mode=append
Tested on Debian, Generic Hardware.
|image=joycontrolkbswitch.png
|image_alt=JoyControl-KB
}}
The joycontrol-kb is a Python3 program that enables the emulation of Nintendo Switch Controllers over Bluetooth, while also supporting Amiibo, and has been successfully tested on Debian and generic hardware.


== Features ==
== Features ==
Emulation of JOYCON_R, JOYCON_L and PRO_CONTROLLER.
* Emulation of JOYCON_R, JOYCON_L and PRO_CONTROLLER.
 
** button commands
* button commands
** stick state
* stick state
** nfc data
* nfc data
** controller keybinding
* controller keybinding
** controller macro recording, playback, deleting
* controller macro recording, playback, deleting


== Installation ==
== Installation ==
* Install dependencies
Install dependencies:
 
* Deb-systems:  
Deb-systems: Install the <code>dbus-python</code> <code>libhidapi-hidraw0</code> and <code>keyboard</code> packages
** Install the <code>dbus-python</code> <code>libhidapi-hidraw0</code> and <code>keyboard</code> packages
 
** <code>sudo apt install python3-dbus libhidapi-hidraw0</code>
<pre>sudo apt install python3-dbus libhidapi-hidraw0</pre>
** <code>sudo pip3 install keyboard</code>
 
* Arch Linux Derivatives:
<pre>sudo pip3 install keyboard</pre>
** Install the <code>hidapi</code> and <code>bluez-utils-compat</code>(AUR) packages.
 
Arch Linux Derivatives: Install the <code>hidapi</code> and <code>bluez-utils-compat</code>(AUR) packages


* Clone the repository and install the joycontrol package to get missing dependencies (Note: Controller script needs super user rights, so python packages must be installed as root). In the joycontrol folder run:
Clone the repository and install the joycontrol package to get missing dependencies:
* (Note: Controller script needs super user rights, so python packages must be installed as root.)
* In the joycontrol folder run: <code>sudo pip3 install .</code>


<pre>sudo pip3 install .</pre>
Disable the bluez &quot;input&quot; plugin, see [https://github.com/mart1nro/joycontrol/issues/8 #8].


* Disable the bluez &quot;input&quot; plugin, see [https://github.com/mart1nro/joycontrol/issues/8 #8]
==User guide==
=== Command line interface example ===
Run the script:
* <code>sudo python3 run_controller_cli.py PRO_CONTROLLER</code>
* This will create a PRO_CONTROLLER instance waiting for the Switch to connect.


== Command line interface example ==
Open the &quot;Change Grip/Order&quot; menu of the Switch:
* Run the script
* The Switch only pairs with new controllers in the &quot;Change Grip/Order&quot; menu.
* Note: If you already connected an emulated controller once, you can use the reconnect option of the script (-r &quot;&lt;Switch Bluetooth Mac address&gt;&quot;). This does not require the &quot;Change Grip/Order&quot; menu to be opened. You can find out a paired mac address using the &quot;bluetoothctl&quot; system command.


<pre>sudo python3 run_controller_cli.py PRO_CONTROLLER</pre>
After connecting, a command line interface is opened. Note: Press &lt;enter&gt; if you don't see a prompt.
* Call &quot;help&quot; to see a list of available commands.


This will create a PRO_CONTROLLER instance waiting for the Switch to connect.
If you call &quot;test_buttons&quot;, the emulated controller automatically navigates to the &quot;Test Controller Buttons&quot; menu.


* Open the &quot;Change Grip/Order&quot; menu of the Switch
=== CLI Readme ===
 
<pre>
The Switch only pairs with new controllers in the &quot;Change Grip/Order&quot; menu.
While running the cli, call &quot;help&quot; for an explanation of available commands.
 
Note: If you already connected an emulated controller once, you can use the reconnect option of the script (-r &quot;&lt;Switch Bluetooth Mac address&gt;&quot;). This does not require the &quot;Change Grip/Order&quot; menu to be opened. You can find out a paired mac address using the &quot;bluetoothctl&quot; system command.
 
* After connecting, a command line interface is opened. Note: Press &lt;enter&gt; if you don't see a prompt.
 
Call &quot;help&quot; to see a list of available commands.
 
* If you call &quot;test_buttons&quot;, the emulated controller automatically navigates to the &quot;Test Controller Buttons&quot; menu.
 
== CLI Readme ==
<pre>While running the cli, call &quot;help&quot; for an explanation of available commands.


Usage:
Usage:
Line 98: Line 88:


     --nfc &lt;nfc_data_file&gt;                  Sets the nfc data of the controller to a given nfc dump upon initial
     --nfc &lt;nfc_data_file&gt;                  Sets the nfc data of the controller to a given nfc dump upon initial
                                             connection.</pre>
                                             connection.
</pre>


==Known Issues ==
=== Resources ===
* Some bluetooth adapters seem to cause disconnects for reasons unknown, try to use an usb adapter instead
*[https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering Nintendo_Switch_Reverse_Engineering.]
* Incompatibility with Bluetooth &quot;input&quot; plugin requires a bluetooth restart, see [https://github.com/mart1nro/joycontrol/issues/8 #8]
*[https://github.com/timmeh87/switchnotes/blob/master/console_pairing_session console_pairing_session.]
 
==Known issues==
* Some bluetooth adapters seem to cause disconnects for reasons unknown, try to use an usb adapter instead.
* Incompatibility with Bluetooth &quot;input&quot; plugin requires a bluetooth restart, see [https://github.com/mart1nro/joycontrol/issues/8 #8].
* It seems like the Switch is slower processing incoming messages while in the &quot;Change Grip/Order&quot; menu. This causes flooding of packets and makes pairing somewhat inconsistent. Not sure yet what exactly a real controller does to prevent that. A workaround is to use the reconnect option after a controller was paired once, so that opening of the &quot;Change Grip/Order&quot; menu is not required.
* It seems like the Switch is slower processing incoming messages while in the &quot;Change Grip/Order&quot; menu. This causes flooding of packets and makes pairing somewhat inconsistent. Not sure yet what exactly a real controller does to prevent that. A workaround is to use the reconnect option after a controller was paired once, so that opening of the &quot;Change Grip/Order&quot; menu is not required.
== Resources ==
*[https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering Nintendo_Switch_Reverse_Engineering]
*[https://github.com/timmeh87/switchnotes/blob/master/console_pairing_session console_pairing_session]


== External links ==
== External links ==
* Github - https://github.com/QueenLinuxGlitch/joycontrol-kb
* GitHub - https://github.com/QueenLinuxGlitch/joycontrol-kb

Revision as of 04:47, 12 June 2023

JoyControl-KB
General
AuthorQueenLinuxGlitch
TypePC Utilities
Version2020
LicenseGPL-3.0
Last Updated2020/08/12
Links
Download
Website
Source

Emulate Nintendo Switch Controllers over Bluetooth w/ Amiibo Support through Python3.

Tested on Debian, Generic Hardware.

Features

  • Emulation of JOYCON_R, JOYCON_L and PRO_CONTROLLER.
    • button commands
    • stick state
    • nfc data
    • controller keybinding
    • controller macro recording, playback, deleting

Installation

Install dependencies:

  • Deb-systems:
    • Install the dbus-python libhidapi-hidraw0 and keyboard packages
    • sudo apt install python3-dbus libhidapi-hidraw0
    • sudo pip3 install keyboard
  • Arch Linux Derivatives:
    • Install the hidapi and bluez-utils-compat(AUR) packages.

Clone the repository and install the joycontrol package to get missing dependencies:

  • (Note: Controller script needs super user rights, so python packages must be installed as root.)
  • In the joycontrol folder run: sudo pip3 install .

Disable the bluez "input" plugin, see #8.

User guide

Command line interface example

Run the script:

  • sudo python3 run_controller_cli.py PRO_CONTROLLER
  • This will create a PRO_CONTROLLER instance waiting for the Switch to connect.

Open the "Change Grip/Order" menu of the Switch:

  • The Switch only pairs with new controllers in the "Change Grip/Order" menu.
  • Note: If you already connected an emulated controller once, you can use the reconnect option of the script (-r "<Switch Bluetooth Mac address>"). This does not require the "Change Grip/Order" menu to be opened. You can find out a paired mac address using the "bluetoothctl" system command.

After connecting, a command line interface is opened. Note: Press <enter> if you don't see a prompt.

  • Call "help" to see a list of available commands.

If you call "test_buttons", the emulated controller automatically navigates to the "Test Controller Buttons" menu.

CLI Readme

While running the cli, call "help" for an explanation of available commands.

Usage:
    run_controller_cli.py <controller> [--device_id | -d  <bluetooth_adapter_id>]
                                       [--spi_flash <spi_flash_memory_file>]
                                       [--reconnect_bt_addr | -r <console_bluetooth_address>]
                                       [--log | -l <communication_log_file>]
                                       [--nfc <nfc_data_file>]
    run_controller_cli.py -h | --help

Arguments:
    controller      Choose which controller to emulate. Either "JOYCON_R", "JOYCON_L" or "PRO_CONTROLLER"

Options:
    -d --device_id <bluetooth_adapter_id>   ID of the bluetooth adapter. Integer matching the digit in the hci* notation
                                            (e.g. hci0, hci1, ...) or Bluetooth mac address of the adapter in string
                                            notation (e.g. "FF:FF:FF:FF:FF:FF").
                                            Note: Selection of adapters may not work if the bluez "input" plugin is
                                            enabled.

    --spi_flash <spi_flash_memory_file>     Memory dump of a real Switch controller. Required for joystick emulation.
                                            Allows displaying of JoyCon colors.
                                            Memory dumps can be created using the dump_spi_flash.py script.

    -r --reconnect_bt_addr <console_bluetooth_address>  Previously connected Switch console Bluetooth address in string
                                                        notation (e.g. "FF:FF:FF:FF:FF:FF") for reconnection.
                                                        Does not require the "Change Grip/Order" menu to be opened,

    -l --log <communication_log_file>       Write hid communication (input reports and output reports) to a file.

    --nfc <nfc_data_file>                   Sets the nfc data of the controller to a given nfc dump upon initial
                                            connection.

Resources

Known issues

  • Some bluetooth adapters seem to cause disconnects for reasons unknown, try to use an usb adapter instead.
  • Incompatibility with Bluetooth "input" plugin requires a bluetooth restart, see #8.
  • It seems like the Switch is slower processing incoming messages while in the "Change Grip/Order" menu. This causes flooding of packets and makes pairing somewhat inconsistent. Not sure yet what exactly a real controller does to prevent that. A workaround is to use the reconnect option after a controller was paired once, so that opening of the "Change Grip/Order" menu is not required.

External links

Advertising: