Coder Social home page Coder Social logo

Comments (27)

jsm174 avatar jsm174 commented on July 17, 2024 1

@Pantman - Let me know if this scp works:

https://github.com/jsm174/wireless-carplay-dongle-reverse-engineering/tree/script/dropbear-scp

If so, I'll submit a PR

from wireless-carplay-dongle-reverse-engineering.

jsm174 avatar jsm174 commented on July 17, 2024 1

@Pantman - Sorry for the delay on sftp. I got side tracked with my unit being messed up and I figured I better get this going before I completely break it.

Anyway, good news! I got it working. We needed to build sftp-server. That required building libz. I was having trouble getting libz working. Turns out every lib on the dongle, is soft-float ABI, while the toolchain I was using was hard-float ABI. After figuring that out, I can simplify my notes. (no more patchelf)

I'll make an official PR soon.

Look at the new script @ https://github.com/jsm174/wireless-carplay-dongle-reverse-engineering/tree/script/dropbear-sftp-server/Custom_Firmware/Scripts/Dropbear

It makes a new directory /usr/libexec and links sftp-server. It also makes the needed link to libz.so in /user/lib.

Not quite sure how this works, but somehow Dropbear knows to use sftp-server when it's in that folder.

Here is the connection info using FileZilla:

Screen Shot 2021-03-13 at 12 07 53 PM

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024 1

@jsm174 πŸ‘ β€” works!

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

rc.dll seems to be a repository of resources/png files. rcvec.dll looks like an index of the resources.

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

I had a play with the file /usr/sbin/ui.tar.gz, sure enough it controls the UI. I'm working on reconfiguring the UI to work better on my 1920x720 screen.

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

I figured out some of the format of rc.dll and rcvec.dll. The pixel data for each png is zlib deflated and stored in rc.dll. rcvec.dll contains metadata. I'm not sure of the entire format, but basically the width, height, stride, and offset into rc.dll is stored, along with the path to the original png file. I think this should be enough to generate a new file with new icons.

Here's a python script to extract the png data from the resource files. Run it in a directory containing the dll files:

#!/usr/local/opt/python/bin/python2.7
# read rc_vec.dll and rc.dll, and export png files

import zlib
import struct
import png

def readString(myfile):
    chars = []
    while True:
        c = myfile.read(1)
        if c == None or c == chr(0):
            return "".join(chars)
        chars.append(c)

class Resource:

	def __init__(self):
		width = 0
		height = 0
		offset = 0
		stride = 0
		path = ""
		filename = ""

	def Print(self):
		print("width = {}").format(res.width)
		print("height = {}").format(res.height)
		print("offset = {}").format(res.offset)
		print("stride = {}").format(res.stride)
		print("path = {}").format(res.path)
		print("filename = {}").format(res.filename)

	@staticmethod
	def Read(myfile):

		chunk = myfile.read(80);
		
		if not chunk:
			return None

		res = Resource()

		header = struct.unpack("6I12s2I8s7I",chunk) # read struct
		res.path = readString(myfile) 
		padding = (4 - (len(res.path) + 1) % 4) % 4
		myfile.read(padding) #skip padding

		res.width = header[7]
		res.height = header[8]
		res.offset = header[13]
		res.stride = header[14]	

		res.filename = "./" + res.path.split("\\")[-1];

		return res


rc = open("./rc.dll", mode="rb")
compressed_bytes = rc.read()
rc.close()

rcvec = open("./rcvec.dll", mode="rb")

while True:

	res = Resource.Read(rcvec)

	if not res:
		break	

	res.Print()

	decoded = zlib.decompress(compressed_bytes[res.offset:])

	png_file = open(res.filename, "wb")

	png_writer = png.Writer(res.width, res.height, greyscale=False, alpha=True, bitdepth=8)

	png_writer.write_array(png_file, decoded)

	png_file.close()


rcvec.close()

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

