Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External controls #3

Open
VinceBarns opened this issue Jan 24, 2021 · 4 comments
Open

External controls #3

VinceBarns opened this issue Jan 24, 2021 · 4 comments

Comments

@VinceBarns
Copy link

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?

@harrylepotter
Copy link
Owner

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?

@VinceBarns
Copy link
Author

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.

@aivs
Copy link

aivs commented Apr 16, 2021

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")

@silverter
Copy link

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants