USB Port Assignments keep changing

I have and Chinese android head unit using both USB ports to connect and Autronic and a custom Arduino CAN signal.

I can go in and manually connect each input and everything works for a while. Once there is any sort of interruption it loses connection and the USB port assignments change number and I have to go and reconnect them manually again. Is there a way to prevent them renumbering?

It doesn’t seem to be an issue if I just have one device connected alone, that always seems to just reconnect ok.

I’m not sure if it is Android assigning the USB port numbers or just within the app?

This is a known problem. The OS assigns port identifiers and those are the only way to connect to the devices. This problems is especially difficult if you try to connect multiple devices of same type. Currently, there is nothing we can do about this on app level, sorry :frowning:

I’m looking at whether there has ever been a solution to this problem when using 2 USB ports on Android 12V car audio tablet devices?

I notice there are a few github projects like this one linked below. They seem to work from the Android device without root access to manage the assignment of the USB ports to COM ports and set the required baud rate etc.

Is the realdash app already using something like this within the app? It seems to already find various different USB to serial adapters and set up the ports but still has no control over what Android choses to name the ports each time and I have to do that within the app garage every time. Windows laptop never had this problem back when I was testing it a couple of years ago.

I really wish I could just force them to stay assigned as COM3 and COM4.

Can I run something like this github link below to run on startup each time to detect my two connections and assign the COM ports and baud rate that Realdash sees?

Other that this issue my tablet dash has been working great on my old Cortina weekender.

The Arduino has has a power supply board with noise filtering, it uses and output to control its own power supply relay to delay shutdown until the odometer value is stored away in the eeprom and all it shut down properly. I have all of the analogue inputs conditioned with voltage dividers for 12V inputs like blinkers, high beam, battery voltage, fuel gauge, vehicle speed sensor

I have pressure and temperature sensors all working nicely via the constant 5V supply that also powers the Arduino.

The main engine parameters come in via the Autronic ECU serial to USB: RPM, Boost, TPS, Coolant Temp, Ignition advance etc.

There is no way to change how Android sees the names of the USB devices. And if you plug in two identical devices with identical serial numbers, they cannot be identified from each other in any manner and OS will assign internal port as it pleases.

So, I’m running into this issue too. I’ve got a couple ideas to get around this. One, I would need dev help for sure.

First idea: RD looks at the first CAN frame received and tries to match it with a previously saved template. If it doesn’t match up, it moves onto the next serial device. Once it finds a matching frame, it can move onto detecting the next device.

Second idea: It seems the order they are added to the Garage may impact the order of detection. I can fairly consistently boot with 1 serial device connected, have it make a proper connection, then plug in the second serial device, and it connects fine. If I create a timer circuit that prevents the second device from registering with the android, I might be able to get consistent connections on boot without touching things.

Most clean would be if you could ID the can frames I think. Thoughts?

In my situation, I have a USB serial CAN analyzer pulling from the Haltech CANbus, and an Arduino doing the RealDash Canbus over USB serial as well. My android headunits have Bluetooth neutered, so that’s not an option.

Or I try to figure out how to make the Arudino talk network CAN to RD, but that sounds like a lot of work, programming is not my day job.

There’s got to be some clever way to get around this I feel.

I resolved the issue on mine when I bought a alightly better head unit for about $150 in a black Friday sale a couple of years ago.

I got a a Seicane branded head unit and the USB inputs are alwyas just USB1 and USB 2 and I never have any issues since

It boots up in about 10 seconds and both my engine ECU and Arduino streams connect consistenly now.

2 Likes

Hmm that sounds like a dice roll. I have a few android headunits, and none of them show up as USB 1 and USB 2. Always USB Serial. What Android OS version does yours run? Pretty sure my newest one is Android 13.

Believe me, I have been trying to find solution for this for some time. Some Android devices show always the same name ‘USB Serial’ for all devices. Although, RealDash uses the name, VID, PID and serial number (if available) to identify the USB device, it still does not work correctly sometimes with multiple USB devices attached.

On CAN connections, we could try to detect that we are receiving ‘correct’ CAN frames, but there are 2 dozen different connection types that suffers from same situation.