Difference between revisions of "Command line"

From GIMX
Jump to: navigation, search
(Run GIMX)
 

(26 intermediate revisions by the same user not shown)

Line 53: Line 53:
 
:This argument is mandatory.
 
:This argument is mandatory.
  
==Linux + bluetooth + PS4==
+
==Linux + bluetooth + PS4== <!--T:24-->
  
===Setup===
+
===Setup=== <!--T:25-->
  
The setup performs the bluetooth pairing between the PS4 and the dongle, and between the dongle and the DS4.<br />
+
<!--T:26-->
It has to be run again if the DS4 is reused (i.e. paired again) with the PS4.
+
The setup performs the bluetooth pairing between the PS4 and the dongle, and between the dongle and the Dualshock 4.<br />
 +
It has to be run again if the Dualshock 4 is reused (i.e. paired again) with the PS4.
  
 +
<!--T:27-->
 
Download the helper script:
 
Download the helper script:
  
   wget <nowiki>https://raw.github.com/matlo/GIMX-tools/master/PS4/gimx-ps4-helper.sh</nowiki> -O gimx-ps4-helper.sh
+
   <!--T:28-->
 +
wget <nowiki>https://raw.github.com/matlo/GIMX-tools/master/PS4/gimx-ps4-helper.sh</nowiki> -O gimx-ps4-helper.sh
  
 +
<!--T:29-->
 
Make it executable:
 
Make it executable:
  
   chmod +x gimx-ps4-helper.sh
+
   <!--T:30-->
 +
chmod +x gimx-ps4-helper.sh
  
 +
<!--T:31-->
 
Run it:
 
Run it:
  
   sudo ./gimx-ps4-helper.sh
+
   <!--T:32-->
 +
sudo ./gimx-ps4-helper.sh
  
 +
<!--T:33-->
 
Simply follow the instructions. A successful output should look like this:
 
Simply follow the instructions. A successful output should look like this:
  
   $ sudo ./gimx-ps4-setup.sh
+
   <!--T:34-->
 +
$ sudo ./gimx-ps4-setup.sh
 
   Unplug any Dualshock 4.
 
   Unplug any Dualshock 4.
 
   Unplug any teensy.
 
   Unplug any teensy.
Line 95: Line 104:
 
   gimx -t DS4 -c config.xml -h 1 -b ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
 
   gimx -t DS4 -c config.xml -h 1 -b ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
  
===Run GIMX===
+
===Run GIMX=== <!--T:35-->
  
 +
<!--T:36-->
 
1. The bluetooth service has to be stopped before starting GIMX (this allows GIMX to get incoming connections):
 
1. The bluetooth service has to be stopped before starting GIMX (this allows GIMX to get incoming connections):
 
   sudo service bluetooth stop
 
   sudo service bluetooth stop
 
You may also have to deactivate the bluetooth service if your system starts it automatically.
 
You may also have to deactivate the bluetooth service if your system starts it automatically.
  
 +
<!--T:37-->
 
2. Start GIMX:
 
2. Start GIMX:
 
   gimx -t DS4 -c <config file> -h <hci number> -b <PS4 bdaddr>
 
   gimx -t DS4 -c <config file> -h <hci number> -b <PS4 bdaddr>
  
 +
<!--T:38-->
 
<config file> is the name of the config file to use.<br />
 
<config file> is the name of the config file to use.<br />
 
<hci number> is the bluetooth hci number, for example 0 if there is only one bluetooth adapter (internal or external). Run 'hciconfig' if you're not sure about this value.<br />
 
<hci number> is the bluetooth hci number, for example 0 if there is only one bluetooth adapter (internal or external). Run 'hciconfig' if you're not sure about this value.<br />
 
<PS4 bdaddr> is the address of the PS4.<br />
 
<PS4 bdaddr> is the address of the PS4.<br />
  
 +
<!--T:39-->
 
3. Start the DS4. It should connect to GIMX, which in turn should connect to the PS4.
 
3. Start the DS4. It should connect to GIMX, which in turn should connect to the PS4.
  
==Linux or Windows + DIY USB adapter or GPP== <!--T:8-->
+
==Linux or Windows + DIY USB adapter== <!--T:8-->
  
 
<!--T:9-->
 
<!--T:9-->
Line 132: Line 145:
 
:Optional. Forcing the refresh period is not recommended.
 
:Optional. Forcing the refresh period is not recommended.
  
==Linux or Windows + Remote GIMX== <!--T:8-->
+
==Linux or Windows + GPP/Cronus/Titan== <!--T:44-->
  
<!--T:9-->
+
<!--T:45-->
 +
In a terminal:<br />
 +
 
 +
  <!--T:46-->
 +
gimx --config file_name --type GPP
 +
