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

More insights #1

Open
janbrodhaecker opened this issue Jan 5, 2020 · 61 comments
Open

More insights #1

janbrodhaecker opened this issue Jan 5, 2020 · 61 comments

Comments

@janbrodhaecker
Copy link

Hi! Can you give some more insights on the idea of how this should work with a raspberry?

@45clouds
Copy link
Owner

45clouds commented Jan 7, 2020

Hi Jan! I would like to put RPi3 into armrest base box. I have 2 USB ports there (both of them are CarPlay enabled). One of them will be directly connected to RPi3 using USB-A cable (male on both sides). Another one will be used as a power supply to RPI3. There are some presentations available on apple.com website that describe pairing process. Part1: https://developer.apple.com/videos/play/wwdc2016/722/ and part2: https://developer.apple.com/videos/play/wwdc2016/723/. The first step is to manage bluetooth connection between iPhone and RPi3 and after successful pairing the wireless connection should be established. Unfortunately bluezd stack doesn't support iAP2 profile. That's why I'm trying to implement part of Accessory SDK available from Apple to certified MFi hardware developers.

@45clouds
Copy link
Owner

45clouds commented Jan 7, 2020

You can read this article: https://blog.csdn.net/huangke2012hk/article/details/51240615 (please use google translate).

@45clouds
Copy link
Owner

45clouds commented Jan 7, 2020

And here is bluetooth part: https://blog.csdn.net/huangke2012hk/article/details/51226220

@janbrodhaecker
Copy link
Author

Wow! Thank you really much for the input! I am also really interested in achieving the same as you. I did not even had an idea where to start, but this helped me a lot. I will dive into the resources, you provided.

@45clouds
Copy link
Owner

45clouds commented Jan 7, 2020

Ok. I've a small gift for you. Please look at carplay.pdf in this repo :)

@45clouds 45clouds reopened this Jan 7, 2020
@45clouds 45clouds closed this as completed Jan 7, 2020
@janbrodhaecker
Copy link
Author

Oh my god! Thank you so much! Just seems like the holy grail for me! Thank you so much!!!

@janbrodhaecker
Copy link
Author

Unfortunately bluezd stack doesn't support iAP2 profile. That's why I'm trying to implement part of Accessory SDK available from Apple to certified MFi hardware developers.

Do you have already any idea where to start here?

@45clouds
Copy link
Owner

Hi Jan,

I have to talk to this man. Please read: https://hackernoon.com/building-an-ios-hardware-app-401eb4869012

@45clouds 45clouds reopened this Jan 15, 2020
@janbrodhaecker
Copy link
Author

Hi! Thanks for your answer, I really appreciate that you are sharing your information on that topic!

I just investigated a bit for an hour or so and I think without the accessory specification we will not get to manage it. To use iAP2 we would need to use the software authentication as we do not have any access to the Apple Authentication Coprocessor - but there is no documentation about that available for non-MFi people.

@45clouds
Copy link
Owner

Yes.... this topic is quite difficult as I see. I committed some new documentation directly from Apple. Look at Accessory Authentication (most important part), Authentication Coprocessor, Bluetooth Accessories and Device Authentication. Let me know if you will have some ideas because I'm a little bit lost right now.

@janbrodhaecker
Copy link
Author

Thanks! I see, this documentation is "free" available on the internet - I guess this is too old, as the the software authentication was introduced one year ago (as far as I understood it from the posts).

We would need a more recent documentation, I guess.

@45clouds
Copy link
Owner

I will talk to Chinese friends regarding new version. Meanwhile I noticed this:

https://www.microchipdirect.com/product/rn42apl-i/rm550

This chip is Bluetooth RN-42 module with Apple Level A firmware. Latest firmware 5.50 contains iAP2 support. I would prefer to have clean RPi-only solution but maybe I will purchase this chip to make some debugging.

@janbrodhaecker
Copy link
Author

Regarding the new version, maybe this link is helpful: https://download.csdn.net/download/SJno111/11984618

But I am not able to download ... and I am also not sure if this helps or not.

@45clouds
Copy link
Owner

45clouds commented Feb 5, 2020

Hi Jan. I got this file. It seems that Apple removed whole Chapter 23 (CarPlay) from this document. Please contact me directly and I will share this file with you.

@Vulpecula-nl
Copy link

I also interested in Apple Carplay on a raspberry pi. Do you have anything working to show?

@45clouds
Copy link
Owner

45clouds commented Feb 7, 2020 via email

@janbrodhaecker
Copy link
Author

But it seems that some Chinese companies have a workaround.

If so, this would be amazing! I guess, once the authentication is bypassed, the rest is quite easy to implement (compared to the authentication ;) )

@fboulegue
Copy link

damn nice project if we can support you somehow let me know!

@lodi12
Copy link

lodi12 commented Mar 23, 2020

Hi, Unfortunately we are still in early stage. The most important and interesting part is to establish BLE connection between iPhone and Raspberry which is iAP2 authenticated. Normally you need Apple Authentication Coprocessor which is available only for companies that have MFI certification. But it seems that some Chinese companies have a workaround. Cheers,

As far as I know, now Apple MFI uses software authentication but I cannot find any documentations online. To obtain the documentations for CarPlay you must enroll the MFi Program (https://developer.apple.com/programs/mfi/).

@janbrodhaecker
Copy link
Author

There is no proper source on the fact, that Apple uses software authentication from now on. The only thing I could find out is, that HomeKit devices do not need an hardware authentication any longer. For all other devices, there is still the hardware authentication (afaik).

@hbouhadji
Copy link

I think we should reverse the iOS frameworks source code of the mfi protocol (using ida/hopper/radare2).
You can find the binaries here (of the xcode simulator):

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/

Imo the best solution is to make an iOS tweak (require device jailbroken) to bypass the MFi authentication, but that's difficult too. I already lost so much time trying to do this

@AngrySKL
Copy link

AngrySKL commented Apr 9, 2020

Hi! First i wanna say this is a great project, it give me the ability to build my own wireless carplay. But to be honest, i'm still a little not sure about what should I do. So the basic idea is transfer carplay data through wifi but do wifi connection through bluetooth right? So if I have a rip3 chip with wifi and bluetooth module and configure wifi on AP mode -> connect my iphone to the bluetooth of the rip3 chip and then this project will take care of all the rest things automaticlly?

@savent404
Copy link

If u guys wanna do this on RPi3, crash the MFi first.

@WifiHero91
Copy link

WifiHero91 commented Jul 23, 2020

Check this guys for MFI hack.: Link to PPT http://2013.hackitoergosum.org

Other things.: If you use BLE no MFI needed.

@sa7mon
Copy link

sa7mon commented Nov 8, 2020

Hi all - just checking in. Has anyone got this working with any Raspberry Pi models? I see there are binaries in the repo. If they do work can someone post some general instructions on using them? Thanks!

@maaiika
Copy link

maaiika commented Nov 16, 2020

hey,u can buy a carplay dongle 。thats much easy https://github.com/electric-monk/pycarplay

@qdk0901
Copy link

qdk0901 commented Oct 20, 2021

All the things about IAP2 chip authentication have been located under
AccessorySDK/Support/MFiServerPlatformLinux.c

Just put the MFI CPIC (buy one from AliExpress) on to rpi board with i2c bus, the IAP2 auth stuffs should work

@janbrodhaecker
Copy link
Author

@qdk0901 could you provide more info on the MFI CPIC? Maybe a direct link?

@qdk0901
Copy link

qdk0901 commented Oct 20, 2021

ludwig-v/wireless-carplay-dongle-reverse-engineering#55
image

The MFi auth process read certificate or make challenge response from MFi CPIC through i2c bus,
some code in AccessorySDK/Support/MFiServerPlatformLinux.c

#define kMFiAuthDevicePath					"/dev/i2c-1"
...
// Write the data to sign.
	// Note: writes to the size register auto-increment to the data register that follows it.
	
	require_action( inDigestLen == 20, exit, err = kSizeErr );
	buf[ 0 ] = (uint8_t)( ( inDigestLen >> 8 ) & 0xFF );
	buf[ 1 ] = (uint8_t)(   inDigestLen        & 0xFF );
	memcpy( &buf[ 2 ], inDigestPtr, inDigestLen );
	err = _DoI2C( fd, kMFiAuthReg_ChallengeSize, buf, 2 + inDigestLen, NULL, 0 );
	require_noerr( err, exit );

@hbouhadji
Copy link

@Luccifer
Copy link

Luccifer commented Nov 9, 2021

@mcr-ksh
Copy link

mcr-ksh commented Feb 14, 2022

MFI CPIC

What are keywords to look for on ali? (just MFi and CPIC is way too generic)
Anyone found some I2C ready boards to attach to the RPi?

@hbouhadji
Copy link

image

I got it working by making an iOS tweak (jailbroken device required) to bypass the mfi authentication and tweaking a lot of other stuff on the program. probably can be done with a custom pcb and soldering a mfi chip on it.

@mcr-ksh
Copy link

mcr-ksh commented Jul 30, 2022 via email

@ChrisKader
Copy link

MFI

Would a custom PCB even be needed? The RPI has GPIO headers that can be used to communicate with it. Further, with the firmware dumps provided by this repo we have what we would need to use a MFI chip with a pi.

@ChrisKader
Copy link

Would it be possible to pass the auth straight to the radio?

@mcr-ksh
Copy link

mcr-ksh commented Aug 1, 2022

No idea what you mean with "pass the auth to the radio". You see the post from qdk0901 above that has a code snippet of the Apple MFi code, which directly references to the i2c device.

@hbouhadji
Copy link

I can confirm it works with a custom pcb and MFI chip. We got it working that way

On 30. Jul 2022, 10:16 +0100, Hakim @.>, wrote: I got it working by making an iOS tweak (jailbroken device required) to bypass the mfi authentication and tweaking a lot of other stuff on the program. probably can be done with a custom pcb and soldering a mfi chip on it. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

nice, but this need some soldering skill which i don't have

@ChrisKader
Copy link

No idea what you mean with "pass the auth to the radio". You see the post from qdk0901 above that has a code snippet of the Apple MFi code, which directly references to the i2c device.

So the mfi IC doesn’t care that it’s doing a challenge response for a device it wasn’t programmed for. Makes sense especially since CarPlay works without internet.

By radio, I mean the head unit. Treat our device as a pass through and act like it’s not even there. If an auth iap2 request comes in, we send it to the head unit and have it reply.

@ChrisKader
Copy link

Since the head unit is CarPlay ready, it has the IC and such needed to iap2 auth with a phone. When the phone connects to our Pi’s Bluetooth and starts the iap2 procedure, we pass the requests to the CayPlay head unit and in turn pass the replies to the phone.

@ChrisKader
Copy link

6C3C90F5-7BE0-4BF1-8B2A-E91CCAC6EEDE

@ChrisKader
Copy link

I also like the idea of this: https://github.com/OMGsus/MFiWrapper
Its for controllers but the idea in general is solid.

Also, it looks like we can piggy back off the MFI chip that the cars head unit uses. We can even modify the Capabilities data sent back from the head unit to make it look like it supports bluetooth carplay natively and then use our device as a middle man instead of an accessory.

@herenickname
Copy link

Some Chinese manufacturers of head units have a mfi chip inside and an application for wireless CarPlay.
For example, here is an application from Teyes head unit: https://www.file.io/S4fj/download/E1QzuTsie5NV
Perhaps this will help you understand the issue faster.

Personally, Im interested in getting CarPlay video stream on the screen of my RPi :)
I would like to know what is your progress now? @ChrisKader @qdk0901 @mcr-ksh

