Auto start/stop gimx on linux

General Chat, Feel Free To talk about anything here.
Post Reply
Tempik
Posts: 1
Joined: Mon Nov 13, 2017 12:15 pm
Location: Russia, Moscow

Auto start/stop gimx on linux

Post by Tempik »

Sorry fo my bad english.
I installed gimx on Gentoo Linux for work my ps4 and Logitech Driving Force GT. Thats work great! Thank you very much to the developers!
I would like to be able to auto start and stop the gimx when connecting to the PC of the my Logitech Driving Force GT.
For work auto start helped me udev.rules and hardware idVendo, idProduct.
I added to /etc/udev/rules.d/90-logitech.rules:

Code: Select all

ACTION=="add", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c29a", RUN+="/bin/bash /root/sh/gimx/start.sh"
/root/sh/gimx/start.sh:

Code: Select all

#!/bin/bash
cd /root/
/usr/bin/screen -A -m -d -S gimx /usr/bin/gimx -p /dev/ttyUSB0 -c 2.xml --nograb
Auto start work great! But I dont know how close gimx after disconected my Logitech Driving Force GT from the PC.
For example:

Code: Select all

ACTION=="remove", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c29a", RUN+="/bin/bash /root/sh/gimx/stop.sh"
Dont't work, because udev does not see disconect my Logitech Driving Force GT.

Code: Select all

[81623.919209] usb 3-2: USB disconnect, device number 3
As a temporary option, I created a cron script that runs every minute:

Code: Select all

#!/bin/bash
lsusb > /root/sh/gimx/usb
if grep -q Logitech /root/sh/gimx/usb
then
a=0
else
a=1
fi
if [[ $a == 1 ]]
then
/usr/bin/screen -S gimx -X quit
fi
But this is a poor solution to the problem

Somebody tried to solve this problem?
Post Reply