More convenient when using gimx on RPi?

Discuss everything to do with GIMX here
Post Reply
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

I understand that gimx can auto start up when booting RPi, that is a great idea to real plug and play. But I wonder are there any ways to make it more convenient in using, especially in changing config? You know we must use ssh or VNC to change it on phone, PC, ...

I have an idea about creating script ask for input Sensitivity, Acceleration, ... then values will be update to active config. But seems like I'm stuck because I have no experience with Python :?

Any help will be appreciated.
An app with GUI for smartphone is great ? :roll:

Update:
1. Changing config with autocomplete config file name script:
2. Quick modify mouse DPI and sensitivy:
3. Show key maps in config:
PS4 enthusiast.
User avatar
GoDlike
Posts: 1317
Joined: Thu Apr 28, 2016 12:47 pm
Location: Poland

Re: More convenient when using gimx on RPi?

Post by GoDlike »

Check newest python versions. They're pretty easy to learn and code is much more readable compared to the old one. You can always write scripts in bash/perl/ruby, whatever you want to use.

I think mobile app is a bit overkill and could be pretty hard to implement properly as you need wireless connection with the Pi.
My hardware: PS3 Slim CFW 4.80 | PS4 Pro 500 Million LE | PS5 | Xbox Series X
Steam: Godlike_RU | PSN: GoDlike_RU | XBL: GoDlike
User avatar
Matlo
Posts: 5768
Joined: Wed Jul 06, 2011 7:01 am
Location: France
Contact:

Re: More convenient when using gimx on RPi?

Post by Matlo »

This gave me an idea :)
Adding a command line option to make GIMX to be notified about changes for the config file, and exit on modify+close events.
The the service spawns a new GIMX instance that reads the new config file.
This way you could just add the gimx config folder as a network directory.

This said, if you want to be efficient in adjusting the mouse calibration parameters, you really should use the calibration tool.
GIMX creator
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

Re: More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

Godlike wrote: Wed Dec 06, 2017 7:23 pm Check newest python versions. They're pretty easy to learn and code is much more readable compared to the old one. You can always write scripts in bash/perl/ruby, whatever you want to use.

I think mobile app is a bit overkill and could be pretty hard to implement properly as you need wireless connection with the Pi.
Many thanks for your advice, I should keep fighting with Python.
Matlo wrote: Thu Dec 07, 2017 7:57 am This gave me an idea :)
Adding a command line option to make GIMX to be notified about changes for the config file, and exit on modify+close events.
The the service spawns a new GIMX instance that reads the new config file.
This way you could just add the gimx config folder as a network directory.

This said, if you want to be efficient in adjusting the mouse calibration parameters, you really should use the calibration tool.
Glad to hear that!!
So we just need to modify config value and GIMX does the rest, active in real time. Woo that's so cool.
One more thing, can you share your funtion of DPI Sensitivity calculator? :)
I tried 4000 DPI with sens 20, then I used mouse DPI converter to change DPI to 8000, new sens was 15.05. I have no idea why :D
Thanks again
Last edited by kaiba_seto2004 on Sun Dec 10, 2017 7:41 pm, edited 3 times in total.
PS4 enthusiast.
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

Re: More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

OK so these are what I did on the weekend.

1. Changing config with autocomplete config file name script:
Simple create a .sh (ex: change_config.sh) file and set permission for it to 755.

Code: Select all

#!/bin/bash
echo -n "Enter config file name: "
cd .gimx/config/
read -e filename
sudo cp /root/.gimx/config/$filename /root/.gimx/config/active.xml
sudo systemctl stop gimx
sudo systemctl start gimx
Run command:

Code: Select all

~# ./change_config.sh
When RPi ask for input config name, you can input first characters then press TAB for autocomplete whole file name if its name was too long. You can also press TAB 2 times to see all configs.

2. Quick modify mouse DPI and sensitivy:
You need to create 2 files: 1 bash script and 1 python script. For ex: run_config_mouse.sh and config_mouse.py, remember to set permission to 755 both

run_config_mouse.sh

Code: Select all

#!/bin/bash
sudo systemctl stop gimx
python config_mouse.py
sudo systemctl start gimx
config_mouse.py

Code: Select all

#!/usr/bin/python
import xml.etree.ElementTree as ET
tree = ET.parse('.gimx/config/active.xml')
root = tree.getroot()

print "\n\n\n========================================================================="
print "============= QUICK MOFIDY MOUSE DPI AND SENSITIVITY TOOL ==============="
print "========================================================================="

for controller in root.findall('controller[@id="1"]'):
	controllervalue = controller.get('dpi')