or
 +
  gimx -c file_name -t GPP
 +
 
 +
<!--T:47-->
 +
gimx options:
 +
* --config file_name
 +
:The name of the config file, in the ~/.gimx/config directory (ex : toto.xml).<br />
 +
:This argument is mandatory.
 +
* --refresh 4
 +
:The refresh period, in ms.<br />
 +
:Optional. Forcing the refresh period is not recommended.
 +
 
 +
==Linux or Windows + Remote GIMX== <!--T:40-->
 +
 
 +
<!--T:41-->
 
In a terminal:<br />
 
In a terminal:<br />
  
<!--T:22-->
+
  <!--T:42-->
  gimx --config file_name --dst IP:port
+
gimx --config file_name --dst IP:port
 
  or
 
  or
 
   gimx -c file_name -d IP:port
 
   gimx -c file_name -d IP:port
  
<!--T:10-->
+
<!--T:43-->
 
gimx options:
 
gimx options:
 
* --config file_name
 
* --config file_name
Line 148: Line 180:
 
:This argument is mandatory.
 
:This argument is mandatory.
 
* --dst IP:port
 
* --dst IP:port
:The destination IP+port. Ex: 127.0.0.1:51914.<br />
+
:The destination IP+port. Ex: 127.0.0.1:51914 (the destination is a GIMX instance listening on port 51914 on the loopback interface).<br />
 
:The remote GIMX has to be started with the --src argument, with the same IP:port value.
 
:The remote GIMX has to be started with the --src argument, with the same IP:port value.
  
==General gimx options== <!--T:11-->
+
==Test mode== <!--T:48-->
 +
 
 +
<!--T:49-->
 +
It's possible to run GIMX with no output connection. This is useful for testing and debugging.<br />
 +
To activate the test mode, remove the --dst, --bdaddr and --port arguments, and add a --type argument.<br />
 +
The possible values for the --type argument are: joystick, 360pad, Sixaxis, PS2pad, XboxPad, DS4, T300RS_PS4, G27_PS3 and G29_PS4.<br />
 +
Example:
 +
  gimx -c config.xml --status -t DS4
 +
 
 +
==Multiple controllers== <!--T:50-->
 +
 
 +
<!--T:51-->
 +
A --bdaddr, --port or --dst argument finishes the current controller options.<br />
 +
Further non-global options apply to further controller instances.
 +
 
 +
==Global options== <!--T:11-->
 +
 
 +
<!--T:52-->
 +
These options apply to all controller instances.
  
 
<!--T:12-->
 
<!--T:12-->
Line 165: Line 215:
 
* --subpos
 
* --subpos
 
:Improve stick precision (counteract rounding issues).
 
:Improve stick precision (counteract rounding issues).
 +
* --window-events
 +
:Read window events instead of hardware events. This allows to use GIMX with emulated devices (virtual keyboard/mouse) and with scripting tools such as AutoHotkey (Windows) or xdotool (Linux).
 
* --keygen key
 
* --keygen key
 
:Generate a key press at gimx startup.<br />
 
:Generate a key press at gimx startup.<br />
Line 170: Line 222:
 
:Events that are not generated by macros are ignored.<br />
 
:Events that are not generated by macros are ignored.<br />
 
:Another use case is the sending of a single command (it requires to use a macro as no key up event is generated).
 
:Another use case is the sending of a single command (it requires to use a macro as no key up event is generated).
* --event "control(value)"
+
* --skip_leds
 +
:Filter out set led commands from FFB command stream (performance tweak for G27/G29 wheels on small targets).
 +
* --timeout value
 +
:Exit if controllers are inactive during a given number of minutes. Since GIMX 7.1.
 +
 
 +
==Controller options== <!--T:53-->
 +
 
 +
<!--T:54-->
 +
* --event "name(value)"
 
:It's possible to send controls to the console from the command line, without having to create a configuration and macros to use with the --keygen argument.
 
:It's possible to send controls to the console from the command line, without having to create a configuration and macros to use with the --keygen argument.
 +
:The names and value ranges can be found on the [[Controller_Maps|Controller Maps]] page.
 
:Example:
 
:Example:
   gimx -p /dev/ttyUSB0 --event "lstick x(127)" --event "rstick y(-128)" --event "circle(255)" --event "square(0)"
+
   gimx --event "rel_axis_0(127)" --event "rel_axis_3(-128)" --event "abs_axis_8(255)" --event "abs_axis_10(0)" -d 127.0.0.1:51914
:This moves the left stick right, the right stick forward, fully presses the circle button, and releases the square button.
+
:For a Sixaxis controller, this moves the left stick right, the right stick forward, fully presses the circle button, and releases the square button.
:The state of all other controls is cleared, i.e. all other buttons and axes are released (in the above command, --event "square(0)" is not necessary).
+
:The state of all other controls is cleared, i.e. all other buttons and axes are released (in the above command, --event "abs_axis_10(0)" is not necessary).
 