Thank's, I added your script inside the repo, do not hesitate to create a pull request for any update to be listed as a contributor ;)

https://github.com/ludwig-v/wireless-carplay-dongle-reverse-engineering/blob/master/Firmware_Tools/rc_dll_extract.py

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

Sounds good. I made a small change yesterday (size of compressed block is in the rcvec file). I'll look into pushing it soon.

By the way - Would it be possible to add an scp binary to your dropbear configuration? I'm tinkering with the UI, but currently I have to use tftp to fetch my changes, which is a little awkward, and required more setup on the host side.

I'd build it myself, but I don't have a cross compile setup yet.

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

@jsm174 can probably help us with that :)
I don't have QEMU ready either

from wireless-carplay-dongle-reverse-engineering.

jsm174 avatar jsm174 commented on July 17, 2024

@Pantman, I'll see what I can do later tonight. Luckily, I still have the QEMU instance I set up!

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

Hi! I'd like to help out with this UI Tweaking as well... I tried replacing the otf with a different font (same filename) and changed the focus colors and changed the software version... but doing so, I think I jacked something up on the UI. Now the unit boots, webpage loads, but the UI is black... using the latest custom AUTOKIT firmware. Anyway to get the unit to accept updates again? or is this bricked... it's a CarLinkKit v2

Also -- used your dll extract -- worked good -- do we have the ability to create the DLL with updated images?

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

@jsm174 - thanks very much. I just tested your build, and scp runs on the device (I tested by running on the command line). I have not yet managed to get it working with dropbear though. I need to do some more reading!

@dmavromatis - I haven't got around to replacing the images yet. Depending on the approach it might be fairly simple (just replace the zipped pixel data, and update the offsets/sizes in the file). To fix your problem I expect you just need to restore your original ui.tar.gz. Try copying onto a USB stick, and copy the original file over to /usr/sbin.

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

@jsm174 - I'm trying to find how to get dropbear working with scp. Some pages suggest building scp should be enough - however when I tried it, I got an error :

sh: scp: not found
lost connection

This page suggests that scp support is a compile option for dropbear. I'm not really sure. Do you have any idea how to get dropbear working as an scp server?

from wireless-carplay-dongle-reverse-engineering.

jsm174 avatar jsm174 commented on July 17, 2024

@Pantman - unfortunately I do not. I compiled it with scp. Someone suggested we need to add dbclient as well? https://stackoverflow.com/questions/31860538/dropbear-build-only-scp

I'll add it in, first thing tomorrow morning.

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

Hi! I'd like to help out with this UI Tweaking as well... I tried replacing the otf with a different font (same filename) and changed the focus colors and changed the software version... but doing so, I think I jacked something up on the UI. Now the unit boots, webpage loads, but the UI is black... using the latest custom AUTOKIT firmware. Anyway to get the unit to accept updates again? or is this bricked... it's a CarLinkKit v2

Also -- used your dll extract -- worked good -- do we have the ability to create the DLL with updated images?

As @Pantman said, use U2W.sh :

cp /mnt/UPAN/ui.tar.gz /usr/sbin/ui.tar.gz
sync
reboot

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

Got it working again β€” however, swapping out with another font and renaming to carlinkit.otf doesn’t seem to work. Do we have to do anything special with the UI folder? Meaning when we untar, make changes and just tar again, right?

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

@dmavromatis In the new firmware there are two fonts. In the old firmware, the Nano font is the main one. I changed it on the older version of the UI, and it worked (although in my case space characters were oddly sized). Maybe it's still the main font in the new UI?

Also make sure the font isn't too big, or it won't work. You may need to strip characters to reduce the otf size.

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

OK -- I've made progress as well on the customization. I change the English localizations (fixing their poor grammar). I was also able to replace the font to the one used by my vehicle manufactures UI's -- I used a font creator to replace the characters (English/latin) so I wouldn't lose the other Chinese characters, etc.