print "\nCurrent DPI value:  ",controllervalue
while True:
	try:
		dpivl = int(raw_input("Enter new DPI value: "))
	except ValueError:
		print("\nInvalid value! Must be number. Please re-enter new DPI value: ")
	else:
		controller.set('dpi',str(dpivl))
		break
for eventy in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@label="Aiming - y axis"]/event'):
	sensy = eventy.get('multiplier')
print "\nCurrent sensitivity value (Hip Fire):  ",sensy
while True:
	try:
		sensvl = float(raw_input("Enter new sensitivity value (Hip Fire): "))
	except ValueError:
		print("\nInvalid value! Must be number. Please re-enter new sensitivity value: ")
	else:
		eventy.set('multiplier',str(sensvl))
		break
for eventx in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@label="Aiming - x axis"]/event'):
	eventx.set('multiplier',str(sensvl))
for eventy2 in root.findall('./controller[@id="1"]/configuration[@id="2"]/axis_map/axis[@label="Aiming - y axis"]/event'):
	sensy2 = eventy2.get('multiplier')
print "\nCurrent sensitivity value (ADS):  ",sensy2
while True:
	try:
		sensvl2 = float(raw_input("Enter new sensitivity value (ADS): "))
	except ValueError:
		print("\nInvalid value! Must be number. Please re-enter new sensitivity value: ")
	else:
		eventy2.set('multiplier',str(sensvl2))
		break

for eventx2 in root.findall('./controller[@id="1"]/configuration[@id="2"]/axis_map/axis[@label="Aiming - x axis"]/event'):
	eventx2.set('multiplier',str(sensvl2))

print "\nConfig has been saved!!"

#=====================Write value back into config=====================
tree.write('.gimx/config/active.xml', encoding="UTF-8")
Run command:

Code: Select all

~# ./run_config_mouse.sh
RPi will show prev DPI and sensitivty, you only need to input new values. RPi will also restart gimx service after that.

Now what you need is just a smartphone with any ssh application to control Pi from there.
Have fun :)
PS4 enthusiast.
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

Re: More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

I managed to create another script for showing key mapped.
You need to create 2 files in /root/: 1 bash script and 1 python script. For ex: show_keys_map.sh and show_keymap.py, remember to set permission to 755 both

show_keys_map.sh

Code: Select all

#!/bin/bash
python show_keymap.py
show_keymap.py

Code: Select all


#!/usr/bin/python
import xml.etree.ElementTree as ET
tree = ET.parse('.gimx/config/active.xml')
root = tree.getroot()
print "\n\n\n ========================================================================"
print "================== QUICK DISPLAY BUTTONS KEYMAPPING ======================"
print " ========================================================================"
#=========BUTTON L1============
print "\n"
try:
	for eventL1 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_11"]/device[@name=""]/../event'):
		buttonL1 = eventL1.get('id')
		print "L1 :     ",buttonL1
except NameError:
	print "n/a"

#=========BUTTON R1============
try:
	for eventR1 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_12"]/device[@name=""]/../event'):
#	for eventR1 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_12"]/event'):
		buttonR1 = eventR1.get('id')
		print "R1:      ",buttonR1
except NameError:
	print "n/a"
#=========BUTTON L2============
try:
	for eventL2 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_13"]/device[@name=""]/../event'):
#	for eventL2 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_13"]/event'):
		buttonL2 = eventL2.get('id')
	print "\nL2:      ",buttonL2
except NameError:
	print "n/a"
#=========BUTTON R2============
try:
	for eventR2 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_14"]/device[@name=""]/../event'):
#	for eventR2 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_14"]/event'):
		buttonR2 = eventR2.get('id')
	print "R2:      ",buttonR2
except NameError:
	print "n/a"
#=========BUTTON L3============
try:
	for eventL3 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_15"]/device[@name=""]/../event'):
#	for eventL3 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_15"]/event'):
		buttonL3 = eventL3.get('id')
	print "\nL3:      ",buttonL3
except NameError:
	print "n/a"
#=========BUTTON R3============
try:
	for eventR3 in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_16"]/device[@name=""]/../event'):
#	for eventR3 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_16"]/event'):
		buttonR3 = eventR3.get('id')
	print "R3:      ",buttonR3
	print "\n------------------------DPAD-----------------------------"                                   
except NameError:
	print "n/a"
	print "\n------------------------DPAD-----------------------------"                                   
#=========BUTTON ARROW UP============
try:
	for eventARROWUP in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_3"]/device[@name=""]/../event'):