:gimx should complete in about 10ms.
 
:gimx should complete in about 10ms.
:Names and value ranges:
+
:When using events, it is recommended to run two gimx instances, especially in the following cases:
:"lstick x", "lstick y", "rstick x", "rstick y": [-128,127]
+
:* the target console a PS4 (one gimx instance has to be connected all the time because of the authentication)
:"acc x", "acc y", "acc z", "gyro": [-512,511]
+
:* the connection method is bluetooth (a bluetooth connection takes some time to establish)
:"select", "start", "PS", "l3", "r3": {0, 255} (only two values as these buttons are not pressure-sensitive)
+
:Example:
:"up", "right", "down", "left", "triangle", "circle", "cross", "square", "l1", "r1", "l2", "r2": [0,255]
+
  gimx --src 127.0.0.1:51914 -t Sixaxis -b XX:XX:XX:XX:XX:XX
 +
  gimx --event "abs_axis_10(255)" --dst 127.0.0.1:51914
 
* --src IP:port
 
* --src IP:port
:Specifies a source IP+port to listen on. Ex: 127.0.0.1:51914.
+
:Specifies a source IP+port to listen on. Ex: 127.0.0.1:51914. The source IP specifies the interface, which can be 0.0.0.0 for any interface, 127.0.0.1 for the loopback interface, or a regular interface IP (e.g. 192.168.0.42).
 
</translate>
 
</translate>

Latest revision as of 20:09, 12 March 2018

Other languages:
English • ‎français

Motivation

GIMX can be run from a Linux terminal without having to run a windowing system.
This improves performances, especially on small targets like the Raspberry Pi or thin clients.
It's also useful for other stuff like automation.

Linux + bluetooth + PS3

Set the dongle address

It is highly recommended to use a CSR Bluecore4-rom dongle. Check the compatibility list.

Plug a Sixaxis previously paired with the target PS3.

Type in a terminal:

sixaddr

Result:

Current Bluetooth master: ps3_bt_address
Current Bluetooth Device Address: sixaxis_bt_address

Get the current dongle address:

bdaddr -i hciN

where N is the dongle index (type "hciconfig -a" to see all dongles).

Write it down so as to be able to restore it later.

Set the dongle address:

bdaddr -r -i hciN sixaxis_bt_address

Check the result:

bdaddr -i hciN

Run GIMX

In a terminal:

gimx --type Sixaxis --config filename --hci bt_device_index --bdaddr ps3_bt_address
  • file_name
The name of the config file, in the ~/.gimx/config directory (ex : toto.xml).
This argument is mandatory.
Use backslashes to escape spaces.
  • bt_device_index
The bluetooth device index (ex : 0 for hci0, 1 for hci1, etc).
This argument is optional, default device index is 0.
  • ps3_bt_address
This argument is mandatory.

Linux + bluetooth + PS4

Setup

The setup performs the bluetooth pairing between the PS4 and the dongle, and between the dongle and the Dualshock 4.
It has to be run again if the Dualshock 4 is reused (i.e. paired again) with the PS4.

Download the helper script:

 wget https://raw.github.com/matlo/GIMX-tools/master/PS4/gimx-ps4-helper.sh -O gimx-ps4-helper.sh

Make it executable:

 chmod +x gimx-ps4-helper.sh

Run it:

 sudo ./gimx-ps4-helper.sh

Simply follow the instructions. A successful output should look like this:

 $ sudo ./gimx-ps4-setup.sh
 Unplug any Dualshock 4.
 Unplug any teensy.
 Unpug the bluetooth dongle.
 Then press enter.
 
 Plug the bluetooth dongle.
 The bluetooth dongle address is XX:XX:XX:XX:XX:XX.
 The bluetooth hci number is 1.
 Plug the DS4 with a USB cable.
 The DS4 address is YY:YY:YY:YY:YY:YY.
 Unplug the DS4.
 Plug the teensy.
 Unplug the teensy.
 Plug the teensy to the PS4, and wait a few seconds.
 Then plug the teensy back to the PC.
 The PS4 address is ZZ:ZZ:ZZ:ZZ:ZZ:ZZ.
 Everything was successful: setting dongle link keys.
 To run gimx, type:
 gimx -t DS4 -c config.xml -h 1 -b ZZ:ZZ:ZZ:ZZ:ZZ:ZZ

Run GIMX

1. The bluetooth service has to be stopped before starting GIMX (this allows GIMX to get incoming connections):

 sudo service bluetooth stop

You may also have to deactivate the bluetooth service if your system starts it automatically.

2. Start GIMX:

 gimx -t DS4 -c <config file> -h <hci number> -b <PS4 bdaddr>

