QNX Development for CIC

dolphin78

Private
Jun 23, 2017
42
Hi All,

Some very exciting news today. I made really good progress over last few days, here's a short video of the results:


The app is running from USB stick in glove box, started by autorun (using copie_scr.sh script to start the app), no modifications/patches were made to CIC.

Great thanks to @emoRaivis for his code example on how to display static image, it helped me a lot in the beginning.

No vsync yet and image is disappearing as I was rotating CIC controller. Looks like CIC uses 2 layers to display picture and is switching between them on each screen update. My app is rendering to one surface which is linked to one of the layers so while another layer is active gears are not visible. Rendering to 2 surfaces (surface ids 2 and 3 work best I think) and switching layers (need to find corresponding layers for these ids) should make it perfect.

Next step would be to find a way to use any input device. It can be either CIC controller or external keyboard. Does anybody have any ideas on how to do this?
 
Last edited:

dolphin78

Private
Jun 23, 2017
42
Attached is autorun script for usb (encrypted) which calls run.sh from USB (only the one in glove box works in F30, don't know about EXX).

Need to put both scripts in / of FAT32 formatted USB drive

copie_scr.sh has this inside
Code:
cd /fs/usb0
./run.sh
C code to encrypt/decrypt
Code:
#include <stdio.h>
 
unsigned int seed = 0x001be3ac;
 
unsigned int prng_rand() {
unsigned int r1, r3, r0;
 
r0 = seed;
r1 = (seed >> 1) | (seed << 31);
r3 = ((r1 >> 16) & 0xFF) + r1;
r1 = ((r3 >> 8) & 0xFF) << 16;
r3 -= r1;
seed = r3;
 
return r0;
}
 
int main(int argc, char *argv[]) {
int c;
 
prng_rand();
 
c = getchar();
while (c != EOF) {
c ^= (prng_rand() & 0xFF);
putchar(c);
c = getchar();
}
}
 

Attachments

doublespaces

Administrator
Oct 18, 2016
7,236
AZ
Oh wow... I have something called an xcarlink, it puts an android box onto the iDrive screen. I control the android box with a bluetooth keyboard.
 
  • Agree
Reactions: dolphin78

emoRaivis

Lurker
May 29, 2017
16
This is awesome, @dolphin78 ! Well done! Could you share your code for the glGears?

As for getting input from CIC controller - I think I saw something under /dev that appeared to be the controller device.

We would also need to find a way to kill HmiMain without restarting the CIC, because it would also capture all the inputs (there is no active/focused window like a normal desktop computer)
 

emoRaivis

Lurker
May 29, 2017
16
One hack-y way is to suspend the execution of HmiMain:
Code:
slay -h HmiMain
This will stop all the input processing and redrawing of the screen. I believe that @dolphin78 glGears app would not flicker anymore.

To resume the process, you can use:
Code:
slay -u HmiMain
 

dolphin78

Private
Jun 23, 2017
42
This is awesome, @dolphin78 ! Well done! Could you share your code for the glGears?

As for getting input from CIC controller - I think I saw something under /dev that appeared to be the controller device.

We would also need to find a way to kill HmiMain without restarting the CIC, because it would also capture all the inputs (there is no active/focused window like a normal desktop computer)
Here is the code: https://gist.github.com/dolphin78/5eb9fa9024d7dcc222a656277bcb2677

Our next steps should be
1. fix flickering (add vsync, implement double buffer)
2. find a way to get user input

Do you have in any ideas for practical use of all this? What kind of apps do you want do create/port?
 

dolphin78

Private
Jun 23, 2017
42
Answering my own question.

I think one of first app should be a launcher. Also I'd like to have a media player to be able to play video files from USB.
NBT natively supports it but CIC does not (correct me if I'm wrong).
 

emoRaivis

Lurker
May 29, 2017
16
Thanks for the code!

Even if we figure out all the aspects of QNX and CIC (like controls, audio and video), I imagine, developing apps natively on it would be quite time consuming, so my main goal is to get something like Apple CarPlay or Android Auto running on it and offload the rest development on to the smartphones. If not that, then I guess we could do something simple like video players or maybe pull Waze data and do notifications on speed traps, traffic jams etc. Either way - a lot of research and coding ahead. :)
 

dolphin78

Private
Jun 23, 2017
42
Thanks for the code!

Even if we figure out all the aspects of QNX and CIC (like controls, audio and video), I imagine, developing apps natively on it would be quite time consuming, so my main goal is to get something like Apple CarPlay or Android Auto running on it and offload the rest development on to the smartphones. If not that, then I guess we could do something simple like video players or maybe pull Waze data and do notifications on speed traps, traffic jams etc. Either way - a lot of research and coding ahead. :)
Please keep me updated on your plans. We can acheave more together. Android Auto or CarPlay would be nice but may be even harder to do than developing something custom.