#	for eventARROWUP in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_3"]/event'):
		buttonARROWUP = eventARROWUP.get('id')
	print "UP:      ",buttonARROWUP
except NameError:
	print "n/a"
#=========BUTTON ARROW DOWN============
try:
	for eventARROWDOWN in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_5"]/device[@name=""]/../event'):
#	for eventARROWDOWN in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_5"]/event'):
		buttonARROWDOWN = eventARROWDOWN.get('id')
	print "DOWN:    ",buttonARROWDOWN
except NameError:
	print "n/a"
#=========BUTTON ARROW LEFT============
try:
	for eventARROWLEFT in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_6"]/device[@name=""]/../event'):
#	for eventARROWLEFT in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_6"]/event'):
		buttonARROWLEFT = eventARROWLEFT.get('id')
	print "LEFT:    ",buttonARROWLEFT
except NameError:
	print "n/a"
#=========BUTTON ARROW RIGHT============
try:
	for eventARROWRIGHT in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_4"]/device[@name=""]/../event'):
#	for eventARROWRIGHT in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_4"]/event'):
		buttonARROWRIGHT = eventARROWRIGHT.get('id')
	print "RIGHT:   ",buttonARROWRIGHT
	print "---------------------------------------------------------"
	print "\n------------------------LEFT ANALOG----------------------"
except NameError:
	print "n/a"
	print "---------------------------------------------------------"
	print "\n------------------------LEFT ANALOG----------------------"
#=========BUTTON ^============
try:
	for eventUP in tree.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1-"]/device[@name=""]/../event'):
#	for eventUP in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1-"]/event'):
		buttonUP = eventUP.get('id')
	print "^:       ",buttonUP
except NameError:
	print "n/a"
#=========BUTTON V============
try:
	for eventDOWN in tree.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1+"]/device[@name=""]/../event'):
#	for eventDOWN in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1+"]/event'):
		buttonDOWN = eventDOWN.get('id')
	print "v:       ",buttonDOWN
except NameError:
	print "n/a"
#=========BUTTON < ============
try:
	for eventLEFT in tree.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0-"]/device[@name=""]/../event'):
#	for eventLEFT in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0-"]/event'):
		buttonLEFT = eventLEFT.get('id')
	print "<:       ",buttonLEFT
except NameError:
	print "n/a"
#=========BUTTON > ============
try:
	for eventRIGHT in tree.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0+"]/device[@name=""]/../event'):
#	for eventRIGHT in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0+"]/event'):
		buttonRIGHT = eventRIGHT.get('id')
	print ">:       ",buttonRIGHT
	print "---------------------------------------------------------"
except NameError:
	print "n/a"
	print "---------------------------------------------------------"
#=========BUTTON |_|============
try:
	for eventSQUARE in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_10"]/device[@name=""]/../event'):
#	for eventSQUARE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_10"]/event'):
		buttonSQUARE = eventSQUARE.get('id')
	print "\n|_|:     ",buttonSQUARE
except NameError:
	print "n/a"
#=========BUTTON /\============
try:
	for eventTRIANGLE in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_7"]/device[@name=""]/../event'):
#	for eventTRIANGLE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_7"]/event'):
		buttonTRIANGLE = eventTRIANGLE.get('id')
	print "/\:      ",buttonTRIANGLE
except NameError:
	print "n/a"
#=========BUTTON X============
try:
	for eventX in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_8"]/device[@name=""]/../event'):
#	for eventX in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_8"]/event'):
		buttonX = eventX.get('id')
	print "X:       ",buttonX
except NameError:
	print "n/a"
#=========BUTTON O============
try:
	for eventO in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_9"]/device[@name=""]/../event'):
#	for eventO in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_9"]/event'):
		buttonO = eventO.get('id')
	print "O:       ",buttonO
except NameError:
	print "n/a"
#=========BUTTON SHARE============
try:
	for eventSHARE in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_0"]/device[@name=""]/../event'):
#	for eventSHARE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_0"]/event'):
		buttonSHARE = eventSHARE.get('id')
	print "\nSHARE:   ",buttonSHARE
except NameError:
	print "n/a"
#=========BUTTON OPTION============
try:
	for eventOPTION in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_1"]/device[@name=""]/../event'):
#	for eventOPTION in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_1"]/event'):
		buttonOPTION = eventOPTION.get('id')
	print "OPTION:  ",buttonOPTION
except NameError:
	print "n/a"
#=========BUTTON TOUCHPAD============
try:
	for eventTP in tree.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_17"]/device[@name=""]/../event'):
#	for eventTP in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_17"]/event'):
		buttonTP = eventTP.get('id')
	print "TOUCHPAD:",buttonTP
	print "\n========================================================================="
except NameError:
	print "n/a"
	print "\n========================================================================="
#=============SHOW DPI MOUSE=========== 
try:
	for controller in root.findall('controller[@id="1"]'):
		controllervalue = controller.get('dpi')
	print "\nMouse DPI value:                     ",controllervalue
except NameError:
	print "n/a"
#=============SHOW MOUSE SENSITIVITY PROFILE 1=========== 
try:
	for eventy in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@label="Aiming - y axis"]/event'):
		sensy = eventy.get('multiplier')
	print "Mouse sensitivity value (Hip Fire):  ",sensy
except NameError:
	print "n/a"
#=============SHOW MOUSE SENSITIVITY PROFILE 2=========== 
try:
	for eventy2 in root.findall('./controller[@id="1"]/configuration[@id="2"]/axis_map/axis[@label="Aiming - y axis"]/event'):
		sensy2 = eventy2.get('multiplier')
	print "Mouse sensitivity value (ADS):       ",sensy2
	print "\n"
except NameError:
	print "n/a"
	print "\n"

Run command:

Code: Select all

~# ./show_keys_map.sh
RPi will display all keys which was mapped in current use config (active.xml), also display current mouse DPI and sensitivity.
Image
PS4 enthusiast.
mkubiak
Posts: 12
Joined: Sat May 06, 2017 2:36 pm

Re: More convenient when using gimx on RPi?

Post by mkubiak »

Godlike wrote: Wed Dec 06, 2017 7:23 pm Check newest python versions. They're pretty easy to learn and code is much more readable compared to the old one. You can always write scripts in bash/perl/ruby, whatever you want to use.

I think mobile app is a bit overkill and could be pretty hard to implement properly as you need wireless connection with the Pi.
Not realy, all You need is a local network connection and basic webserver running on pi, android app can be a simple webview kisosk with custom css.

I intend to write webserver in python atm im trying to get a decent gimx friendly button recognition with evdev, Matlo mentioned he added an evdev cli config utility but i cant find the documentation for it.
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

Re: More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

Update python script to show key maps: script wouldn't stop if a button missed binding

Code: Select all

#!/usr/bin/python
import xml.etree.ElementTree as ET
tree = ET.parse('.gimx/config/active.xml')
root = tree.getroot()
print "\n\n\n ========================================================================"
print "================== QUICK DISPLAY BUTTONS KEYMAPPING ======================"
print " ========================================================================"
#=========BUTTON L1============
try:
	for eventL1 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_11"]/event'):
		buttonL1 = eventL1.get('id')
	print "\nL1:      ",buttonL1
except NameError:
	print "n/a"
#=========BUTTON R1============
try:
	for eventR1 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_12"]/event'):
		buttonR1 = eventR1.get('id')
	print "R1:      ",buttonR1
except NameError:
	print "n/a"
#=========BUTTON L2============
try:
	for eventL2 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_13"]/event'):
		buttonL2 = eventL2.get('id')
	print "\nL2:      ",buttonL2
except NameError:
	print "n/a"
#=========BUTTON R2============
try:
	for eventR2 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_14"]/event'):
		buttonR2 = eventR2.get('id')
	print "R2:      ",buttonR2
except NameError:
	print "n/a"
#=========BUTTON L3============
try:
	for eventL3 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_15"]/event'):
		buttonL3 = eventL3.get('id')
	print "\nL3:      ",buttonL3
except NameError:
	print "n/a"
#=========BUTTON R3============
try:
	for eventR3 in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_16"]/event'):
		buttonR3 = eventR3.get('id')
	print "R3:      ",buttonR3
	print "\n------------------------DPAD-----------------------------"                                   
except NameError:
	print "n/a"
	print "\n------------------------DPAD-----------------------------"                                   
#=========BUTTON ARROW UP============
try:
	for eventARROWUP in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_3"]/event'):
		buttonARROWUP = eventARROWUP.get('id')
	print "UP:      ",buttonARROWUP
except NameError:
	print "n/a"
#=========BUTTON ARROW DOWN============
try:
	for eventARROWDOWN in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_5"]/event'):
		buttonARROWDOWN = eventARROWDOWN.get('id')
	print "DOWN:    ",buttonARROWDOWN
except NameError:
	print "n/a"
#=========BUTTON ARROW LEFT============
try:
	for eventARROWLEFT in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_6"]/event'):
		buttonARROWLEFT = eventARROWLEFT.get('id')
	print "LEFT:    ",buttonARROWLEFT
except NameError:
	print "n/a"
