Skip to content

Commit 02c44ca

Browse files
committed
Added description to READEM.md
1 parent 68de035 commit 02c44ca

1 file changed

Lines changed: 158 additions & 1 deletion

File tree

README.md

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,158 @@
1-
# joycontrol-pluginloader
1+
# joycontrol-pluginloader
2+
3+
This is a plugin loader for joycontrol that can emulate Nintendo Switch controller over Bluetooth.
4+
[GitHub - mart1nro/joycontrol](https://github.com/mart1nro/joycontrol)
5+
6+
## Installation
7+
8+
- Install joycontrol
9+
Details: [GitHub - mart1nro/joycontrol - README.md](https://github.com/mart1nro/joycontrol/blob/master/README.md)
10+
11+
```sh
12+
$ sudo apt install python3-dbus libhidapi-hidraw0
13+
$ git clone https://github.com/mart1nro/joycontrol.git
14+
$ sudo pip3 install joycontrol/
15+
```
16+
17+
- Install joycontrol-pluginloader
18+
19+
```sh
20+
$ git clone https://github.com/Almtr/joycontrol-pluginloader
21+
$ sudo pip3 install joycontrol-pluginloader/
22+
```
23+
24+
## Pairing the Pro Controller of joycontrol
25+
26+
1. Open the "Change Grip/Order" menu of the Nintendo Switch
27+
28+
Home > Controllers > Change Grip/Order
29+
30+
1. Run the script
31+
32+
```sh
33+
$ sudo python3 joycontrol/run_controller_cli.py PRO_CONTROLLER
34+
```
35+
36+
## Usage
37+
38+
- Basic Usage
39+
40+
```
41+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> <Joycontrol Plugin path>
42+
```
43+
44+
- Options
45+
46+
```
47+
usage: joycontrol-pluginloader.py [-h] [-d DEVICE_ID] [-r RECONNECT_BT_ADDR]
48+
[-v]
49+
plugin [options [options ...]]
50+
51+
positional arguments:
52+
plugin joycontrol plugin path
53+
options joycontrol plugin options
54+
55+
optional arguments:
56+
-h, --help show this help message and exit
57+
-d DEVICE_ID, --device_id DEVICE_ID
58+
-r RECONNECT_BT_ADDR, --reconnect_bt_addr RECONNECT_BT_ADDR
59+
The Switch console Bluetooth address, for reconnecting
60+
as an already paired controller
61+
-v, --verbose
62+
```
63+
64+
## How to create a plugin
65+
66+
- Create a file (e.g. ``SamplePlugin.py``)
67+
68+
```python
69+
import logging
70+
from JoycontrolPlugin import JoycontrolPlugin
71+
72+
logger = logging.getLogger(__name__)
73+
74+
class SamplePlugin(JoycontrolPlugin):
75+
async def run(self):
76+
logger.info('This is sample joycontrol plugin!')
77+
78+
logger.info(f'Plugin Options: {self.options}')
79+
80+
logger.info('Push the A Button')
81+
await self.button_push('a')
82+
await self.wait(0.3)
83+
84+
logger.info('Tilt the left stick down')
85+
await self.left_stick('down')
86+
await self.wait(0.3)
87+
```
88+
89+
- Load and run ``SamplePlugin.py``
90+
91+
```sh
92+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/SamplePlugin.py arg1 arg2
93+
94+
<snip>
95+
96+
[13:30:00] JoycontrolPlugin.loader load_plugin::9 INFO - Loading: plugins/samples/SamplePlugin.py
97+
[13:30:00] plugins/samples/SamplePlugin.py run::8 INFO - This is sample joycontrol plugin!
98+
[13:30:00] plugins/samples/SamplePlugin.py run::10 INFO - Plugin Options: ['arg1', 'arg2']
99+
[13:30:00] plugins/samples/SamplePlugin.py run::12 INFO - Push the A Button
100+
[13:30:01] plugins/samples/SamplePlugin.py run::16 INFO - Tilt the left stick down
101+
[13:30:01] __main__ _main::45 INFO - Stopping communication...
102+
```
103+
104+
## Sample Plugins
105+
106+
### TestControllerButotns
107+
108+
Check if the controller buttons are working properly.
109+
110+
1. Open the "Test Controller Buttons" menu
111+
112+
Home > System Settings > Controllers and Sensors > Test Input Devices > Test Controller Buttons
113+
114+
1. Run TestControllerButtons.py with joycontrol-pluginloader
115+
116+
```
117+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/TestControllerButtons.py
118+
```
119+
120+
### TestControllerSticks
121+
122+
Check if the controller sticks are working properly.
123+
124+
1. Open the "Calibrate Control Sticks" menu
125+
126+
Home > System Settings > Controllers and Sensors > Calibrate Control Sticks
127+
128+
1. Run TestControllerSticks.py with joycontrol-pluginloader
129+
130+
```
131+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/TestControllerSticks.py
132+
```
133+
134+
### RepeatA
135+
136+
Pushing the "A Button" repeatedly.
137+
138+
- Run RepeatA.py with joycontrol-pluginloader
139+
140+
```
141+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/RepeatA.py
142+
```
143+
144+
### SimpleMacro
145+
146+
Press the specified buttons in sequence.
147+
148+
- Run SimpleMacro.py with joycontrol-pluginloader
149+
150+
```
151+
$ sudo python3 joycontrol-pluginloader.py -r <Switch Bluetooth Mac address> plugins/samples/SimpleMacro.py a b x y up down left right
152+
```
153+
154+
## References
155+
156+
- [GitHub - mart1nro/joycontrol](https://github.com/mart1nro/joycontrol)
157+
- [Discord - Joy-Con Droid](https://discord.com/invite/SQNEx9v)
158+
- [GitHub Gist - colemickens/amiibo-emulation-with-linux-vm.md](https://gist.github.com/colemickens/b08d1a339f4483c6b3c08e739d6cf5d0)

0 commit comments

Comments
 (0)