@Wh1terat
Copy link

Wh1terat commented Jan 8, 2023

Plenty of MFI ICs available from questionable sources in China.

Paid $245 a few years ago to get 20 boards made up, that included pcb, component sourcing, assembly and shipping.
Not bad given the low quantity.

IMG_1666

@liuwentai
Copy link

liuwentai commented Jan 8, 2023 via email

@350d
Copy link

350d commented Mar 24, 2023

Any progress here? Minimalistic pcb with MFI chip on looks a good way to start open source wireless dongle project!

@liuwentai
Copy link

liuwentai commented Mar 24, 2023 via email

@davidcorrigan714
Copy link

@Wh1terat Got any more info on that board you had made? Trying to find out the pinout and voltages for that chip to make some myself.

@Wh1terat
Copy link

@davidcorrigan714 All available in the leaked IC datasheets. I don't think I've got any local copies as this was a few years ago - but that's where I found all the info I needed back then.

@davidcorrigan714
Copy link

@Wh1terat Thanks! Just found it in the pdfs

@demianzenkov
Copy link

@Wh1terat could you please tell if you managed to run this and connect to CarPlay enabled car?

@Wh1terat
Copy link

@demianzenkov I never tried to be honest, I was running carplay on a Pi compiled from leaked sources (CarPlay_Communication_Plug-in_R14G17.2)

@gsustek
Copy link

gsustek commented Apr 8, 2024

@demianzenkov,@Wh1terat, so, we are hopeless without MFI hardware....

@demianzenkov
Copy link

CarPlay_Communication_Plug-in_R14G17.2

And how it worked for you? You managed to open CarPlay connection with headunit?

@demianzenkov
Copy link

@demianzenkov,@Wh1terat, so, we are hopeless without MFI hardware....

I have one that I can connect to raspberry i2c bus. But this code I guess is for headunit side, not the iOS gadget.

@Wh1terat
Copy link

Wh1terat commented Apr 9, 2024

CarPlay_Communication_Plug-in_R14G17.2

And how it worked for you? You managed to open CarPlay connection with headunit?

It was not my goal to emulate a phone, it was to be a carplay receiver (i.e headunit)

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