CarPlay has a huge downside though - it's completely closed and you'll not be able to develop any new apps. Also there are very few existing apps out there (maps and music).
Don't know much about android auto, may we similar.

Better option may be to enable screen sharing/mirroring
 

emoRaivis

Lurker
May 29, 2017
16
Looks good, @dolphin78 ! Does it still flicker when you rotate the CIC controller?

Btw, I was wondering - are you just using the copie_scr.sh script and USB flash to run it on CIC or do you have access to the telnet and ftp? Since the CIC firmware update I still haven't been able to get back inside, even with a DHCP server.
 

dolphin78

Private
Jun 23, 2017
42
Looks good, @dolphin78 ! Does it still flicker when you rotate the CIC controller?

Btw, I was wondering - are you just using the copie_scr.sh script and USB flash to run it on CIC or do you have access to the telnet and ftp? Since the CIC firmware update I still haven't been able to get back inside, even with a DHCP server.
Yes, it does flicker if rotate the CIC controller or CIC updates the screen by itself but this doesn't bother me much as in some screens automatic refresh either happens rarely or doesn't happen at all. Using 'slay -h HmiMain' doesn't really work as CIC reboots in about 30-60 sec after I do this.

I do have access to telnet, never tried FTP. I often use copie_scr.sh to test something quickly as it takes much less time than connecting laptop, logging in, etc.

Do you want to check CIC ip address from copie_scr.sh (or from run.sh if you use the
copie_scr.sh version which I attached above)? You can execute ifconfig from it and redirect output to a file on the flash drive.
 

emoRaivis

Lurker
May 29, 2017
16
Even copie_scr.sh doesn't work for me - It appears that BMW has locked out all the ways to get inside in the latest firmware. Will have to look for ways to downgrade.
 

emoRaivis

Lurker
May 29, 2017
16
Even copie_scr.sh doesn't work for me - It appears that BMW has locked out all the ways to get inside in the latest firmware. Will have to look for ways to downgrade.
Ok, nevermind that - I'm just impatient and needed to just wait a few more seconds for it to work. Got the ip from ifconfig!
 

doublespaces

Administrator
Oct 18, 2016
7,236
AZ
You guys should put together an App store. Kind of like how they had Cydia for the iPhone, containing some repositories, etc.
 

dolphin78

Private
Jun 23, 2017
42
You guys should put together an App store. Kind of like how they had Cydia for the iPhone, containing some repositories, etc.
There's still a lot of research we'll need to do before we'll be able to do this. All this takes enormous amount of time, you know.

Also would you run an untrusted app in your car which potentially can brick not only CIC but ECUs as well?
 
  • Agree
Reactions: doublespaces

doublespaces

Administrator
Oct 18, 2016
7,236
AZ
Someone asked earlier what a good application would be. I would try, however I have a 2009 and don't have the fancy combox.
 

Xer0449

Corporal
Jan 30, 2017
170
Someone asked earlier what a good application would be. I would try, however I have a 2009 and don't have the fancy combox.
MHD or JB4 mobile, obviously :p

Also, I had no idea these threads have been getting traction :( I'm so excited to see how far this has come.
 
  • Like
Reactions: rhodesman
Top