Suspend/Sleep from RD CAN?

RealDash is a powerful package. However, deploying it into a vehicle is tricky, due to power concerns. This is not a fault in RealDash, but rather trying to adapt existing hardware to do a job it was not meant to do. Ideally, we would have a computer (SBC) that just read the logic level of the ignition switch, and if the ignition key was turned on, a logic 1 would trigger a SBC to wake up, and if the switch turned off, we would get a logic 0 that would command the SBC to suspend/sleep/hibernate. In practice, this has been hard to get.

I have a custom Arduino board that is capable of handling this from the Android side, by ‘pressing’ the power button on the SBC, and then monitoring the SBC’s GPIO to ensure it has gone to sleep or woken up. This works, but in practice the SBC sometimes only takes the hardware command to sleep as a suggestion. It may not stay asleep. However, issuing a software command seems to force it to sleep with better results. From the terminal, in sudo, simply entering


will put it to sleep more reliably. Linux uses something similar:

systemctl suspend


systemctl hibernate

My question is, can we get a command added to RD CAN, so that we can call these commands from our incoming data stream? For instance, if my attached Arduino hardware interface monitors the ignition switch, and sees the ignition turn off, runs through whatever onboard debounce and logic, sends a command via RD CAN to the Android (or Linux) SBC running RD, that RD will pick that up, and issue the sleep command?

I know this probably cannot be setup to go the other direction and wake up the device, but in practice, that seems to be an easier problem to fix in hardware than the sleep side.

I was thinking of an Action that would allow to execute any command to terminal. Sudo may be a problem as RealDash does not work when run as sudo. And also this action would not work on any other than Linux version of RealDash due the security limitations on other platforms.

Do you need sudo in Android or Linux to execute these commands? I haven’t tried, to be honest.

Even worse, you need root privileges in Android to issue terminal commands from apps.

Gotcha. Is there not an equivalent system command that RD can give, without root?

On the other hand, most people who will have a permanently installed RD setup will have root already for their devices.

Our manufacturer customers usually handle suspend/resume in their own separate background process.