05-22-2021, 03:10 PM
Hi All,
I'm running OpenAuto Pro 12.0.
My input is handled by an ESP32 reading CAN signals from the car, which then sends the commands as serial to the Raspberry Pi.
I am using a RPi 3 B+, and an external USB serial adapter. My python script to monitor these is running as a systemd service. The script then uses xdotool to mimic a keyboard press, which then navigates the menu. (see below0
Snippet of my python event monitor code below.
So this all works fine.. Until Android Auto is opened. When Android Auto is open, all commands are fired twice. I have verified that the EVENT_* commands are only being sent once by adding a print() to my python script. When I plug in a USB keyboard, the commands are only fired once, and I can navigate Android Auto (if pressing the keyboard).
If I then close the AA connection by turning off WiFi on my phone, the commands start working as normal (firing once).
I have verified that the service isn't at fault, by disabling that and manually running my python script in the terminal.
Have been bashing my head against this for hours and I am out of ideas. Anyone help?
My theory is that opening AA is running a "second instance?" of "autoapp", and xdotool is hitting it twice.
Thanks
I'm running OpenAuto Pro 12.0.
My input is handled by an ESP32 reading CAN signals from the car, which then sends the commands as serial to the Raspberry Pi.
I am using a RPi 3 B+, and an external USB serial adapter. My python script to monitor these is running as a systemd service. The script then uses xdotool to mimic a keyboard press, which then navigates the menu. (see below0
Snippet of my python event monitor code below.
if line==b'EVENT_LEFT\n':
os.system('export DISPLAY=:0.0 && xdotool search --class autoapp key --window %@ 1')
if line==b'EVENT_RIGHT\n':
os.system('export DISPLAY=:0.0 && xdotool search --class autoapp key --window %@ 2')
So this all works fine.. Until Android Auto is opened. When Android Auto is open, all commands are fired twice. I have verified that the EVENT_* commands are only being sent once by adding a print() to my python script. When I plug in a USB keyboard, the commands are only fired once, and I can navigate Android Auto (if pressing the keyboard).
If I then close the AA connection by turning off WiFi on my phone, the commands start working as normal (firing once).
I have verified that the service isn't at fault, by disabling that and manually running my python script in the terminal.
Have been bashing my head against this for hours and I am out of ideas. Anyone help?
My theory is that opening AA is running a "second instance?" of "autoapp", and xdotool is hitting it twice.
Thanks