However, I cannot seem to change the color of the backgrounds from red to something else -- those seem to be part of the DLL and extracting them they are blue not red!!?? Have you been successful changing the button background colors?

I'm working on the formatting right now but let me know if you got the red buttons changed...

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

There is some issue with colors, red appears blue and blue appears red, they probably reversed Blue & Red in RGB array bytes

I wrote my images replacer in PHP, still playing around before releasing it

Displayed:
POC
Modified:

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

Confirmed, the order of RGB is reversed, it is a BGR array

Working better:
UI

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

@ludwig-v that's awesome... so we'll be able to have a DLL packager script? I'll post my screen update soon -- I went super clean but now that we can add graphics I might be able to make it look even more native to my vehicles UI.

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024
  • Unpacked "lang.png" (1489 B) from rc.dll
  • Unpacked "quitbkg.png" (94 B) from rc.dll
  • Unpacked "check.png" (3625 B) from rc.dll
  • Unpacked "dm.png" (32 B) from rc.dll
  • Unpacked "sm.png" (24 B) from rc.dll
  • Unpacked "Minus.png" (165 B) from rc.dll
  • Unpacked "eqslid.png" (4673 B) from rc.dll
  • Unpacked "Add.png" (562 B) from rc.dll
  • Unpacked "settingOnTriger.png" (634 B) from rc.dll
  • Unpacked "settingOffTriger.png" (623 B) from rc.dll
  • Unpacked "loadsmall.png" (2844 B) from rc.dll
  • Unpacked "weburl.png" (7484 B) from rc.dll
  • Unpacked "usbintro.png" (2504 B) from rc.dll
  • Unpacked "linebar.png" (47 B) from rc.dll
  • Unpacked "btintro_cn.png" (22830 B) from rc.dll
  • Unpacked "home.png" (589 B) from rc.dll
  • Unpacked "dbutleft.png" (842 B) from rc.dll
  • Unpacked "dbutleftp.png" (727 B) from rc.dll
  • Unpacked "dbutmid.png" (145 B) from rc.dll
  • Unpacked "dbutmidp.png" (114 B) from rc.dll
  • Unpacked "dbutright.png" (873 B) from rc.dll
  • Unpacked "dbutrightp.png" (751 B) from rc.dll
  • Unpacked "Language.png" (2738 B) from rc.dll
  • Unpacked "listup0.png" (1441 B) from rc.dll
  • Unpacked "listup1.png" (384 B) from rc.dll
  • Unpacked "listdown0.png" (1444 B) from rc.dll
  • Unpacked "listdown1.png" (395 B) from rc.dll

28 images have been extracted inside ui/ folder
Keep original filenames and paths to repack after editing images

Added:
https://github.com/ludwig-v/wireless-carplay-dongle-reverse-engineering/tree/master/Firmware_Tools

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

BAM! works great... here's my interface. Matches my vehicles fonts and styling... it seems like the current BG is set to a dark grey -- not pure black. I can see when the UI loads, it's a tad bit brighter than the infotainments black. Any idea where that's coming from?

final

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

Just a reminder that Carplay is a H264 video being played by your head unit that can results in some colors losses, moreover Carlinkit device interface is probably encoded with ffmpeg at ultrafast preset

from wireless-carplay-dongle-reverse-engineering.

dmavromatis avatar dmavromatis commented on July 17, 2024

makes sense... I'm more than happy with the results. Thanks for all your work on this!

from wireless-carplay-dongle-reverse-engineering.

Pantman avatar Pantman commented on July 17, 2024

@jsm174 Amazing! I'll try it today!

from wireless-carplay-dongle-reverse-engineering.

ludwig-v avatar ludwig-v commented on July 17, 2024

Closing as this is not an issue, just opened "Discussions" tab here: https://github.com/ludwig-v/wireless-carplay-dongle-reverse-engineering/discussions

from wireless-carplay-dongle-reverse-engineering.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.