carplay-receiver icon indicating copy to clipboard operation
carplay-receiver copied to clipboard

External controls

Open VinceBarns opened this issue 4 years ago • 4 comments

I am trying to use a multimedia remote control to control the CarPlay functions and will report back. PS: the wireless connection works, but has significant delays. Any hints?

VinceBarns avatar Jan 24 '21 10:01 VinceBarns

Hey @VinceBarns - take a look at decoder.py - this is where the keypresses are interpreted. It'd probably be super straightforward to work the changes in there. I currently get media events from MPV. Not sure if your remote is compatible with that?

harrylepotter avatar Jan 24 '21 18:01 harrylepotter

Thanks. So far it only works as a workaround in desktop mode with key mapper (https://github.com/sezanzeb/key-mapper) by mapping the buttons of the multimedia remote control to your assigned keys. Basic problem: Key codes >255 are not natively recognized and mapped by the system. - this is especially the case in CLI mode. My goal is to start in CLI mode so I will find a better solution.

VinceBarns avatar Apr 07 '21 12:04 VinceBarns

Hi! This is my solution to control CarPlay by the car buttons. Python script catches button presses on the CAN Bus (Skoda Octavia A5) and emulates keyboard keystrokes. Sometimes you get a few clicks, revision required. https://youtu.be/C-H0AFtaqCk

#!/usr/bin/python3
import time
import keyboard
import can

try:
    bus = can.interface.Bus("can0", bustype="socketcan")
except OSError:
    print("Cannot find CAN Board")
    exit()

try:
    while True:
        message = bus.recv()
        if (message.arbitration_id == 0x2C1):
            # UP
            if (message.data[2] == 0xAD):
                keyboard.press_and_release("right")
            # DOWN
            elif (message.data[2] == 0x9D):
                keyboard.press_and_release("left")
            # OK
            elif (message.data[2] == 0xCD):
                keyboard.press_and_release("enter")

except KeyboardInterrupt:
    print("keyboard")

aivs avatar Apr 16 '21 16:04 aivs

@aivs thank you for posting this code. I got it - with some adaptation - working for my Audi RNS-E on a Audi A3 8P. If anyone is interrested in the code for Audi RNS-E, please let me know.

Now what I would like to do is integrate this carplay receiver into my custom car pc solution similar to this one: https://youtu.be/OCIqMNJsGWk I have the following questions:

  1. How can I assign a button to start / switch to carplay on demand ?
  2. How can I return to my carplay interface using the "manufacturer button" in carplay?

I hope you guys get what I'm trying to achivee.

Thanks all!

silverter avatar Aug 28 '21 10:08 silverter