#=========BUTTON ARROW RIGHT============
try:
	for eventARROWRIGHT in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_4"]/event'):
		buttonARROWRIGHT = eventARROWRIGHT.get('id')
	print "RIGHT:   ",buttonARROWRIGHT
	print "---------------------------------------------------------"
	print "\n------------------------LEFT ANALOG----------------------"
except NameError:
	print "n/a"
	print "---------------------------------------------------------"
	print "\n------------------------LEFT ANALOG----------------------"
#=========BUTTON ^============
try:
	for eventUP in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1-"]/event'):
		buttonUP = eventUP.get('id')
	print "^:       ",buttonUP
except NameError:
	print "n/a"
#=========BUTTON V============
try:
	for eventDOWN in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_1+"]/event'):
		buttonDOWN = eventDOWN.get('id')
	print "v:       ",buttonDOWN
except NameError:
	print "n/a"
#=========BUTTON < ============
try:
	for eventLEFT in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0-"]/event'):
		buttonLEFT = eventLEFT.get('id')
	print "<:       ",buttonLEFT
except NameError:
	print "n/a"
#=========BUTTON > ============
try:
	for eventRIGHT in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@id="rel_axis_0+"]/event'):
		buttonRIGHT = eventRIGHT.get('id')
	print ">:       ",buttonRIGHT
	print "---------------------------------------------------------"
except NameError:
	print "n/a"
	print "---------------------------------------------------------"
#=========BUTTON |_|============
try:
	for eventSQUARE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_10"]/event'):
		buttonSQUARE = eventSQUARE.get('id')
	print "\n|_|:     ",buttonSQUARE
except NameError:
	print "n/a"
#=========BUTTON /\============
try:
	for eventTRIANGLE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_7"]/event'):
		buttonTRIANGLE = eventTRIANGLE.get('id')
	print "/\:      ",buttonTRIANGLE
except NameError:
	print "n/a"
#=========BUTTON X============
try:
	for eventX in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_8"]/event'):
		buttonX = eventX.get('id')
	print "X:       ",buttonX
except NameError:
	print "n/a"
#=========BUTTON O============
try:
	for eventO in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_9"]/event'):
		buttonO = eventO.get('id')
	print "O:       ",buttonO
except NameError:
	print "n/a"
#=========BUTTON SHARE============
try:
	for eventSHARE in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_0"]/event'):
		buttonSHARE = eventSHARE.get('id')
	print "\nSHARE:   ",buttonSHARE
except NameError:
	print "n/a"
#=========BUTTON OPTION============
try:
	for eventOPTION in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_1"]/event'):
		buttonOPTION = eventOPTION.get('id')
	print "OPTION:  ",buttonOPTION
except NameError:
	print "n/a"
#=========BUTTON TOUCHPAD============
try:
	for eventTP in root.findall('./controller[@id="1"]/configuration[@id="1"]/button_map/button[@id="abs_axis_17"]/event'):
		buttonTP = eventTP.get('id')
	print "TOUCHPAD:",buttonTP
	print "\n========================================================================="
except NameError:
	print "n/a"
	print "\n========================================================================="
#=============SHOW DPI MOUSE=========== 
try:
	for controller in root.findall('controller[@id="1"]'):
		controllervalue = controller.get('dpi')
	print "\nMouse DPI value:                     ",controllervalue
except NameError:
	print "n/a"
#=============SHOW MOUSE SENSITIVITY PROFILE 1=========== 
try:
	for eventy in root.findall('./controller[@id="1"]/configuration[@id="1"]/axis_map/axis[@label="Aiming - y axis"]/event'):
		sensy = eventy.get('multiplier')
	print "Mouse sensitivity value (Hip Fire):  ",sensy
except NameError:
	print "n/a"
#=============SHOW MOUSE SENSITIVITY PROFILE 2=========== 
try:
	for eventy2 in root.findall('./controller[@id="1"]/configuration[@id="2"]/axis_map/axis[@label="Aiming - y axis"]/event'):
		sensy2 = eventy2.get('multiplier')
	print "Mouse sensitivity value (ADS):       ",sensy2
	print "\n"
except NameError:
	print "n/a"
	print "\n"
Result:
Image
PS4 enthusiast.
User avatar
kaiba_seto2004
Posts: 553
Joined: Sat Jul 15, 2017 9:15 am

Re: More convenient when using gimx on RPi?

Post by kaiba_seto2004 »

Hello,

I've just updated show key map script in case of your config got 2 or more devices. Updated script will show only key map on keyboard and mouse (device / name = "") :)
PS4 enthusiast.
Post Reply