<config file> is the name of the config file to use.
<hci number> is the bluetooth hci number, for example 0 if there is only one bluetooth adapter (internal or external). Run 'hciconfig' if you're not sure about this value.
<PS4 bdaddr> is the address of the PS4.

3. Start the DS4. It should connect to GIMX, which in turn should connect to the PS4.

Linux or Windows + DIY USB adapter

In a terminal:

 gimx --config file_name --port /dev/ttyUSBX
or
 gimx -c file_name -p /dev/ttyUSBX

gimx options:

  • --config file_name
The name of the config file, in the ~/.gimx/config directory (ex : toto.xml).
This argument is mandatory.
  • --port /dev/ttyUSB0
The serial port. Ex: /dev/ttyUSB0 in Linux, COM4 in windows.
Only mandatory for the DIY USB adapter.
  • --refresh 4
The refresh period, in ms.
Optional. Forcing the refresh period is not recommended.

Linux or Windows + GPP/Cronus/Titan

In a terminal:

 gimx --config file_name --type GPP
or
 gimx -c file_name -t GPP

gimx options:

  • --config file_name
The name of the config file, in the ~/.gimx/config directory (ex : toto.xml).
This argument is mandatory.
  • --refresh 4
The refresh period, in ms.
Optional. Forcing the refresh period is not recommended.

Linux or Windows + Remote GIMX

In a terminal:

 gimx --config file_name --dst IP:port
or
 gimx -c file_name -d IP:port

gimx options:

  • --config file_name
The name of the config file, in the ~/.gimx/config directory (ex : toto.xml).
This argument is mandatory.
  • --dst IP:port
The destination IP+port. Ex: 127.0.0.1:51914 (the destination is a GIMX instance listening on port 51914 on the loopback interface).
The remote GIMX has to be started with the --src argument, with the same IP:port value.

Test mode

It's possible to run GIMX with no output connection. This is useful for testing and debugging.
To activate the test mode, remove the --dst, --bdaddr and --port arguments, and add a --type argument.
The possible values for the --type argument are: joystick, 360pad, Sixaxis, PS2pad, XboxPad, DS4, T300RS_PS4, G27_PS3 and G29_PS4.
Example:

 gimx -c config.xml --status -t DS4

Multiple controllers

A --bdaddr, --port or --dst argument finishes the current controller options.
Further non-global options apply to further controller instances.

Global options

These options apply to all controller instances.

  • --curses
curses terminal display.
Mouse calibration is available through this interface.
  • --status
Display controls in the terminal.
  • --nograb
Do not grab the mouse cursor.
  • --force-updates
Send button+axis status even if there is no change (for compatibility with games like DNF).
  • --subpos
Improve stick precision (counteract rounding issues).
  • --window-events
Read window events instead of hardware events. This allows to use GIMX with emulated devices (virtual keyboard/mouse) and with scripting tools such as AutoHotkey (Windows) or xdotool (Linux).
  • --keygen key
Generate a key press at gimx startup.
The main use case for this is the automation of macro's execution.
Events that are not generated by macros are ignored.
Another use case is the sending of a single command (it requires to use a macro as no key up event is generated).
  • --skip_leds
Filter out set led commands from FFB command stream (performance tweak for G27/G29 wheels on small targets).
  • --timeout value
Exit if controllers are inactive during a given number of minutes. Since GIMX 7.1.

Controller options

  • --event "name(value)"
It's possible to send controls to the console from the command line, without having to create a configuration and macros to use with the --keygen argument.
The names and value ranges can be found on the Controller Maps page.
Example:
 gimx --event "rel_axis_0(127)" --event "rel_axis_3(-128)" --event "abs_axis_8(255)" --event "abs_axis_10(0)" -d 127.0.0.1:51914
For a Sixaxis controller, this moves the left stick right, the right stick forward, fully presses the circle button, and releases the square button.
The state of all other controls is cleared, i.e. all other buttons and axes are released (in the above command, --event "abs_axis_10(0)" is not necessary).
gimx should complete in about 10ms.
When using events, it is recommended to run two gimx instances, especially in the following cases:
  • the target console a PS4 (one gimx instance has to be connected all the time because of the authentication)
  • the connection method is bluetooth (a bluetooth connection takes some time to establish)
Example:
 gimx --src 127.0.0.1:51914 -t Sixaxis -b XX:XX:XX:XX:XX:XX
 gimx --event "abs_axis_10(255)" --dst 127.0.0.1:51914
  • --src IP:port
Specifies a source IP+port to listen on. Ex: 127.0.0.1:51914. The source IP specifies the interface, which can be 0.0.0.0 for any interface, 127.0.0.1 for the loopback interface, or a regular interface IP (e.g. 192.168.0.42).